Skip to content

feat(memo): add buildPaymentMemo and parsePaymentMemo helpers (#610) - #786

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Stellar-split:mainfrom
s6pa1rta3n-lab:fix-memo-builder-610
Draft

feat(memo): add buildPaymentMemo and parsePaymentMemo helpers (#610)#786
s6pa1rta3n-lab wants to merge 1 commit into
Stellar-split:mainfrom
s6pa1rta3n-lab:fix-memo-builder-610

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Description

src/memoBuilder.ts builds transaction memos but lacked a standardised helper for the specific memo format used on invoice payment transactions. This PR adds canonical buildPaymentMemo and parsePaymentMemo helpers and exports them from src/index.ts.

Acceptance Criteria Checklist

  • buildPaymentMemo(invoiceId: string, opts?: { tranche?: number }): string exported from src/memoBuilder.ts
  • Output format: "split:{invoiceId}" base case; "split:{invoiceId}:t{tranche}" when tranche provided; truncated to 28 bytes (Stellar memo text limit) with no mid-character cut on UTF-8
  • parsePaymentMemo(memo: string): { invoiceId: string; tranche?: number } | null exported — returns null for non-split memos
  • Round-trip: parsePaymentMemo(buildPaymentMemo(id, opts)) returns the original inputs
  • Both exported from src/index.ts
  • Unit tests: base format, tranche format, 28-byte truncation, UTF-8 multi-byte / emoji safety, round-trip, non-split memo returns null

Closes #610
/claim #610

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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 buildPaymentMemo and parsePaymentMemo helpers to memoBuilder

1 participant