Description
Enterprise invoices sent to recipients in different countries require the SEP-31 direct payment standard for cross-border fiat settlement with a receiving anchor. The SDK has no SEP-31 integration, leaving integrators to implement the POST /send flow, required field resolution, and transaction status polling from scratch. A SEP-31 initiator should abstract the full initiator-side protocol flow.
Technical Context
Add src/sep/sep31Initiator.ts. Uses @stellar/stellar-sdk StellarToml.Resolver to fetch the receiving anchor's DIRECT_PAYMENT_SERVER URL. Calls /info to retrieve required fields, /send to initiate the payment, and polls /transaction for status. Integrates with src/token.ts for the SEP-10 JWT. Adds Sep31PaymentRecord and Sep31Status to src/types.ts. Emits sep31StatusChanged via src/events.ts.
Acceptance Criteria
Description
Enterprise invoices sent to recipients in different countries require the SEP-31 direct payment standard for cross-border fiat settlement with a receiving anchor. The SDK has no SEP-31 integration, leaving integrators to implement the
POST /sendflow, required field resolution, and transaction status polling from scratch. A SEP-31 initiator should abstract the full initiator-side protocol flow.Technical Context
Add
src/sep/sep31Initiator.ts. Uses@stellar/stellar-sdkStellarToml.Resolverto fetch the receiving anchor'sDIRECT_PAYMENT_SERVERURL. Calls/infoto retrieve required fields,/sendto initiate the payment, and polls/transactionfor status. Integrates withsrc/token.tsfor the SEP-10 JWT. AddsSep31PaymentRecordandSep31Statustosrc/types.ts. Emitssep31StatusChangedviasrc/events.ts.Acceptance Criteria
Sep31Initiator.initiate(asset, amount, receiverInfo, senderInfo, receiverAnchorDomain): Promise<Sep31PaymentRecord>completes the/sendcall and stores the returned transaction IDSep31Initiator.getRequiredFields(anchorDomain, asset): Promise<Sep31FieldDefinitions>calls the anchor/infoendpoint and returns the typed field schemaSep31Initiator.pollStatus(transactionId, anchorDomain): AsyncIterableIterator<Sep31Status>yields status updates until a terminal state (completedorerror)src/token.ts