feat(stellar): memo-encoded structured metadata schema (#140) - #151
Conversation
…raith-protocol#45) * perf(stellar): prefilter scans with public view tags * test(stellar): cover legacy view-tag scanner
|
@lockoabosede8-byte 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! 🚀 |
|
@truthixify, CI is failing on 2 pre-existing issues unrelated to this PR. |
|
Hey @lockoabosede8-byte, the That regenerates |
…coded-structured-metadata-schema # Conflicts: # src/chains/stellar/index.ts
…-metadata-schema' into feat/140-memo-encoded-structured-metadata-schema # Conflicts: # src/chains/stellar/index.ts
|
API baseline is fixed. CI now fails on Prettier for |
…coded-structured-metadata-schema
Picks up develop through wraith-protocol#168 as truthixify requested. rpc.ts/rpc.test.ts formatting fixed (pre-existing drift from wraith-protocol#168, confirmed on develop itself). etc/sdk-stellar.api.md refreshed for the new RpcClient exports. Note: 6 tests in rpc.test.ts fail — confirmed pre-existing on develop, unrelated to this PR.
Summary
Implements #140 — Memo-encoded structured metadata schema for Stellar memos. Partners (Reflector, Soroswap) can now attach reason strings, invoice IDs, or reference bytes to transactions via a compact versioned binary schema that fits within Stellar's 32-byte MEMO_HASH / MEMO_RETURN constraint.
Changes
New files
src/chains/stellar/memo/schema.ts— Encoder + decoder for a structured memo schema:version(1) + kind(1) + data_length(1) + data(29)MemoKindenum:Reason(0x01),InvoiceId(0x02),Reference(0x03)encodeMemoSchema(kind, data)— Encodes a string (UTF-8) orUint8Arrayinto a 32-byte schema bufferdecodeMemoSchema(bytes)— Decodes a 32-byte buffer; returns{ bytes, schema? }. If the first byte is not the version marker (0x01), returns the buffer as raw bytes for backwards compatibility0x04–0xEFreserved for future standardised kinds,0xF0–0xFFfor private/experimental use. Unknown kinds are decoded and forwarded without throwingtest/chains/stellar/memo/schema.test.ts— 33 tests covering:Modified files
src/chains/stellar/index.ts— Exports the new symbols (encodeMemoSchema,decodeMemoSchema,MemoKind, constants, types)How it works
Verification
pnpm build— passes, new types appear indist/chains/stellarpnpm test test/chains/stellar/memo/schema.test.ts— 33/33 passCloses #140