Skip to content

feat(core): full memo type support and SEP-29 memo-required checks - #271

Merged
RaceeyXo merged 3 commits into
RaceeyXo:devfrom
Meemlahsabi:feat/issue-202-feat-core-full-memo-type-support-id-hash-return
Sep 1, 2026
Merged

feat(core): full memo type support and SEP-29 memo-required checks#271
RaceeyXo merged 3 commits into
RaceeyXo:devfrom
Meemlahsabi:feat/issue-202-feat-core-full-memo-type-support-id-hash-return

Conversation

@Meemlahsabi

Copy link
Copy Markdown

Overview

This PR adds full Stellar memo type support to useSendPaymentMEMO_TEXT, MEMO_ID, MEMO_HASH, and MEMO_RETURN — with pre-flight validation and SEP-29 memo-required checks so exchange deposits are credited correctly instead of silently landing in an omnibus account.

Related Issue

Changes

📝 Full Memo Type Support

  • [ADD] MemoInput in packages/core/src/types/index.ts
    • SendPaymentOptions.memo widened from string to MemoInput.
    • Bare strings remain MEMO_TEXT for backwards compatibility.
  • [MODIFY] useSendPayment in packages/core/src/hooks/useSendPayment.ts
    • Validates each memo type before building the transaction.
    • text is measured in UTF-8 bytes (TextEncoder) and limited to 28 bytes.
    • id stays a string end-to-end and is passed directly to Memo.id() — no Number parsing, so values above Number.MAX_SAFE_INTEGER are preserved.
    • hash/return require exactly 64 hexadecimal characters.
  • [ADD] INVALID_MEMO code in packages/core/src/errors/codes.ts
    • Actionable error messages name the limit and the supplied value instead of surfacing as UNKNOWN.

🛡️ SEP-29 Memo-Required Checks

  • [ADD] Pre-submission destination check in useSendPayment
    • Loads the destination account only when no memo is supplied and the destination is not a muxed M... address.
    • Looks for the config.memo_required data entry; if present, refuses with MEMO_REQUIRED.
    • Rejects a muxed destination combined with an explicit memo before any round trip.

🧪 Tests & Docs

  • [ADD] packages/core/src/hooks/useSendPayment.test.tsx
    • Pins the bare-string MEMO_TEXT path.
    • Covers byte-length text memos with emoji/CJK.
    • Uses an id above Number.MAX_SAFE_INTEGER and asserts the exact value on the built transaction.
    • Covers INVALID_MEMO for non-numeric id and bad hash/return.
    • Covers MEMO_REQUIRED, skip conditions, and muxed + memo rejection.
  • [MODIFY] docs/hooks/use-send-payment.md
    • Prominent note about exchange deposits requiring MEMO_ID.

Verification Results

pnpm test
✅ All tests pass

pnpm lint
✅ No lint errors

pnpm typecheck
✅ Typecheck passed

pnpm build
✅ Build passed
Acceptance Criteria Status
All four memo types build correctly and appear on the submitted transaction
memo: "hello" still produces MEMO_TEXT — no breaking change
A text memo over 28 bytes fails validation with a clear message before any network call, not as UNKNOWN
A multi-byte (emoji/CJK) memo is measured in bytes, and a test proves it
An id memo is carried as a string end-to-end; a test uses a value above Number.MAX_SAFE_INTEGER and asserts the exact value on the built transaction
Non-numeric id, and hash/return that are not 64 hex chars, are rejected with INVALID_MEMO
Sending to an account with config.memo_required and no memo fails with MEMO_REQUIRED before submission
The memo-required lookup is skipped when a memo is present or the destination is muxed
A muxed destination combined with an explicit memo is rejected
docs/hooks/use-send-payment.md documents the exchange-deposit case
pnpm test, pnpm lint, pnpm typecheck, and pnpm build all pass locally
No file outside "Where this lives" is touched
Every example and test uses testnet only — no mainnet addresses
PR description includes Closes #[issue number]
Your PR targets the dev branch
⭐ Leave a star on the project

Closes #202

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Meemlahsabi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RaceeyXo
RaceeyXo merged commit c618aad into RaceeyXo:dev Sep 1, 2026
1 of 4 checks passed
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.

feat(core): full memo type support (id/hash/return) and SEP-29 memo-required checks

2 participants