Skip to content

feat: token registry command#19

Merged
rongquan1 merged 5 commits into
mainfrom
feat/token-registry-command
Feb 26, 2026
Merged

feat: token registry command#19
rongquan1 merged 5 commits into
mainfrom
feat/token-registry-command

Conversation

@RishabhS7

@RishabhS7 RishabhS7 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Token Registry Deploy Command

Summary

Implemented the token-registry deploy command with comprehensive test coverage to enable deployment of token registry contracts across supported blockchain networks.

Changes

New Files

  • src/commands/token-registry/deploy.ts - Token registry deployment command implementation
  • tests/commands/token-registry/deploy.test.ts - Comprehensive test suite (17 tests)

Modified Files

  • Updated document-store test files to fix vitest hoisting issues
  • Refactored test mocks to inline constants and avoid circular dependencies

Features

  • ✅ Deploy token registry contracts to multiple networks (Ethereum, Polygon, XDC, Stability, Astron)
  • ✅ Support for encrypted wallet, private key file, and direct private key authentication
  • ✅ Interactive prompts for network, wallet, and contract configuration
  • ✅ Dry-run functionality with gas estimation
  • ✅ Transaction confirmation and explorer link display
  • ✅ Comprehensive error handling

Test Coverage

  • Input prompts (encrypted wallet, key file, direct key)
  • Contract deployment success scenarios
  • Error handling (deployment failures, gas estimation errors)
  • Handler integration
  • Edge cases and validation

Technical Details

  • Follows existing CLI patterns and architecture
  • Uses @trustvc/trustvc SDK for contract deployment
  • Implements proper TypeScript typing
  • Includes transaction receipt validation
  • Supports all configured blockchain networks

Testing

npm test -- token-registry/deploy.test

Summary by CodeRabbit

  • New Features

    • Added a document-store (token registry) deploy command with interactive prompts, dry-run estimation, standalone and factory modes, and automatic address resolution.
  • Improvements

    • Improved contract connection compatibility across versions and unified connection helpers.
    • Made address prompts optionally skippable for more flexible input flows.
  • Tests

    • Added comprehensive tests covering deploy flows, prompts, dry-runs, and error paths.
  • Documentation

    • Updated README to document the new deploy command.
  • Chores

    • Updated @trustvc/trustvc dependency to ^2.9.1.

@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown
ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 66e55aa and 3c6aa79.

📒 Files selected for processing (1)
  • README.md

📝 Walkthrough

Walkthrough

Bumps @trustvc/trustvc; adds ethers-based contract connection helpers including TDocDeployer; introduces token-registry deploy CLI command with interactive prompts and standalone/factory deploy flows; makes promptAddress optional; adds tests and README updates.

Changes

Cohort / File(s) Summary
Dependency Updates
package.json
Bumps @trustvc/trustvc from ^2.8.0 to ^2.9.1.
Contract Connection Helpers
src/commands/helpers.ts
Adds connectToTDocDeployerContract and connectToTradeTrustTokenFactory; switches several contract connections to generic ethers.Contract wrappers for cross-version compatibility; adds ConnectToTDocDeployerContractArgs.
Title Escrow Commands
src/commands/title-escrow/accept-return-to-issuer.ts, src/commands/title-escrow/reject-return-to-issuer.ts
Replaces direct TradeTrustToken__factory.connect usage with connectToTokenRegistry helper and updates imports.
Token Registry Deployment
src/commands/token-registry/deploy.ts
Adds new CLI command (command, describe, handler) with promptForInputs and deployTokenRegistryContract implementing interactive prompts, address resolution, standalone vs factory deployment flows, dry-run estimation, transaction handling, and logging.
CLI Utilities
src/utils/cli-options.ts
Updates promptAddress signature to accept an optional flag and return `Promise<string
Tests
tests/commands/token-registry/deploy.test.ts
Adds extensive tests for prompt behavior, standalone and factory deployment flows, dry-run and confirmation paths, error cases, and handler end-to-end flows.
Documentation
README.md
Adds token-registry deploy entry and updates project tree/command docs to include the new deploy command.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/CLI
    participant Handler as Handler
    participant Prompt as promptForInputs
    participant Wallet as Wallet Utils
    participant Factory as TradeTrustTokenFactory
    participant Deployer as TDocDeployer
    participant Blockchain as Blockchain

    User->>Handler: start token-registry deploy
    Handler->>Prompt: gather network, names, mode, addresses, wallet
    Prompt-->>Handler: DeployTokenRegistryCommand
    Handler->>Wallet: load/unlock wallet
    Wallet-->>Handler: wallet instance

    alt Standalone
        Handler->>Factory: build deploy transaction (populate)
        Factory-->>Handler: populatedTx
    else Factory
        Handler->>Deployer: initialize with encoded params (populate)
        Deployer-->>Handler: populatedTx
    end

    Handler->>Blockchain: perform dry-run estimate
    Blockchain-->>Handler: gas estimate & price
    Handler->>User: show cost, request confirm
    User->>Handler: confirm/cancel

    alt Confirm
        Handler->>Blockchain: send transaction
        Blockchain-->>Handler: receipt
        Handler->>User: success with contract address & link
    else Cancel
        Handler-->>User: exit without deploying
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nudge the deployer with a hop and a grin,
Prompts light the path where contracts begin,
Helpers hum softly, wallets unlock,
Tests keep the journey steady as rock,
A carrot for CI—another deploy win!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@rongquan1 rongquan1 merged commit 0f5c523 into main Feb 26, 2026
5 checks passed
@rongquan1 rongquan1 deleted the feat/token-registry-command branch February 26, 2026 03:07
tradetrustimda pushed a commit that referenced this pull request Mar 10, 2026
# 1.0.0 (2026-03-10)

### Bug Fixes

* add tamper check for all blockchain functions ([#21](#21)) ([ea64760](ea64760))
* base64 file format removal ([514f18b](514f18b))
* ether signer compatibility ([a3c36de](a3c36de))
* handle network selection and add new fixtures ([#15](#15)) ([62b2031](62b2031))
* one line command and interactive terminal fix ([23fb955](23fb955))
* package lock ([2e40722](2e40722))
* remove test output files ([f63a4b3](f63a4b3))
* remove the base64 encoding for the file encryption ([#23](#23)) ([d4600e4](d4600e4))
* remove unnecessary details in the readme ([6a9b8a2](6a9b8a2))
* update cli process ([#8](#8)) ([472a9e6](472a9e6))
* updated the file handling error and folder creation for outputs ([a07c6a3](a07c6a3))
* wallet creation ([#14](#14)) ([6499276](6499276))

### Features

* add mint function command ([#1](#1)) ([22ea11f](22ea11f))
* add verify command ([#7](#7)) ([da85177](da85177))
* add w3c sign function ([#4](#4)) ([ea31015](ea31015))
* added encrypt/decrypt functions to the OA feature ([6dab3e7](6dab3e7))
* added functionality for transaction cancel ([33d73f2](33d73f2))
* added husky for lint checks ([70f3ea5](70f3ea5))
* added the gracefull error handling ([27ef0cf](27ef0cf))
* credential status command ([fb83698](fb83698))
* deploy document store command ([#16](#16)) ([bee4e7a](bee4e7a))
* document store ownership ([#20](#20)) ([a3906da](a3906da))
* fixed the prettier formats ([661c27e](661c27e))
* issue and revoke command ([#17](#17)) ([1df37ff](1df37ff))
* oa sign command ([6fc14cb](6fc14cb))
* reject commands ([#5](#5)) ([f50ce1b](f50ce1b))
* remove example files ([eecf1fb](eecf1fb))
* return commands ([#6](#6)) ([d999e6c](d999e6c))
* token registry command ([#19](#19)) ([0f5c523](0f5c523))
* transfer commands ([#3](#3)) ([8414130](8414130))
* update command process and tests ([#12](#12)) ([97986f5](97986f5))
* update the transfer commands with new input process ([#10](#10)) ([603e534](603e534))
* updated package version for trustvc ([995b43f](995b43f))
* updated packages ([7f9712c](7f9712c))
* updated the readme ([8fa493a](8fa493a))
* wallet creation encryption ([#13](#13)) ([e4d368c](e4d368c))
* wrap unwrap oa command ([#9](#9)) ([4ca75f0](4ca75f0))
@tradetrustimda

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants