Skip to content

feat: replace ckb-transaction-dumper with ccc-based implementation#420

Merged
RetricSu merged 5 commits intodevelopfrom
fix-issue-194
Apr 10, 2026
Merged

feat: replace ckb-transaction-dumper with ccc-based implementation#420
RetricSu merged 5 commits intodevelopfrom
fix-issue-194

Conversation

@RetricSu
Copy link
Copy Markdown
Collaborator

Summary

Replace ckb-transaction-dumper npm package with a pure ccc-based implementation.

Closes #194

Changes

  • Rewrite src/tools/ckb-tx-dumper.ts to use ccc Client and molecule codecs
  • Implement dep_group unpacking using ccc.mol
  • Remove ckb-transaction-dumper from dependencies

Verification

  • TypeScript type check passes
  • ESLint passes
  • Build succeeds

Breaking Changes

None. The DumpOption interface and dumpTransaction() function signature remain unchanged.

- Rewrite src/tools/ckb-tx-dumper.ts to use ccc Client and molecule codecs
- Implement dep_group unpacking using ccc.mol
- Remove ckb-transaction-dumper from dependencies
- Eliminates external npm dependency for transaction dumping
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

✅ Changeset file detected.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 replaces the previous ckb-transaction-dumper binary dependency with an in-repo implementation based on @ckb-ccc/core, intended to produce the same mock-tx JSON output for downstream debugging tooling.

Changes:

  • Rewrote src/tools/ckb-tx-dumper.ts to resolve inputs/cell-deps via a ccc RPC client and decode dep_group via molecule codecs.
  • Removed ckb-transaction-dumper from dependencies and updated the lockfile accordingly.
  • Added a changeset and added .sisyphus/* plan/session artifacts.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/tools/ckb-tx-dumper.ts Replaces subprocess-based dumping with a ccc-based resolver + JSON writer.
package.json Removes ckb-transaction-dumper dependency.
pnpm-lock.yaml Updates lockfile to reflect dependency removal (and related metadata changes).
.changeset/wise-candies-stop.md Declares a minor release note for the dumper change.
.sisyphus/plans/ckb-tx-dumper.md Adds a plan document describing the migration approach.
.sisyphus/boulder.json Adds a session/state file containing local-path metadata.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread .sisyphus/boulder.json Outdated
Comment thread src/tools/ckb-tx-dumper.ts
Comment thread src/tools/ckb-tx-dumper.ts
Comment thread src/tools/ckb-tx-dumper.ts
Comment thread src/tools/ckb-tx-dumper.ts
Comment thread src/tools/ckb-tx-dumper.ts Outdated
Comment thread src/tools/ckb-tx-dumper.ts Outdated
- Remove .sisyphus/boulder.json and add to .gitignore
- Fix type field serialization: emit null instead of undefined
- Fix dep_type format: convert camelCase to snake_case (depGroup -> dep_group)
- Fix depGroup error handling: throw error when refCell not found
- Fix async race condition: make buildTxFileOptionBy and callers async
- Use cccA.JsonRpcTransformers.transactionTo() to handle snake_case input format
- Convert all numeric values to hex format (since, index, version, capacity)
- Add missing dep_group cell to mock_info.cell_deps before expansion
- Add fs.mkdirSync to ensure output directory exists

Fixes issues where debug command failed with 'undefined is not iterable',
'unprovided cell dep', or 'since is not a legal u64' errors.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 6 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

src/cmd/debug.ts:17

  • debugTransaction is now async, but the debugRaw(...) calls inside the loop are not awaited. This causes the function to resolve before the debugger runs/finishes, which can lead to the CLI exiting early and/or unhandled promise rejections. Await each debugRaw call (or collect and await Promise.all(...) if parallel execution is intended).
  for (const opt of opts) {
    logger.section(opt.name, [], 'info');
    debugRaw(`${txFile} ${opt.cmdOption}`);
  }

src/cmd/debug.ts:65

  • debugSingleScript is now async, but the debugRaw(...) call isn't awaited. This makes the command return before the debugger completes and can cause the process to exit early. Await the debugRaw promise here.
  const txFile = await buildTxFileOptionBy(txHash, network);
  let opt = `--cell-index ${cellIndex} --cell-type ${cellType} --script-group-type ${scriptType}`;
  if (bin) {
    opt = opt + ` --bin ${bin}`;
  }
  debugRaw(`${txFile} ${opt}`);
}

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

Comment thread src/tools/ckb-tx-dumper.ts Outdated
Comment thread src/tools/ckb-tx-dumper.ts Outdated
- Select ClientPublicTestnet/Mainnet based on RPC URL pattern
- Use proper error type checking with instanceof Error
@RetricSu RetricSu merged commit 3da9777 into develop Apr 10, 2026
7 checks passed
@RetricSu RetricSu deleted the fix-issue-194 branch April 10, 2026 07:41
RetricSu added a commit that referenced this pull request Apr 10, 2026
) (#431)

* feat: replace ckb-transaction-dumper with ccc-based implementation

- Rewrite src/tools/ckb-tx-dumper.ts to use ccc Client and molecule codecs
- Implement dep_group unpacking using ccc.mol
- Remove ckb-transaction-dumper from dependencies
- Eliminates external npm dependency for transaction dumping

* chore: add changeset for ckb-transaction-dumper replacement

* fix: address PR review comments for ckb-tx-dumper

- Remove .sisyphus/boulder.json and add to .gitignore
- Fix type field serialization: emit null instead of undefined
- Fix dep_type format: convert camelCase to snake_case (depGroup -> dep_group)
- Fix depGroup error handling: throw error when refCell not found
- Fix async race condition: make buildTxFileOptionBy and callers async

* fix: fix CCC-based transaction dumper for debug command

- Use cccA.JsonRpcTransformers.transactionTo() to handle snake_case input format
- Convert all numeric values to hex format (since, index, version, capacity)
- Add missing dep_group cell to mock_info.cell_deps before expansion
- Add fs.mkdirSync to ensure output directory exists

Fixes issues where debug command failed with 'undefined is not iterable',
'unprovided cell dep', or 'since is not a legal u64' errors.

* fix: address Copilot PR review comments for ccc-based tx dumper

- Select ClientPublicTestnet/Mainnet based on RPC URL pattern
- Use proper error type checking with instanceof Error
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.

replace ckb-tx-dumper with ckb-cli mock-tx

2 participants