feat(stellar): memo-encoded structured metadata schema (#140)#151
Open
lockoabosede8-byte wants to merge 3 commits into
Open
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! 🚀 |
Author
|
@truthixify, CI is failing on 2 pre-existing issues unrelated to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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