From e662374a138051e958c23eb5ede9d75396717d66 Mon Sep 17 00:00:00 2001 From: Sabi <160965598+Meemlahsabi@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:07:09 +0100 Subject: [PATCH 1/2] feat: feat(core): full memo type support (id/hash/return) and SEP- (#202) --- packages/core/src/types/index.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index 6fc733a..9deec85 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -277,6 +277,20 @@ export interface FeeOptions { feeMultiplier?: number } +/** + * A memo to attach to a payment. A bare string is treated as `MEMO_TEXT`. + * + * - `text`: <= 28 UTF-8 bytes + * - `id`: unsigned 64-bit integer as a string; do not parse it to a JavaScript `number` + * - `hash` / `return`: exactly 64 hexadecimal characters (32 bytes) + */ +export type MemoInput = + | string + | { type: "text"; value: string } + | { type: "id"; value: string } + | { type: "hash"; value: string } + | { type: "return"; value: string } + /** * Options for sending a payment transaction. */ @@ -284,7 +298,7 @@ export interface SendPaymentOptions extends FeeOptions { to: string asset: Asset amount: string - memo?: string + memo?: MemoInput } /** From 08f41e8e4815df36d6df3c8bc5cf1406f7c2f9aa Mon Sep 17 00:00:00 2001 From: Sabi <160965598+Meemlahsabi@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:07:11 +0100 Subject: [PATCH 2/2] feat: feat(core): full memo type support (id/hash/return) and SEP- (#202) --- packages/core/src/errors/codes.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/errors/codes.ts b/packages/core/src/errors/codes.ts index 5aa8a66..5511f59 100644 --- a/packages/core/src/errors/codes.ts +++ b/packages/core/src/errors/codes.ts @@ -46,6 +46,10 @@ export const STELLAR_ERROR_CODES = { // ── Validation ───────────────────────────────────────────────────────── /** Caller-supplied input was invalid or the environment was unsupported. */ VALIDATION_ERROR: "VALIDATION_ERROR", + /** The supplied memo is invalid for its type (too long, wrong format, etc.). */ + INVALID_MEMO: "INVALID_MEMO", + /** The destination requires a memo (SEP-29) but none was supplied. */ + MEMO_REQUIRED: "MEMO_REQUIRED", // ── Network ──────────────────────────────────────────────────────────── /** A transport-level failure (offline, DNS, timeout, CORS, etc.). */ @@ -86,6 +90,8 @@ export const DEFAULT_ERROR_MESSAGES: Record = { "The requested start ledger is older than this RPC server retains. Use a more recent ledger, or an archival RPC provider.", RATE_LIMITED: "Too many requests were sent to Horizon. Please slow down and try again.", VALIDATION_ERROR: "The provided input is invalid.", + INVALID_MEMO: "The memo is invalid. Check the memo type and its length/format.", + MEMO_REQUIRED: "The destination account requires a memo. Add one before sending.", NETWORK_ERROR: "Unable to reach the Stellar network. Check your connection and try again.", UNKNOWN: "An unknown error occurred.", }