Repository navigation
feat(core)!: Codec.from - #425
Conversation
Hanssen0
commented
Jul 2, 2026
- I have read the Contributing Guidelines
🦋 Changeset detectedLatest commit: 584a1eb 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 docsccc 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 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 a Codec.from(...) normalization pathway and expands codec support with a from() conversion hook, then refactors multiple entities/codecs to rely more on auto-generated from/encode/decode/fromBytes behavior (plus adds tests to lock the behavior in).
Changes:
- Add
Codec.from(...)and propagatefrom()support through core codecs (including Molecule helpers like vectors/options/tables/structs/unions). - Refactor several entities (CKB transaction/script/epoch, multisig witness, DID-CKB data) to use decoded-shape constructors and decorator-driven serialization helpers.
- Add/adjust tests validating the new
Entity + codecauto-generation and updated construction patterns.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/did-ckb/src/codec.ts | Refactors DID-CKB entity constructors; adjusts PlcAuthorization normalization. |
| packages/core/src/signer/ckb/signerMultisigCkbReadonly.ts | Switches multisig witness encoding/decoding to a Codec.from(...)-built codec and decoded-shape constructor. |
| packages/core/src/signer/ckb/signerMultisigCkb.test.ts | Updates tests to construct via .from(...) instead of positional constructors. |
| packages/core/src/molecule/predefined.ts | Adds from() for predefined String molecule codec. |
| packages/core/src/molecule/codec.ts | Adds from() implementations to multiple molecule combinators (vec/option/table/struct/array/union). |
| packages/core/src/codec/predefined.ts | Adds from() to core predefined codecs (uint/bool/bytes/padding, etc.). |
| packages/core/src/codec/entity.ts | Refactors Entity.Base and @codec decorator to support auto-generated from/encode/decode/fromBytes. |
| packages/core/src/codec/entity.test.ts | Adds coverage for auto-generated entity methods and custom from() delegation. |
| packages/core/src/codec/codec.ts | Extends CodecLike/Codec with from() and improves encode/decode normalization. |
| packages/core/src/ckb/transaction.ts | Refactors multiple transaction-related entities to decoded-shape constructors and codec constants. |
| packages/core/src/ckb/script.ts | Refactors Script to decoded-shape constructor and extracted codec constant. |
| packages/core/src/ckb/epoch.ts | Refactors Epoch to decoded-shape constructor and extracted codec constant; updates creation sites. |
| packages/core/src/ckb/epoch.test.ts | Updates tests to use Epoch.from(...) rather than new Epoch(...). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cb44dbc to
5ce1932
Compare
3b53646 to
cfbfb2b
Compare
