Skip to content

feat(coin): new coin package#415

Draft
Hanssen0 wants to merge 1 commit into
ckb-devrel:devfrom
Hanssen0:feat/coin
Draft

feat(coin): new coin package#415
Hanssen0 wants to merge 1 commit into
ckb-devrel:devfrom
Hanssen0:feat/coin

Conversation

@Hanssen0

Copy link
Copy Markdown
Member

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d4267da

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

This PR includes changesets to release 6 packages
Name Type
@ckb-ccc/shell Minor
@ckb-ccc/coin Minor
@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 Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for apiccc ready!

Name Link
🔨 Latest commit d4267da
🔍 Latest deploy log https://app.netlify.com/projects/apiccc/deploys/6a440dd360739300082e0d98
😎 Deploy Preview https://deploy-preview-415--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 (🔴 down 1 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.

@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for appccc ready!

Name Link
🔨 Latest commit d4267da
🔍 Latest deploy log https://app.netlify.com/projects/appccc/deploys/6a440dd3df8be00008fdd926
😎 Deploy Preview https://deploy-preview-415--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: 69 (🔴 down 10 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 Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for liveccc ready!

Name Link
🔨 Latest commit d4267da
🔍 Latest deploy log https://app.netlify.com/projects/liveccc/deploys/6a440dd3aaa7fc0008941552
😎 Deploy Preview https://deploy-preview-415--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: 36 (🔴 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 Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for docsccc ready!

Name Link
🔨 Latest commit d4267da
🔍 Latest deploy log https://app.netlify.com/projects/docsccc/deploys/6a440dd3bdf9be00085c854b
😎 Deploy Preview https://deploy-preview-415--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: 73 (🔴 down 14 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.

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 a new @ckb-ccc/coin workspace package that provides a generic fungible-token (Coin) helper built on @ckb-ccc/core, and wires it into the monorepo’s testing/docs tooling and the @ckb-ccc/shell re-export surface.

Changes:

  • Added new packages/coin package (Coin implementation, tests, build/lint/test/tooling config, docs).
  • Updated root Vitest + TypeDoc configs to include packages/coin.
  • Updated @ckb-ccc/shell to depend on and re-export @ckb-ccc/coin; updated lockfile accordingly.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vitest.config.mts Adds packages/coin to the monorepo Vitest projects list.
typedoc.config.mjs Adds packages/coin to TypeDoc workspace entry points.
pnpm-lock.yaml Adds the packages/coin importer and updates resolved dependency snapshots.
packages/shell/src/barrel.ts Re-exports the coin namespace from @ckb-ccc/coin.
packages/shell/package.json Adds @ckb-ccc/coin as a workspace dependency.
packages/coin/vitest.config.ts Adds package-local Vitest configuration for tests and coverage.
packages/coin/typedoc.json Adds package-local TypeDoc configuration for API generation.
packages/coin/tsdown.config.mts Adds tsdown build configuration for ESM+CJS outputs and copy-basedirs.
packages/coin/tsconfig.json Adds TypeScript build configuration for the coin package.
packages/coin/src/index.ts Exposes barrel exports and a coin namespace export.
packages/coin/src/coin/index.ts Implements the Coin class (balance/info helpers and transaction completion helpers).
packages/coin/src/coin/index.test.ts Adds Vitest coverage for Coin behaviors (inputs completion, change handling, balance/info helpers).
packages/coin/src/coin/error.ts Adds ErrorCoinInsufficient error type for insufficient Coin balance conditions.
packages/coin/src/coin/coinInfo.ts Adds CoinInfo aggregation helper used by the Coin implementation.
packages/coin/src/barrel.ts Re-exports the coin module surface from src/coin.
packages/coin/README.md Adds package documentation and usage examples.
packages/coin/prettier.config.cjs Adds package-local Prettier configuration.
packages/coin/package.json Defines the new @ckb-ccc/coin package metadata, exports, and scripts.
packages/coin/misc/basedirs/dist/package.json Ensures emitted ESM dist is treated as "type": "module".
packages/coin/misc/basedirs/dist.commonjs/package.json Ensures emitted CJS dist is treated as "type": "commonjs".
packages/coin/eslint.config.mjs Adds package-local ESLint + typescript-eslint configuration.
packages/coin/.prettierignore Adds package-local Prettier ignore rules.
packages/coin/.npmignore Adds package-local npm publish ignore rules.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/coin/src/coin/index.ts Outdated
Comment thread packages/coin/typedoc.json
@Hanssen0 Hanssen0 force-pushed the feat/coin branch 5 times, most recently from 9481017 to 982850a Compare June 30, 2026 08:04
@Hanssen0 Hanssen0 requested a review from Copilot June 30, 2026 08:05

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

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread packages/coin/src/coin/index.ts Outdated
Comment thread packages/coin/src/coin/index.ts Outdated
Comment thread packages/coin/src/coin/index.ts Outdated
Comment on lines +286 to +300
/**
* Adds Coin inputs until both the Coin balance gap and the CKB capacity gap are covered.
*
* @param balanceTweak - Extra Coin balance to require beyond what outputs consume.
* @param capacityTweak - Extra CKB capacity to require beyond what outputs consume.
*
* @throws {ErrorCoinInsufficient} if the signer has insufficient Coin balance.
*
* @remarks Does not add `cellDeps`. Use `complete` / `completeChangeToLock` / `completeBy` instead.
*
* @example
* ```typescript
* const { tx: completedTx } = await coin.completeInputsByBalance(tx, signer);
* ```
*/
@Hanssen0 Hanssen0 force-pushed the feat/coin branch 2 times, most recently from e751816 to da5c981 Compare June 30, 2026 18:29
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