Skip to content

feat: multi-token support for invoice creation#17

Merged
MarcusDavidG merged 1 commit into
stellar-sharpy:mainfrom
Clement-coder:feat/multi-token-support
Jun 19, 2026
Merged

feat: multi-token support for invoice creation#17
MarcusDavidG merged 1 commit into
stellar-sharpy:mainfrom
Clement-coder:feat/multi-token-support

Conversation

@Clement-coder

Copy link
Copy Markdown
Contributor

Closes #7

Changes

  • CreateInvoiceParams: replaced token: Address with tokens: Vec<Address>
  • create_invoice: accepts tokens: Vec<Address>, validates tokens.len() == recipients.len()
  • create_batch: passes params.tokens through with the same length validation
  • create_recurring: accepts tokens: Vec<Address>, stores the full vec in SubscriptionParams
  • build_invoice: takes tokens directly, removes the single-token duplication loop
  • _release: instantiates token_client per-recipient using invoice.tokens.get(i) so each recipient is paid in their own token
  • Recurring next-invoice creation passes params.tokens.clone() in full

Tests

All 17 tests pass. Two new tests added:

  • test_multi_token_invoice_stores_per_recipient_tokens — verifies per-recipient tokens are stored correctly
  • test_create_invoice_rejects_token_length_mismatch — verifies validation panics when token count doesn't match recipient count

- Replace single token: Address with tokens: Vec<Address> in
  create_invoice, create_batch, create_recurring, and CreateInvoiceParams
- build_invoice now accepts tokens vec directly, no duplication loop
- _release uses per-recipient token (invoice.tokens.get(i)) instead of
  a shared tokens.get(0)
- Validate tokens.len() == recipients.len() at creation time
- Update all tests; add test_multi_token_invoice_stores_per_recipient_tokens
  and test_create_invoice_rejects_token_length_mismatch
@MarcusDavidG MarcusDavidG merged commit b6b9d4e into stellar-sharpy:main Jun 19, 2026
1 check failed
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.

Add multi-token support to invoice creation

2 participants