Skip to content

SEP-31 Cross-Border Payment Initiator #540

Description

@Kingsman-99

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

  • Sep31Initiator.initiate(asset, amount, receiverInfo, senderInfo, receiverAnchorDomain): Promise<Sep31PaymentRecord> completes the /send call and stores the returned transaction ID
  • Sep31Initiator.getRequiredFields(anchorDomain, asset): Promise<Sep31FieldDefinitions> calls the anchor /info endpoint and returns the typed field schema
  • Sep31Initiator.pollStatus(transactionId, anchorDomain): AsyncIterableIterator<Sep31Status> yields status updates until a terminal state (completed or error)
  • SEP-10 JWT is automatically attached to all requests from src/token.ts
  • Unit tests mock the anchor REST endpoints and assert the full initiate-to-complete flow
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions