Repository navigation
feat(core)!: @codec implements a default from - #429
Conversation
Hanssen0
commented
Jul 3, 2026
- I have read the Contributing Guidelines
🦋 Changeset detectedLatest commit: 26dc4bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for appccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for liveccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for docsccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for apiccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR introduces an auto-generated from() implementation in the @codec decorator so Entity classes can omit bespoke from() methods when their constructors accept the codec-decoded shape, and then refactors several entities/codecs to leverage that new behavior (major version bump).
Changes:
- Extend
@codecto install a defaultfrom()(when missing) alongsideencode/decode/fromBytes. - Refactor multiple CKB-related entities/codecs (e.g.,
Script,OutPoint,WitnessArgs, multisig witness) to use decoded-shape constructors and/or shared codec definitions. - Expand unit tests to cover the auto-generated
from()path andsuper.from(...)delegation patterns.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/did-ckb/src/codec.ts | Adjusts DID-CKB entities to decoded-shape constructors; relies more on codec-provided defaults. |
| packages/core/src/signer/ckb/signerMultisigCkbReadonly.ts | Extracts an explicit MultisigCkbWitnessCodec and updates entity construction to decoded-shape. |
| packages/core/src/codec/entity.ts | Adds default from() generation in the @codec decorator. |
| packages/core/src/codec/entity.test.ts | Adds tests validating auto-generated from() and super.from(...) delegation. |
| packages/core/src/ckb/transaction.ts | Refactors several transaction-related entities to use codec-defined shapes and constructor normalization. |
| packages/core/src/ckb/script.ts | Converts Script to use a shared ScriptCodec + decoded-shape constructor and drops custom from(). |
| packages/core/src/ckb/epoch.ts | Introduces EpochCodec constant and adjusts constructors/fromNum to use Epoch.from(...). |
| .changeset/sixty-ants-hang.md | Declares a major release for the core behavior change. |
|
Finally finished these type gymnastics. |
