feat(splitter): add optional payment reference to pay, pay_many, pay_many_multi - #288
Open
Justjoseph0 wants to merge 2 commits into
Open
feat(splitter): add optional payment reference to pay, pay_many, pay_many_multi#288Justjoseph0 wants to merge 2 commits into
Justjoseph0 wants to merge 2 commits into
Conversation
…many_multiIntegrators had no way to tag a payment with an external id (order/invoice)for reconciliation. Adds an optional reference: Option<BytesN<32>> to pay,and references: Vec<Option<BytesN<32>>> to pay_many/pay_many_multi (emptyvec means no reference for any split in the batch, non-empty must matchids.len() exactly or returns LengthMismatch).Carried through into the SplitPaid event as a plain data field (not atopic, to avoid spending a topic slot). Indexer and export-csv.mjs updatedto decode and surface it. SDK regenerated via the stellar CLI and exposesreference as an optional argument on all three functions.deposit() intentionally left untouched — separate design question, outof scope here.
…tionalcargo fmt --all --check was failing on two multi-line call sites in test.rs,pure formatting, no behavior change.The generated SDK interface marked reference/references as required keys(value type Option<T>, but the key itself was mandatory), which brokePaySplit.tsx, an existing caller that predates this feature and doesn'tpass a reference. Made reference/references actual optional TS keys, andadded a small constructor-level patch so the base ContractClient alwaysreceives the key with a sensible default (undefined for reference, [] forreferences) when the caller omits it — verified at the ScVal encodinglevel that omitted still resolves to None/empty and explicit values stillpass through byte-identical.
Contributor
|
|
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 #263
No way to tag a payment with an order/invoice id before this. Integrator pays a marketplace split for order A-1234, has nothing to attach that to on-chain.
What I did:
Testing: cargo test (the repo's own recipe) — 35/35 passing, 8 new tests covering with/without reference, empty vec, and mismatched length rejection with revert checks. Indexer tests pass. SDK tsc builds clean.
Flagging pay_many_multi since the issue text didn't name it explicitly — added it for consistency, let me know if that's not wanted.