Skip to content

feat: update the transfer commands with new input process#10

Merged
rongquan1 merged 3 commits intomainfrom
feat/update-transfer-command
Jan 21, 2026
Merged

feat: update the transfer commands with new input process#10
rongquan1 merged 3 commits intomainfrom
feat/update-transfer-command

Conversation

@RishabhS7
Copy link
Copy Markdown
Contributor

@RishabhS7 RishabhS7 commented Jan 21, 2026

🎯 Overview

Refactored title escrow transfer commands to use a streamlined document-based input process, improving user experience and code maintainability.

✨ Key Changes

Unified Document Input Flow

  • Replaced individual prompts for token registry, token ID, and network with a single document-based input
  • Added extractDocumentInfo() utility to parse document metadata
  • Implemented promptAndReadDocument() for consistent document handling across commands

Network Configuration Refactor

  • Centralized network configuration using @trustvc/trustvc package's SUPPORTED_CHAINS
  • Eliminated hardcoded network definitions in favor of dynamic configuration
  • Added RPC URL mapping and provider factory pattern for cleaner network setup

Enhanced CLI Options

  • Added promptAddress() utility for consistent address input validation
  • Introduced performDryRunWithConfirmation() for better dry-run workflow
  • Improved promptRemark() to replace promptRemarkAndEncryptionKey()

Commands Updated

  • change-holder.ts - Transfer holder command
  • endorse-change-of-owner.ts - Endorse beneficiary change
  • endorse-transfer-of-owner.ts - Endorse full transfer
  • nominate-change-of-owner.ts - Nominate new beneficiary

✅ Testing

  • Updated all title escrow test suites (Astron, Astron Testnet, and standard networks)
  • Enhanced test coverage for nominate/endorse beneficiary flows
  • Updated transfer holder and transfer owners test cases

Summary by CodeRabbit

  • New Features

    • Document-driven input flow for title-escrow commands that auto-extracts token, network and document metadata.
    • Automatic dry-run confirmation with populate/estimate transaction support for networks that can estimate gas.
  • Bug Fixes

    • Consistent transaction receipt handling and unified "Transaction receipt not found" error messaging.
  • Refactor

    • Public command interfaces updated: removed manual dryRun field and now surface documentId (used for encryption).
    • Consolidated prompting into shared utilities for addresses, remarks, documents, and wallet selection.
  • Tests

    • Test suites migrated to the document-driven flow and new dry-run confirmation paths; mocks and expectations updated.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Commands moved to a document-driven input flow (documentId used as encryption key), removed dryRun from public command shapes, centralized dry-run/gas-estimation via performDryRunWithConfirmation, added dynamic network/provider utilities, and updated tests to mock the new utilities and transaction population flow.

Changes

Cohort / File(s) Summary
Title-Escrow Commands
src/commands/title-escrow/change-holder.ts, src/commands/title-escrow/endorse-change-of-owner.ts, src/commands/title-escrow/endorse-transfer-of-owner.ts, src/commands/title-escrow/nominate-change-of-owner.ts
Replace per-field prompts with promptAndReadDocument() + extractDocumentInfo(); use promptAddress/promptRemark; derive encryptionKey from documentId; remove dryRun from public signatures; gate execution with performDryRunWithConfirmation() and use populateTransaction for gas estimation; unify receipt/error handling.
Utilities: CLI & Networks
src/utils/cli-options.ts, src/utils/networks.ts
Remove GasOption.dryRun; re-export SUPPORTED_CHAINS/CHAIN_ID; add rpcUrls, createProvider, buildSupportedNetwork, and getSupportedNetworkNameFromId() for dynamic provider/network construction; minor CLI prompt messaging tweak for v5 remark encryption info.
Types
src/types.ts
Remove GasOption import/usage; replace with GasPriceScale in affected exported command type intersections.
Tests — Title-Escrow Command Suites
tests/commands/title-escrow/* (many files, e.g., endorseNominatedBeneficiary-*.test.ts, nominateBeneficiary-*.test.ts, transfer*.test.ts, transferOwners*.test.ts)
Convert tests from inquirer prompts to mocks of new utilities (promptAndReadDocument, extractDocumentInfo, promptAddress, promptWalletSelection, promptRemark, performDryRunWithConfirmation); update expectations to use documentId as encryptionKey; add populateTransaction mocks and adjust wallet signer/getAddress behavior.
Tests — Networks & Token Registry
tests/commands/token-registry/mint.test.ts, tests/utils/networks.test.ts
Expand mocked SUPPORTED_CHAINS and CHAIN_ID with richer network metadata; update provider expectations to JsonRpcProvider where applicable.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant DocUtil as Document Utilities
    participant DryRun as Dry-Run Handler
    participant TitleEscrow
    participant Signer
    participant Chain

    User->>CLI: Invoke command
    CLI->>DocUtil: promptAndReadDocument()
    DocUtil-->>CLI: document
    CLI->>DocUtil: extractDocumentInfo(document)
    DocUtil-->>CLI: tokenRegistry, tokenId, network, documentId, registryVersion
    CLI->>DocUtil: promptAddress()/promptRemark()
    DocUtil-->>CLI: address, remark
    CLI->>DryRun: performDryRunWithConfirmation(getTransactionCallback)
    DryRun->>TitleEscrow: invoke getTransactionCallback -> populateTransaction (with from)
    TitleEscrow-->>DryRun: populated transaction
    DryRun->>Chain: estimate gas (if supported)
    Chain-->>DryRun: gas estimate
    DryRun->>User: show estimate & confirm
    alt User confirms
        DryRun-->>CLI: proceed
        CLI->>Signer: sign & send transaction
        Signer-->>Chain: submit tx
        Chain-->>CLI: receipt
    else User declines
        DryRun-->>CLI: abort
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

I nibble bytes and hop with cheer, 🐇
Documents guide the prompts now here,
Dry-runs ask for gas, then choose to go,
Networks spin providers fast or slow,
Tests clap paws — the flow's set clear.


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 603e534 into main Jan 21, 2026
5 checks passed
@rongquan1 rongquan1 deleted the feat/update-transfer-command branch January 21, 2026 07:06
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