Skip to content

feat: mint function#78

Merged
nghaninn merged 28 commits into
v1from
feat/mint-function
Jul 4, 2025
Merged

feat: mint function#78
nghaninn merged 28 commits into
v1from
feat/mint-function

Conversation

@RishabhS7

@RishabhS7 RishabhS7 commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Summary

added token registry Mint function

Issues

Jira Ticket

Summary by CodeRabbit

  • New Features

    • Introduced functions to mint tokens, reject transfers, and manage token returns (return, accept, reject) supporting multiple token registry and ethers.js versions.
    • Expanded the public API to include these new token registry operations.
    • Added utility functions for consistent transaction option handling and signer information retrieval across ethers versions.
  • Refactor

    • Centralized and modularized test fixtures and mocks for improved maintainability.
    • Unified gas fee and chain ID handling into reusable utilities.
    • Modularized types and utilities, improving type safety and code clarity.
  • Tests

    • Added comprehensive test suites covering minting, transfer rejection, and token return workflows with extensive scenario and error handling coverage.
  • Documentation

    • Enhanced code documentation with detailed JSDoc comments for all major token registry functions.
  • Chores

    • Updated formatting and whitespace in changelog for consistency.

@coderabbitai

coderabbitai Bot commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce new token registry functions for minting, rejecting transfers, and returning tokens, with full support for both ethers.js v5 and v6 and multiple token registry contract versions (V4 and V5). The update modularizes types and utilities, expands the public API, and adds comprehensive test suites using centralized fixtures and mocks.

Changes

File(s) Change Summary
CHANGELOG.md Whitespace and formatting adjustments only; no content or semantic changes.
src/tests/token-registry-functions/fixtures.ts New module providing centralized mocks and constants for contract tests, supporting ethers v5/v6 and V4/V5 contracts.
src/tests/token-registry-functions/mint.test.ts
src/tests/token-registry-functions/rejectTransfers.test.ts
src/tests/token-registry-functions/returnToken.test.ts
New test suites for minting, rejecting transfers, and returning tokens, covering multiple contract and ethers versions, with error and edge case coverage.
src/tests/token-registry-functions/transfers.test.ts Refactored to use centralized fixtures for mocks and test setup; removed inline mock definitions.
src/core/endorsement-chain/useEndorsementChain.ts Made checkSupportsInterface function exported for external use.
src/token-registry-functions/index.ts Added exports for rejectTransfers, returnToken, and mint modules to expand the public API.
src/token-registry-functions/mint.ts New mint function for minting tokens, supporting V4/V5 contracts and ethers v5/v6.
src/token-registry-functions/rejectTransfers.ts New module implementing rejectTransferHolder, rejectTransferBeneficiary, and rejectTransferOwners functions for V5 contracts.
src/token-registry-functions/returnToken.ts New module implementing returnToIssuer, rejectReturned, and acceptReturned for V4/V5 contracts.
src/token-registry-functions/transfer.ts Refactored to use imported types/utilities, unified gas handling, added detailed JSDoc, improved modularity.
src/token-registry-functions/types.ts New module defining types/interfaces for token registry operations and transaction options.
src/token-registry-functions/utils.ts New utility module for transaction options, chain ID, and signer address retrieval, supporting ethers v5/v6.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Signer
    participant ContractFactory
    participant Contract

    User->>App: Initiate token operation (e.g., mint, transfer, reject)
    App->>Signer: Validate provider and addresses
    App->>ContractFactory: Connect to contract (V4 or V5)
    App->>Contract: callStatic.<operation> (dry run)
    Contract-->>App: Return result or throw error
    App->>Contract: Execute <operation> with tx options
    Contract-->>App: Return transaction response
    App-->>User: Return transaction hash or error
Loading

Suggested labels

released on @v1

Suggested reviewers

  • nghaninn

Poem

A bunny hops through code so neat,
Minting tokens, quick and fleet!
Transfers, rejections, returns—oh my!
With ethers v5 and v6, we fly.
Modular types and tests abound,
In this garden, bugs aren't found!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nghaninn

nghaninn commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 3, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 24

🧹 Nitpick comments (5)
CHANGELOG.md (2)

