Skip to content

feat(core)!: @codec implements a default from - #429

Merged
Hanssen0 merged 2 commits into
ckb-devrel:next-majorfrom
Hanssen0:feat/default-from
Jul 3, 2026
Merged

Hanssen0 merged 2 commits into
ckb-devrel:next-majorfrom
Hanssen0:feat/default-from

Conversation

@Hanssen0

@Hanssen0 Hanssen0 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings July 3, 2026 03:29
@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 26dc4bf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@ckb-ccc/core Major
@ckb-ccc/did-ckb Patch
@ckb-ccc/eip6963 Patch
@ckb-ccc/joy-id Patch
@ckb-ccc/lumos-patches Patch
@ckb-ccc/nip07 Patch
@ckb-ccc/okx Patch
@ckb-ccc/rei Patch
@ckb-ccc/shell Patch
@ckb-ccc/spore Patch
@ckb-ccc/ssri Patch
@ckb-ccc/type-id Patch
@ckb-ccc/udt Patch
@ckb-ccc/uni-sat Patch
@ckb-ccc/utxo-global Patch
@ckb-ccc/xverse Patch
@ckb-ccc/ccc Patch
ckb-ccc Patch
@ckb-ccc/connector Patch
@ckb-ccc/connector-react Patch

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

@netlify

netlify Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for appccc ready!

Name Link
🔨 Latest commit 26dc4bf
🔍 Latest deploy log https://app.netlify.com/projects/appccc/deploys/6a472c9767d3380008a36f21
😎 Deploy Preview https://deploy-preview-429--appccc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 68 (🔴 down 14 from production)
Accessibility: 89 (🟢 up 1 from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for liveccc ready!

Name Link
🔨 Latest commit 26dc4bf
🔍 Latest deploy log https://app.netlify.com/projects/liveccc/deploys/6a472c97e415370008fb22aa
😎 Deploy Preview https://deploy-preview-429--liveccc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 35 (🔴 down 3 from production)
Accessibility: 88 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for docsccc ready!

Name Link
🔨 Latest commit 26dc4bf
🔍 Latest deploy log https://app.netlify.com/projects/docsccc/deploys/6a472c97176e0800086b4e45
😎 Deploy Preview https://deploy-preview-429--docsccc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 71 (🔴 down 16 from production)
Accessibility: 95 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 75 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for apiccc ready!

Name Link
🔨 Latest commit 26dc4bf
🔍 Latest deploy log https://app.netlify.com/projects/apiccc/deploys/6a472c9719d3fc00083ca627
😎 Deploy Preview https://deploy-preview-429--apiccc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 84 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 95 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @codec to install a default from() (when missing) alongside encode/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 and super.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.

Comment thread packages/did-ckb/src/codec.ts
Comment thread packages/did-ckb/src/codec.ts
@Hanssen0
Hanssen0 merged commit 8aa22f0 into ckb-devrel:next-major Jul 3, 2026
17 checks passed
@Hanssen0
Hanssen0 deleted the feat/default-from branch July 3, 2026 03:37
@Hanssen0

Hanssen0 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

Finally finished these type gymnastics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants