Skip to content

feat: update command process and tests#12

Merged
rongquan1 merged 2 commits intomainfrom
feat/update-command-structure
Jan 22, 2026
Merged

feat: update command process and tests#12
rongquan1 merged 2 commits intomainfrom
feat/update-command-structure

Conversation

@RishabhS7
Copy link
Copy Markdown
Contributor

@RishabhS7 RishabhS7 commented Jan 21, 2026

Summary

Refactored title-escrow command structure with standardized naming conventions and updated test implementations.

Command Renaming

Standardized command names for better clarity and consistency:

Old Name New Name
accept-returned accept-return-to-issuer
reject-returned reject-return-to-issuer
return-document return-to-issuer
change-holder transfer-holder
nominate-change-of-owner nominate-transfer-owner
endorse-transfer-of-owner endorse-transfer-owner
endorse-change-of-owner transfer-owner-holder

Test Suite Updates

New/Rewritten Test Files

  • accept-return-to-issuer.test.ts (+598 lines)

    • Comprehensive test coverage for accepting returns to issuer
  • reject-return-to-issuer.test.ts (+599 lines)

    • Complete test suite for rejecting returns to issuer
  • reject-transfer-holder.test.ts (+631 lines)

    • Enhanced tests for holder transfer rejection scenarios
  • return-to-issuer.test.ts (+576 lines)

    • Full test coverage for return-to-issuer functionality

Updated Test Files

  • reject-transfer-owner-holder.test.ts (+52 lines)

    • Improved test structure and coverage
  • reject-transfer-owner.test.ts (+47 lines)

    • Enhanced test scenarios

Renamed Test Files

All test files renamed to match new command naming convention:

  • acceptReturned*.test.tsaccept-return-to-issuer*.test.ts
  • rejectReturned*.test.tsreject-return-to-issuer*.test.ts
  • returnDocument*.test.tsreturn-to-issuer*.test.ts
  • transferHolder*.test.tstransfer-holder*.test.ts
  • nominateBeneficiary*.test.tsnominate-transfer-owner*.test.ts
  • endorseNominatedBeneficiary*.test.tsendorse-transfer-owner*.test.ts
  • transferOwners*.test.tstransfer-owner-holder*.test.ts

Impact

Benefits

  • Improved Naming Consistency: All commands follow a clear, descriptive naming pattern
  • Enhanced Test Coverage: +2,404 net lines of test code added
  • Better Maintainability: Clearer command names make the codebase more intuitive
  • Standardization: Consistent naming across commands, tests, and network-specific variants

Breaking Changes

⚠️ Command names have changed - users will need to update their scripts/workflows to use the new command names.

Files Modified

Source Commands (10 files)

  • src/commands/title-escrow/accept-return-to-issuer.ts
  • src/commands/title-escrow/reject-return-to-issuer.ts
  • src/commands/title-escrow/return-to-issuer.ts
  • src/commands/title-escrow/transfer-holder.ts
  • src/commands/title-escrow/nominate-transfer-owner.ts
  • src/commands/title-escrow/endorse-transfer-owner.ts
  • src/commands/title-escrow/transfer-owner-holder.ts
  • src/commands/title-escrow/reject-transfer-holder.ts
  • src/commands/title-escrow/reject-transfer-owner-holder.ts
  • src/commands/title-escrow/reject-transfer-owner.ts

Test Files (28 files)

All test files in tests/commands/title-escrow/ updated to match new naming convention.

Summary by CodeRabbit

  • New Features

    • Document-driven input workflows for title-escrow commands and centralized dry-run confirmation for safer transaction previews.
    • Remark handling now adapts to registry version and uses document-derived encryption keys.
  • Chores

    • Renamed multiple title-escrow commands for clarity (e.g., accept-returned → accept-return-to-issuer, change-holder → transfer-holder, nominate-change-of-owner → nominate-transfer-owner).
  • Tests

    • Updated and added comprehensive unit tests; aligned test imports and fixtures with the new command names.
  • Documentation

    • README updated to reflect command renames, execution constraints, and wallet/key options.