5-5: Add explicit mention of the newly-added mint capability (and PR #78).

This PR introduces a user-visible feature – the ability to mint tokens – yet the changelog line still generically states “token registry functions (#74)” from a previous PR.
Updating the bullet makes release notes clearer and prevents overlooking the new Jira ticket TT-781 / PR #78 during future audits.

-- token registry functions ([#74](https://github.com/TrustVC/trustvc/issues/74)) ([5690fcd](https://github.com/TrustVC/trustvc/commit/5690fcda798192609b0060fab0a3f3f77dca8012))
+- token registry functions – add **mint / rejectTransfer / returnToken** support
+  ([#78](https://github.com/TrustVC/trustvc/pull/78)) ([commit-hash-here])  
+  ([#74](https://github.com/TrustVC/trustvc/issues/74)) ([5690fcd](https://github.com/TrustVC/trustvc/commit/5690fcda798192609b0060fab0a3f3f77dca8012))

Please confirm the correct commit hash and wording, or drop in a new “Unreleased” section if this feature will not ship in 1.6.0-alpha.1.


9-9: Grammar tweak: “back-merge” or “back-merged”.

The noun/verb agreement flagged by LanguageTool is valid – “back merge” reads awkwardly.
Either treat it as a noun phrase (“Back-merge”) or use the past tense verb (“back-merged”).

-- back merge ([#75](https://github.com/TrustVC/trustvc/issues/75)) ...
+- back-merge ([#75](https://github.com/TrustVC/trustvc/issues/75)) ...
src/__tests__/token-registry-functions/mint.test.ts (1)

141-144: Remove unnecessary mock reset

The mock is being manually reset after the test, but beforeEach already calls vi.clearAllMocks() which handles this cleanup.

Remove these lines as they are redundant:

-        if (isV5TT) {
-          mockV5TradeTrustTokenContract.callStatic.mint = vi.fn();
-        } else {
-          mockV4TradeTrustTokenContract.callStatic.mint = vi.fn();
-        }
src/token-registry-functions/returnToken.ts (2)

68-78: Remove redundant await inside Promise.all.

Using await inside Promise.all is redundant and doesn't provide any benefit.

 [isV4TT, isV5TT] = await Promise.all([
-  await isTitleEscrowVersion({
+  isTitleEscrowVersion({
     titleEscrowAddress,
     versionInterface: TitleEscrowInterface.V4,
     provider: signer.provider,
   }),
-  await isTitleEscrowVersion({
+  isTitleEscrowVersion({
     titleEscrowAddress,
     versionInterface: TitleEscrowInterface.V5,
     provider: signer.provider,
   }),
 ]);

119-130: Update JSDoc to reflect dual version support.

The JSDoc comment states "only supported on Token Registry V5" but the implementation supports both V4 and V5 with the restore interface.

-* This is only supported on Token Registry V5 contracts with the `restore` functionality.
+* This is supported on Token Registry V4/V5 contracts that implement the `restore` interface.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73847b7 and bb490e4.

📒 Files selected for processing (14)
  • CHANGELOG.md (1 hunks)
  • src/__tests__/token-registry-functions/fixtures.ts (1 hunks)
  • src/__tests__/token-registry-functions/mint.test.ts (1 hunks)
  • src/__tests__/token-registry-functions/rejectTransfers.test.ts (1 hunks)
  • src/__tests__/token-registry-functions/returnToken.test.ts (1 hunks)
  • src/__tests__/token-registry-functions/transfers.test.ts (2 hunks)
  • src/core/endorsement-chain/useEndorsementChain.ts (1 hunks)
  • src/token-registry-functions/index.ts (1 hunks)
  • src/token-registry-functions/mint.ts (1 hunks)
  • src/token-registry-functions/rejectTransfers.ts (1 hunks)
  • src/token-registry-functions/returnToken.ts (1 hunks)
  • src/token-registry-functions/transfer.ts (8 hunks)
  • src/token-registry-functions/types.ts (1 hunks)
  • src/token-registry-functions/utils.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
src/__tests__/token-registry-functions/rejectTransfers.test.ts (3)
src/token-registry-functions/types.ts (1)
  • ProviderInfo (79-83)
src/__tests__/token-registry-functions/fixtures.ts (4)
  • providerV5 (146-146)
  • providerV6 (147-147)
  • PRIVATE_KEY (144-144)
  • mockV5TitleEscrowContract (83-105)
src/token-registry-functions/rejectTransfers.ts (3)
  • rejectTransferHolder (217-217)
  • rejectTransferBeneficiary (217-217)
  • rejectTransferOwners (217-217)
src/token-registry-functions/mint.ts (5)
src/token-registry-functions/types.ts (3)
  • MintTokenOptions (58-60)
  • MintTokenParams (24-29)
  • TransactionOptions (31-37)
src/core/endorsement-chain/useEndorsementChain.ts (1)
  • checkSupportsInterface (148-164)
src/index.ts (2)
  • v4SupportInterfaceIds (31-31)
  • v5SupportInterfaceIds (35-35)
src/core/encrypt.ts (1)
  • encrypt (17-42)
src/token-registry-functions/utils.ts (1)
  • getTxOptions (44-44)
src/token-registry-functions/rejectTransfers.ts (4)
src/token-registry-functions/types.ts (3)
  • ContractOptions (39-49)
  • RejectTransferParams (8-10)
  • TransactionOptions (31-37)
src/core/endorsement-chain/useEndorsementChain.ts (3)
  • getTitleEscrowAddress (104-133)
  • isTitleEscrowVersion (179-196)
  • TitleEscrowInterface (17-20)
src/core/encrypt.ts (1)
  • encrypt (17-42)
src/token-registry-functions/utils.ts (1)
  • getTxOptions (44-44)
src/token-registry-functions/types.ts (1)
src/__tests__/token-registry-functions/fixtures.ts (2)
  • providerV5 (146-146)
  • providerV6 (147-147)
src/token-registry-functions/returnToken.ts (5)
src/token-registry-functions/types.ts (7)
  • ContractOptions (39-49)
  • ReturnToIssuerParams (11-13)
  • TransactionOptions (31-37)
  • AcceptReturnedOptions (51-53)
  • RejectReturnedParams (19-22)
  • RejectReturnedOptions (54-56)
  • AcceptReturnedParams (15-18)
src/core/endorsement-chain/useEndorsementChain.ts (4)
  • getTitleEscrowAddress (104-133)
  • isTitleEscrowVersion (179-196)
  • TitleEscrowInterface (17-20)
  • checkSupportsInterface (148-164)
src/core/encrypt.ts (1)
  • encrypt (17-42)
src/token-registry-functions/utils.ts (1)
  • getTxOptions (44-44)
src/index.ts (2)
  • v4SupportInterfaceIds (31-31)
  • v5SupportInterfaceIds (35-35)
src/token-registry-functions/transfer.ts (3)
src/token-registry-functions/types.ts (6)
  • ContractOptions (39-49)
  • TransferHolderParams (62-65)
  • TransactionOptions (31-37)
  • TransferBeneficiaryParams (66-69)
  • TransferOwnersParams (74-78)
  • NominateParams (70-73)
src/token-registry-functions/utils.ts (1)
  • getTxOptions (44-44)
src/index.ts (1)
  • v4Contracts (34-34)
🪛 LanguageTool
CHANGELOG.md

[grammar] ~9-~9: There seems to be a noun/verb agreement error. Did you mean “merges” or “merged”?
Context: ...012)) ### Miscellaneous Chores - back merge ([#75](https://github.com/TrustVC/trust...

(SINGULAR_NOUN_VERB_AGREEMENT)


[uncategorized] ~90-~90: You might be missing the article “the” here.
Context: ...) (2025-04-22) ### Bug Fixes - update checkDidWebResolve function to use queryDidDocument ([#57]...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 Gitleaks (8.26.0)
src/__tests__/token-registry-functions/fixtures.ts

144-144: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (5)
src/core/endorsement-chain/useEndorsementChain.ts (1)

148-148: LGTM!

The export of checkSupportsInterface enables its use in the new token registry functions while maintaining backward compatibility.

src/token-registry-functions/index.ts (1)

2-4: Good API consolidation!

The new exports follow the existing pattern and provide a clean, centralized entry point for all token registry functions.

src/__tests__/token-registry-functions/transfers.test.ts (1)

1-1: Good test refactoring!

Moving mock definitions to a centralized fixtures file improves maintainability and reduces code duplication across test suites.

Also applies to: 4-4, 14-21

src/token-registry-functions/transfer.ts (2)

9-19: LGTM! Clean refactoring to use centralized utilities.

The migration to use imported types and the centralized getTxOptions utility improves code maintainability and reduces duplication across all transfer functions.

Also applies to: 125-125, 248-248, 381-381, 503-503


21-36: Excellent documentation coverage!

The JSDoc comments provide comprehensive documentation for all public functions, including parameter descriptions, error conditions, and return values. This greatly improves the developer experience.

Also applies to: 142-159, 267-285, 401-418

Comment thread src/token-registry-functions/mint.ts
Comment thread src/token-registry-functions/mint.ts
Comment thread src/__tests__/token-registry-functions/rejectTransfers.test.ts Outdated
Comment thread src/__tests__/token-registry-functions/rejectTransfers.test.ts
Comment thread src/__tests__/token-registry-functions/mint.test.ts Outdated
Comment thread src/token-registry-functions/rejectTransfers.ts
Comment thread src/token-registry-functions/rejectTransfers.ts
Comment thread src/token-registry-functions/types.ts Outdated
let titleEscrowContract: v5Contracts.TitleEscrow | v4Contracts.TitleEscrow =
v5Contracts.TitleEscrow__factory.connect(titleEscrowAddress, signer);

const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id!)}` : '0x';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Handle optional encryption ID safely.

The code uses non-null assertion (options.id!) on an optional parameter, which could cause runtime errors if id is not provided when remarks is present.

-const encryptedRemarks = remarks ? `0x${encrypt(remarks, options.id!)}` : '0x';
+const encryptedRemarks = remarks && options.id ? `0x${encrypt(remarks, options.id)}` : '0x';

Also applies to: 180-180, 274-274

🤖 Prompt for AI Agents
In src/token-registry-functions/returnToken.ts at lines 60, 180, and 274, the
code uses a non-null assertion on options.id when encrypting remarks, which
risks runtime errors if id is undefined. Modify the code to safely check if
options.id exists before calling encrypt; if id is missing when remarks are
present, handle the case gracefully by either skipping encryption or throwing a
clear error. This ensures no unsafe assumptions about options.id and prevents
potential crashes.

Comment thread src/token-registry-functions/returnToken.ts Outdated
@RishabhS7

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 3, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
src/token-registry-functions/returnToken.ts (2)

180-180: Handle optional encryption ID safely.

The code uses non-null assertion (options.id!) on an optional parameter, which could cause runtime errors if id is not provided when remarks is present.

-  const encryptedRemarks = remarks && isV5TT ? `0x${encrypt(remarks, options.id!)}` : '0x';
+  const encryptedRemarks = remarks && isV5TT && options.id ? `0x${encrypt(remarks, options.id)}` : '0x';

274-274: Handle optional encryption ID safely.

The code uses non-null assertion (options.id!) on an optional parameter, which could cause runtime errors if id is not provided when remarks is present.

-  const encryptedRemarks = remarks && isV5TT ? `0x${encrypt(remarks, options.id!)}` : '0x';
+  const encryptedRemarks = remarks && isV5TT && options.id ? `0x${encrypt(remarks, options.id)}` : '0x';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb490e4 and a06de56.

📒 Files selected for processing (9)
  • src/__tests__/token-registry-functions/fixtures.ts (1 hunks)
  • src/__tests__/token-registry-functions/mint.test.ts (1 hunks)
  • src/__tests__/token-registry-functions/rejectTransfers.test.ts (1 hunks)
  • src/__tests__/token-registry-functions/returnToken.test.ts (1 hunks)
  • src/token-registry-functions/mint.ts (1 hunks)
  • src/token-registry-functions/rejectTransfers.ts (1 hunks)
  • src/token-registry-functions/returnToken.ts (1 hunks)
  • src/token-registry-functions/types.ts (1 hunks)
  • src/token-registry-functions/utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/tests/token-registry-functions/mint.test.ts
  • src/token-registry-functions/mint.ts
  • src/tests/token-registry-functions/rejectTransfers.test.ts
  • src/token-registry-functions/rejectTransfers.ts
  • src/tests/token-registry-functions/fixtures.ts
  • src/token-registry-functions/utils.ts
  • src/token-registry-functions/types.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/__tests__/token-registry-functions/returnToken.test.ts (3)
src/token-registry-functions/types.ts (1)
  • ProviderInfo (79-83)
src/__tests__/token-registry-functions/fixtures.ts (9)
  • providerV5 (146-146)
  • providerV6 (147-147)
  • PRIVATE_KEY (144-144)
  • mockV5TitleEscrowContract (83-105)
  • mockV4TitleEscrowContract (107-123)
  • MOCK_V5_ADDRESS (4-4)
  • MOCK_V4_ADDRESS (5-5)
  • mockV5TradeTrustTokenContract (70-81)
  • mockV4TradeTrustTokenContract (131-142)
src/token-registry-functions/returnToken.ts (3)
  • returnToIssuer (306-306)
  • rejectReturned (306-306)
  • acceptReturned (306-306)
src/token-registry-functions/returnToken.ts (5)
src/token-registry-functions/types.ts (7)
  • ContractOptions (38-48)
  • ReturnToIssuerParams (10-12)
  • TransactionOptions (30-36)
  • AcceptReturnedOptions (50-52)
  • RejectReturnedParams (18-21)
  • RejectReturnedOptions (53-55)
  • AcceptReturnedParams (14-17)
src/core/endorsement-chain/useEndorsementChain.ts (4)
  • getTitleEscrowAddress (104-133)
  • isTitleEscrowVersion (179-196)
  • TitleEscrowInterface (17-20)
  • checkSupportsInterface (148-164)
src/core/encrypt.ts (1)
  • encrypt (17-42)
src/token-registry-functions/utils.ts (1)
  • getTxOptions (44-44)
src/index.ts (2)
  • v4SupportInterfaceIds (31-31)
  • v5SupportInterfaceIds (35-35)

mockV4TradeTrustTokenContract.callStatic.burn.mockResolvedValue(true);
});

it('should reject returned token with remarks', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect test description.

The test description says "should reject returned token" but it's testing the acceptReturned function.

-      it('should reject returned token with remarks', async () => {
+      it('should accept returned token with remarks', async () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it('should reject returned token with remarks', async () => {
it('should accept returned token with remarks', async () => {
🤖 Prompt for AI Agents
In src/__tests__/token-registry-functions/returnToken.test.ts at line 353, the
test description incorrectly states "should reject returned token" while the
test actually verifies the acceptReturned function. Update the test description
to accurately reflect that it tests accepting a returned token, for example,
change it to "should accept returned token with remarks."

).toHaveBeenCalled();
});

it('should reject returned token without remarks', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect test description.

The test description says "should reject returned token" but it's testing the acceptReturned function.

-      it('should reject returned token without remarks', async () => {
+      it('should accept returned token without remarks', async () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it('should reject returned token without remarks', async () => {
it('should accept returned token without remarks', async () => {
🤖 Prompt for AI Agents
In src/__tests__/token-registry-functions/returnToken.test.ts at line 368, the
test description incorrectly states "should reject returned token" while the
test is actually for the acceptReturned function. Update the test description to
accurately reflect that it is testing the acceptance of a returned token, such
as changing it to "should accept returned token without remarks" or a similar
correct description.

);
}

if (!titleEscrowAddress) throw new Error('Token registry address is required');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect error message.

The condition checks for titleEscrowAddress but the error message references "Token registry address".

-  if (!titleEscrowAddress) throw new Error('Token registry address is required');
+  if (!titleEscrowAddress) throw new Error('Title escrow address is required');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!titleEscrowAddress) throw new Error('Token registry address is required');
if (!titleEscrowAddress) throw new Error('Title escrow address is required');
🤖 Prompt for AI Agents
In src/token-registry-functions/returnToken.ts at line 52, the error message
incorrectly states "Token registry address is required" when the condition
checks for titleEscrowAddress. Update the error message to accurately reflect
the missing variable by changing it to "Title escrow address is required".

@nghaninn nghaninn merged commit 2ea52ce into v1 Jul 4, 2025
@nghaninn nghaninn deleted the feat/mint-function branch July 4, 2025 03:11
@coderabbitai coderabbitai Bot mentioned this pull request Jul 7, 2025
@nghaninn

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.6.0-alpha.2 🎉

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants