Skip to content

test(contracts): add unit tests for InvoiceTokenContractService.buildMintTx() - #209

Merged
TS-mfon merged 1 commit into
StellarState:devfrom
TS-mfon:feature/issue-155-invoice-token-mint-tx-tests
Aug 25, 2026
Merged

test(contracts): add unit tests for InvoiceTokenContractService.buildMintTx()#209
TS-mfon merged 1 commit into
StellarState:devfrom
TS-mfon:feature/issue-155-invoice-token-mint-tx-tests

Conversation

@TS-mfon

@TS-mfon TS-mfon commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

closes #155

Summary of Changes

This PR implements the InvoiceTokenContractService for building Soroban SEP-41 mint transactions and adds comprehensive unit test coverage in tests/unit/services/stellar/invoice-token-tx.test.ts.

Changes Included

  • InvoiceTokenContractService (src/services/stellar/invoice-token-contract.service.ts):
    • Implements buildMintTx(recipientAddress, tokenAmount) to construct SEP-41 mint contract calls.
    • Converts recipient addresses to Address.toScVal() and token amounts to nativeToScVal(amount, { type: 'i128' }).
  • Unit Test Suite (tests/unit/services/stellar/invoice-token-tx.test.ts):
    • Verifies generated operation type is invokeHostFunction.
    • Verifies contract address matches configured TOKEN_CONTRACT_ID.
    • Asserts ScVal serialization of recipient address and token supply (i128).
    • Tests support for multiple numeric input formats (bigint, number, string).
    • Tests boundary conditions (zero amounts, large 128-bit values) and invalid address rejection.

Verification

  • Added test coverage in tests/unit/services/stellar/invoice-token-tx.test.ts.
  • Validated TypeScript typing and structure across all added modules.

Copilot AI lite review requested due to automatic review settings August 25, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@TS-mfon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@TS-mfon
TS-mfon merged commit 1d9575f into StellarState:dev Aug 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CONTRACTS] Add unit tests for InvoiceTokenContractService.buildMintTx()

2 participants