Skip to content

fix: update cli process#8

Merged
rongquan1 merged 3 commits intomainfrom
fix/update-cli-process
Jan 21, 2026
Merged

fix: update cli process#8
rongquan1 merged 3 commits intomainfrom
fix/update-cli-process

Conversation

@RishabhS7
Copy link
Copy Markdown
Contributor

@RishabhS7 RishabhS7 commented Jan 19, 2026

Summary
Automated document information extraction and fixed gas estimation for V5 token registries by properly encrypting remarks.

Key Changes

  1. Automated Input Flow

Extract network, token registry, token ID, and document ID automatically from TT/JSON files
Users now only provide: document path, beneficiary, holder, wallet, and optional remark
Display extracted information for verification
2. Enhanced Gas Estimation

Added
validateAndEncryptRemark()
helper to encrypt remarks with document ID
Implemented
performDryRunWithConfirmation()
for automatic gas estimation on Ethereum/Polygon
Fixed "execution reverted" errors by properly encrypting remarks before populateTransaction
3. Additional Updates

Added Stability network support
Updated types to include encryptionKey parameter
Comprehensive test coverage for new flow
Benefits
✅ Better UX - minimal manual input required
✅ Accurate gas estimation for V5 token registries
✅ Comprehensive fee breakdown before mainnet transactions
✅ Reduced user errors from manual data entry

Summary by CodeRabbit

  • New Features

    • Streamlined token minting workflow using document metadata with automatic gas estimation and pre-flight validation
  • Improvements

    • Enhanced dry-run confirmation flow for improved transaction safety
    • Better error handling and address validation
  • Updates

    • Updated Polygon Amoy network configuration

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The token registry mint command is refactored from interactive prompt-based input to document-driven extraction. New utilities support document reading, token registry version detection, and pre-flight dry-run validation, with updated network configuration for Amoy testnet.

Changes

Cohort / File(s) Summary
Document Processing & Registry Utilities
src/commands/helpers.ts, src/utils/cli-options.ts, src/utils/file-io.ts
New connectToTokenRegistry() and getTokenRegistryVersion() APIs added to helpers for registry connection and version detection. CLI utilities added for document prompting, info extraction, address validation, and dry-run orchestration. File I/O function renamed from readOpenAttestationFile to readDocumentFile.
Mint Command Refactoring
src/commands/token-registry/mint.ts, tests/commands/token-registry/mint.test.ts
Mint command input flow converted from interactive prompts to document-derived fields (tokenRegistry, tokenId, network, documentId, registryVersion). Pre-flight dry-run path added with gas estimation and confirmation. Tests completely rewritten with document-driven mocks replacing inquirer-based prompts.
Type System & Imports
src/types.ts
Added import of NetworkAndWalletSignerOption. Fixed formatting on SignInput and DidInput type declarations (semicolon terminators).
Network Configuration
src/utils/networks.ts
Amoy testnet gasStation URL updated from /amoy to /v2 endpoint. Minor formatting adjustment to provider signature.
Git Configuration
.gitignore
Added test.json and testSepolia.json to ignored files.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/CLI
    participant Doc as Document Handler
    participant Registry as Token Registry
    participant Provider as Provider/Network
    participant Signer as Wallet/Signer

    User->>Doc: promptAndReadDocument()
    activate Doc
    Doc->>Doc: Read & parse document
    deactivate Doc
    
    Doc->>Provider: extractDocumentInfo()
    activate Provider
    Provider->>Registry: checkSupportsInterface()
    Registry-->>Provider: interface supported
    Provider->>Provider: Determine version (v4/v5)
    deactivate Provider
    
    User->>Registry: promptAddress(beneficiary)
    activate Registry
    Registry-->>User: address input
    deactivate Registry
    
    alt registryVersion is 'v5'
        User->>User: promptRemark()
    end
    
    User->>Registry: shouldRunDryRun(network)
    alt Should run dry run
        Registry->>Signer: connectToTokenRegistry()
        Signer->>Provider: getGasFees()
        Provider-->>Signer: gas price
        Signer->>Registry: buildTransaction()
        Registry-->>User: performDryRunWithConfirmation()
        User->>User: Confirm or reject
    end
    
    alt User confirmed or no dry run
        Signer->>Registry: mint(transaction)
        Registry-->>Signer: tx hash
        Signer-->>User: Success
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A document now guides the token's way,
No more prompts to slow the day!
Registry versions we detect with care,
Gas estimates float through the air—
Hop, dry-run, mint with newfound grace!


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.

@RishabhS7 RishabhS7 force-pushed the fix/update-cli-process branch from 5ca28bf to 976ae5b Compare January 19, 2026 10:42
@rongquan1 rongquan1 merged commit 472a9e6 into main Jan 21, 2026
5 checks passed
@rongquan1 rongquan1 deleted the fix/update-cli-process branch January 21, 2026 02:48
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