Skip to content

feat: implement decodeMemo() transaction helper — closes #111#141

Open
spiffamani wants to merge 1 commit intoamina69:mainfrom
spiffamani:feat/decode-memo-111
Open

feat: implement decodeMemo() transaction helper — closes #111#141
spiffamani wants to merge 1 commit intoamina69:mainfrom
spiffamani:feat/decode-memo-111

Conversation

@spiffamani
Copy link
Copy Markdown

Summary

Implements decodeMemo() helper for decoding Stellar memo objects, closing #111.

Changes

  • src/transactions/builder.ts — Added decodeMemo() and DecodedMemo type
  • src/transactions/index.ts — Re-exports decodeMemo and DecodedMemo
  • src/index.ts — Exports decodeMemo and DecodedMemo from public surface
  • tests/unit/transactions/decodeMemo.test.ts — 7 unit tests

Memo Type Handling

Memo Type Return Value
MEMO_NONE null
MEMO_TEXT original string
MEMO_ID numeric value as string
MEMO_HASH hex digest string
MEMO_RETURN hex digest string

Usage

import { decodeMemo } from '@petad/stellar-sdk';
import { Memo } from '@stellar/stellar-sdk';

decodeMemo(Memo.none());        // { type: 'MEMO_NONE', value: null }
decodeMemo(Memo.text('hello')); // { type: 'MEMO_TEXT', value: 'hello' }
decodeMemo(Memo.id('12345'));   // { type: 'MEMO_ID', value: '12345' }

Test Results

Tests: 85 passed, 85 total
Test Suites: 10 passed, 10 total

Checklist

  • All memo types handled
  • Exported from src/transactions/builder.ts
  • Available through public index
  • npm test passes
  • No new runtime dependencies

- Add src/transactions/builder.ts with decodeMemo()
- MEMO_NONE returns null
- MEMO_TEXT returns original string
- MEMO_ID returns numeric value as string
- MEMO_HASH returns hex digest string
- MEMO_RETURN returns hex digest string
- Export decodeMemo and DecodedMemo from transactions and public index
- Add 7 unit tests covering all memo types
@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 30, 2026

@spiffamani you are making pr to the wrong branch, read the conributing.md

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.

2 participants