✏️ 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

This PR renames several title-escrow CLI commands, replaces manual prompts with document-driven input extraction (promptAndReadDocument + extractDocumentInfo), centralizes dry‑run handling via performDryRunWithConfirmation (using populateTransaction/getTransactionCallback), adapts remark/encryption flows to registryVersion/documentId, and removes dryRun parameters from handlers.

Changes

Cohort / File(s) Summary
Command Renames
src/commands/title-escrow/nominate-transfer-owner.ts, src/commands/title-escrow/transfer-holder.ts, src/commands/title-escrow/transfer-owner-holder.ts, src/commands/title-escrow/endorse-transfer-owner.ts, src/commands/title-escrow/nominate-transfer-owner.ts
Updated CLI command/describe constants to new names (e.g., accept-returnedaccept-return-to-issuer, change-holdertransfer-holder, nominate-change-ownernominate-transfer-owner, etc.). Mostly metadata/text updates; no logic changes.
Document-driven input refactor
src/commands/title-escrow/*.ts (accept-return-to-issuer, reject-return-to-issuer, return-to-issuer, reject-transfer-*.ts, reject-transfer-owner-holder.ts, reject-transfer-owner.ts)
Replaced manual network/tokenRegistry/tokenId prompts with promptAndReadDocument() + extractDocumentInfo(document) to derive tokenRegistry, tokenId, network, documentId, registryVersion. Switched remark/encryption flows to promptRemark(registryVersion) and encryptionKey = documentId. Removed dryRun fields from inputs and handler signatures.
Centralized dry-run & tx population
src/commands/title-escrow/accept-return-to-issuer.ts, .../reject-*.ts, .../return-to-issuer.ts
Removed ad-hoc dry-run logic and dryRunMode; introduced performDryRunWithConfirmation() used with a getTransactionCallback that builds/populates transactions (via contract.populateTransaction), ensures a from address for gas estimation, and conditionally proceeds to send the transaction.
Handler signature updates
src/commands/title-escrow/*reject*.ts, src/commands/title-escrow/*accept*.ts, src/commands/title-escrow/return-to-issuer.ts
Removed dryRun parameter from multiple exported handler functions and adjusted internal flows to rely on performDryRunWithConfirmation.
Tests: new, moved, removed
tests/commands/title-escrow/* (many)
Updated import paths to match renamed modules; removed legacy test files for old modules; added multiple comprehensive test suites for the renamed/document-driven flows (new tests ~500+ lines each) and adjusted tests to remove dryRun fields and to mock performDryRunWithConfirmation, wallet/provider, and contract populate/receipt flows.
Docs
README.md
Updated documentation to reflect new command names, clarified "Who Can Execute" sections, added wallet/private-key options, and updated examples/command index to the new command names and behaviors.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI
participant DocumentStore as Document Reader
participant Extractor as extractDocumentInfo
participant DryRun as performDryRunWithConfirmation
participant Contract as TitleEscrowContract
participant Network
CLI->>DocumentStore: promptAndReadDocument()
DocumentStore->>Extractor: document
Extractor-->>CLI: tokenRegistry, tokenId, network, documentId, registryVersion
CLI->>DryRun: performDryRunWithConfirmation(getTransactionCallback)
DryRun->>Contract: connect + populateTransaction(...) (include from addr)
Contract->>Network: estimate gas / populate tx
Network-->>DryRun: gas estimate / populated tx
DryRun-->>CLI: shouldProceed (true/false)
alt shouldProceed == true
CLI->>Contract: sendTransaction(...)
Contract->>Network: broadcast
Network-->>CLI: receipt
else
CLI-->>CLI: exit/abort
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I read the doc, I found the key,

document-led steps set actions free.
Dry runs sing, transactions hum,
Commands reborn—hoppity, come!
Encryption from the doc, now neat and clever—hop forever!


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 97986f5 into main Jan 22, 2026
5 checks passed
@rongquan1 rongquan1 deleted the feat/update-command-structure branch January 22, 2026 05:10
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