Skip to content

feat: issue and revoke command#17

Merged
rongquan1 merged 1 commit into
mainfrom
feat/issue-revoke
Feb 19, 2026
Merged

feat: issue and revoke command#17
rongquan1 merged 1 commit into
mainfrom
feat/issue-revoke

Conversation

@RishabhS7

@RishabhS7 RishabhS7 commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Commit Description: feat/issue-revoke

Overview

This commit adds the issue and revoke commands for document store operations in the TrustVC CLI. These commands allow users to issue and revoke document hashes in deployed document store contracts on various blockchain networks.

Files Added

Source Files

  • src/commands/document-store/issue.ts (145 lines): Implements the document-store issue command
  • src/commands/document-store/revoke.ts (146 lines): Implements the document-store revoke command

Test Files

  • tests/commands/document-store/issue.test.ts (677 lines): Comprehensive test suite for the issue command
  • tests/commands/document-store/revoke.test.ts (677 lines): Comprehensive test suite for the revoke command

Features Implemented

Document Store Issue Command

  • Purpose: Issues a document hash to a deployed document store contract
  • Usage: trustvc document-store issue
  • Functionality:
    • Extracts document information from TT/JSON files
    • Supports multiple wallet authentication methods (encrypted wallet, private key file, direct key, environment variable)
    • Performs dry run confirmation for supported networks (Ethereum, Polygon)
    • Handles gas estimation and EIP-1559 gas parameters
    • Displays transaction details and explorer links
    • Supports all configured networks (Ethereum, Polygon, XDC, Stability, Astron)

Document Store Revoke Command

  • Purpose: Revokes a document hash from a deployed document store contract
  • Usage: trustvc document-store revoke
  • Functionality:
    • Same core features as issue command
    • Uses documentStoreRevoke function from @trustvc/trustvc
    • Handles overloaded contract methods (revoke(bytes32))

Technical Details

Command Structure

Both commands follow the established CLI pattern:

  • Interactive prompts for user input
  • Wallet selection with multiple authentication options
  • Network selection with dry run confirmation
  • Transaction execution with gas management
  • Comprehensive error handling and logging

Dependencies

  • Uses @trustvc/trustvc library functions: documentStoreIssue, documentStoreRevoke
  • Integrates with existing CLI utilities for wallet management, network handling, and transaction processing
  • Leverages ethers.js for blockchain interactions

Testing

  • Comprehensive test coverage for all user flows
  • Mocks for external dependencies (@trustvc/trustvc, signale, ethers)
  • Tests for different wallet authentication methods
  • Error handling and edge case coverage
  • Network compatibility testing

Usage Examples

# Issue a document hash
trustvc document-store issue

# Revoke a document hash
trustvc document-store revoke

Both commands will prompt for:

  • Document file path
  • Wallet authentication
  • Confirmation (with dry run for supported networks)

Summary by CodeRabbit

Release Notes

  • New Features

    • New CLI command to issue a hash to a blockchain-based document store, supporting multiple wallet input methods and dynamic gas configuration
    • New CLI command to revoke a hash from a blockchain document store with multi-wallet support and gas fee optimization
    • Both commands include interactive dry-run verification and provide transaction details upon completion
  • Tests

    • Added comprehensive test coverage for new issue and revoke commands

@coderabbitai

coderabbitai Bot commented Feb 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Two new CLI command modules for blockchain document store operations are introduced: one for issuing document hashes and one for revoking them. Both include wallet-aware flows with dry-run support and conditional gas estimation. Comprehensive test suites accompany both commands with extensive mocking of dependencies.

Changes

Cohort / File(s) Summary
Document Store Commands
src/commands/document-store/issue.ts, src/commands/document-store/revoke.ts
New CLI commands for issuing and revoking hashes on blockchain document stores. Both feature user prompting, wallet selection, dry-run confirmation, EIP-1559 and legacy gas handling, transaction execution, and detailed result logging.
Command Tests
tests/commands/document-store/issue.test.ts, tests/commands/document-store/revoke.test.ts
Comprehensive test suites covering promptForInputs, token operations (issueToken/revokeToken), and handler flows. Extensive mocking of wallet utilities, blockchain interactions, document retrieval, and user prompts across all supported networks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as Handler
    participant Input as promptForInputs
    participant Wallet as Wallet Utils
    participant DryRun as DryRun Flow
    participant DocStore as Document Store
    participant Blockchain as Blockchain Network
    participant Display as Result Display

    User->>CLI: Execute issue/revoke command
    CLI->>Input: Request user inputs
    Input->>User: Prompt for document & wallet info
    User-->>Input: Provide inputs
    Input->>Wallet: Request wallet/signer
    Wallet-->>Input: Return signer
    Input-->>CLI: Return command payload
    
    CLI->>DryRun: Perform dry-run with confirmation
    DryRun->>DocStore: Connect to document store
    DocStore->>DocStore: Populate transaction
    DryRun->>User: Request confirmation
    User-->>DryRun: Confirm
    DryRun-->>CLI: Transaction ready
    
    CLI->>DocStore: Check if gas estimation supported
    alt EIP-1559 Supported
        CLI->>Blockchain: Fetch gas fees (maxFeePerGas, maxPriorityFeePerGas)
        Blockchain-->>CLI: Return gas parameters
        CLI->>DocStore: Execute with EIP-1559 parameters
    else Legacy Mode
        CLI->>DocStore: Execute standard transaction
    end
    
    DocStore->>Blockchain: Send transaction
    Blockchain-->>DocStore: Transaction hash
    DocStore->>Blockchain: Wait for confirmation
    Blockchain-->>DocStore: Confirmed
    
    CLI->>Display: Show transaction details & link
    Display->>User: Display results
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hoppy blockchain tales I weave,
With hashes issued, none to grieve,
And revoke commands, swift and bright,
Gas-aware wallets, tested right! ✨📜


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 1df37ff into main Feb 19, 2026
5 checks passed
@rongquan1 rongquan1 deleted the feat/issue-revoke branch February 19, 2026 06:55
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