feat: multi-token support for invoice creation#17
Merged
MarcusDavidG merged 1 commit intoJun 19, 2026
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
Changes
CreateInvoiceParams: replacedtoken: Addresswithtokens: Vec<Address>create_invoice: acceptstokens: Vec<Address>, validatestokens.len() == recipients.len()create_batch: passesparams.tokensthrough with the same length validationcreate_recurring: acceptstokens: Vec<Address>, stores the full vec inSubscriptionParamsbuild_invoice: takestokensdirectly, removes the single-token duplication loop_release: instantiatestoken_clientper-recipient usinginvoice.tokens.get(i)so each recipient is paid in their own tokenparams.tokens.clone()in fullTests
All 17 tests pass. Two new tests added:
test_multi_token_invoice_stores_per_recipient_tokens— verifies per-recipient tokens are stored correctlytest_create_invoice_rejects_token_length_mismatch— verifies validation panics when token count doesn't match recipient count