Skip to content

feat: return commands#6

Merged
rongquan1 merged 1 commit intomainfrom
feat/return-commands
Jan 15, 2026
Merged

feat: return commands#6
rongquan1 merged 1 commit intomainfrom
feat/return-commands

Conversation

@RishabhS7
Copy link
Copy Markdown
Contributor

@RishabhS7 RishabhS7 commented Jan 15, 2026

Return commands and test cases

Summary by CodeRabbit

  • New Features

    • Added three new CLI commands for managing transferable records: accept-returned, reject-returned, and return-to-issuer.
    • Each command supports network selection, secure wallet authentication, and optional remarks with encryption.
  • Tests

    • Comprehensive test coverage added for new commands across multiple networks.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

This change introduces three new CLI commands for title escrow workflows: accept-returned, reject-returned, and return-document. Each command provides end-to-end functionality including user input prompting, wallet/signer initialization, network-aware gas parameter handling, blockchain transaction execution via TradeTrustToken contracts, and receipt validation with Etherscan links. Comprehensive test suites cover multiple networks (astron, astrontestnet).

Changes

Cohort / File(s) Summary
Title Escrow Commands
src/commands/title-escrow/accept-returned.ts, src/commands/title-escrow/reject-returned.ts, src/commands/title-escrow/return-document.ts
Three new CLI command modules for TitleEscrow workflows. Each implements: command wiring (command/describe exports), interactive input prompting (network, token registry address, tokenId, wallet selection, optional remark/encryption key), handler orchestration with logging and transaction feedback, and core blockchain interaction (wallet resolution, contract connection, gas estimation with EIP-1559 support, transaction execution, receipt validation). All support dry-run mode and error handling.
Accept-Returned Tests
tests/commands/title-escrow/acceptReturned.test.ts, tests/commands/title-escrow/acceptReturned-astron.test.ts, tests/commands/title-escrow/acceptReturned-astrontestnet.test.ts
Comprehensive test suites for the accept-returned command covering promptForInputs variations (encrypted wallet, keyFile, private key, environment variable), acceptReturnedDocumentHandler success and error flows, handler end-to-end orchestration, and acceptReturned blockchain invocation. Network-specific tests validate behavior on astron and astrontestnet. Extensive mocking of prompts, wallet utilities, and trustvc module.
Reject-Returned Tests
tests/commands/title-escrow/rejectReturned.test.ts, tests/commands/title-escrow/rejectReturned-astron.test.ts, tests/commands/title-escrow/rejectReturned-astrontestnet.test.ts
Comprehensive test coverage for the reject-returned command including promptForInputs input modalities, rejectReturnedDocumentHandler transaction flows with remark and encryption handling, handler orchestration, and rejectReturned invocation verification. Network-specific tests validate astron and astrontestnet implementations.
Return-Document Tests
tests/commands/title-escrow/returnDocument.test.ts, tests/commands/title-escrow/returnDocument-astron.test.ts, tests/commands/title-escrow/returnDocument-astrontestnet.test.ts
Full test coverage for the return-document command encompassing promptForInputs with multiple wallet input methods, returnDocumentToIssuerHandler success and error paths, handler end-to-end flow, and returnDocument blockchain interaction. Network-specific tests for astron and astrontestnet verify correct transaction handling and invocation.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as Command Handler
    participant Prompt as Input Prompter
    participant Wallet as Wallet/Signer
    participant Provider as Network Provider
    participant Contract as TradeTrustToken Contract
    participant Blockchain as Blockchain

    User->>CLI: Invoke command (accept/reject/return)
    CLI->>Prompt: promptForInputs()
    Prompt->>User: Interactive prompts (network, tokenId, etc.)
    User-->>Prompt: Provide input
    Prompt-->>CLI: TitleEscrowReturnDocumentCommand
    
    CLI->>Wallet: Resolve signer for network
    Wallet->>Provider: Get network ID
    Provider-->>Wallet: Network ID
    Wallet-->>CLI: Signer initialized
    
    CLI->>Provider: Check gas estimation capability
    Provider-->>CLI: Gas capability info
    
    alt Encrypt remark if key provided
        CLI->>CLI: Encrypt remark with key
    end
    
    alt Dry-run mode
        CLI->>Contract: Call callStatic (gas estimation)
        Contract-->>Provider: Estimate gas
        Provider-->>CLI: Gas cost
        CLI-->>User: Display estimated cost
    else Normal execution
        CLI->>Contract: Execute transaction (accept/reject/returnToIssuer)
        Contract->>Blockchain: Submit transaction
        Blockchain-->>Contract: Transaction hash
        Contract-->>CLI: Wait for receipt
        Blockchain->>Blockchain: Confirm transaction
        Blockchain-->>CLI: Receipt with status
        CLI->>CLI: Validate receipt
        CLI-->>User: Display Etherscan link & success
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐰 Three commands hop and bounce with glee,
Accept, reject, return—a trinity!
Wallets dance with blockchain's song,
Gas fees handled sharp and strong,
Tests verify each hoppy deed,
Documents flow where trust will lead! 🌱



📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between f50ce1b and 7b45aa5.

📒 Files selected for processing (12)
  • src/commands/title-escrow/accept-returned.ts
  • src/commands/title-escrow/reject-returned.ts
  • src/commands/title-escrow/return-document.ts
  • tests/commands/title-escrow/acceptReturned-astron.test.ts
  • tests/commands/title-escrow/acceptReturned-astrontestnet.test.ts
  • tests/commands/title-escrow/acceptReturned.test.ts
  • tests/commands/title-escrow/rejectReturned-astron.test.ts
  • tests/commands/title-escrow/rejectReturned-astrontestnet.test.ts
  • tests/commands/title-escrow/rejectReturned.test.ts
  • tests/commands/title-escrow/returnDocument-astron.test.ts
  • tests/commands/title-escrow/returnDocument-astrontestnet.test.ts
  • tests/commands/title-escrow/returnDocument.test.ts

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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 d999e6c into main Jan 15, 2026
5 checks passed
@rongquan1 rongquan1 deleted the feat/return-commands branch January 15, 2026 09:35
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