Skip to content

fix(stellar): emit hash and return memos as hex - #132

Merged
anhthii merged 1 commit into
mainfrom
fix/stellar-hash-memo-hex
Nov 21, 2026
Merged

anhthii merged 1 commit into
mainfrom
fix/stellar-hash-memo-hex

Conversation

@vietddude

Copy link
Copy Markdown
Collaborator

Summary

Horizon returns MEMO_HASH and MEMO_RETURN values as base64, and the Stellar indexer passed them through unchanged. Users enter these memos as 64 hex characters (the fystack-ui withdraw form validates that), so apex ended up storing a deposit's hash memo as base64 and a withdrawal's as hex, and webhooks and the API returned two formats for the same memo type.

  • New stellarMemo in internal/indexer/stellar.go, used by both places that read the transaction memo: hash and return memos are decoded from base64 to lowercase hex.
  • text, id and none memos are unchanged. A value that is not valid base64 is passed through as is, so a deposit is never dropped over its memo.
  • The MemoType doc in pkg/common/types/types.go now says hash and return values are hex.

Pairs with fystack/apex#871, which stores the memo on the transaction. Only the memo value of the NATS transfer event changes, for hash and return memos.

Test plan

  • TestStellarMemo_HashAndReturnAsHex: hash and return become hex, text / id / none unchanged, invalid base64 kept. Removing the conversion fails the hash and return cases.
  • go test -short ./...
  • e2e on Stellar testnet with apex#871: deposits with text, id, hash and no memo; the hash memo is stored on the transaction and in deposit.* webhooks as the same hex that was sent

Horizon returns MEMO_HASH and MEMO_RETURN values as base64, while users
enter them as 64 hex characters, so apex stored a deposit's hash memo in
a different form than a withdrawal's. Decode them to lowercase hex in
stellarMemo; text, id and none memos are unchanged, and a value that is
not valid base64 is passed through as is.
@anhthii
anhthii self-requested a review November 21, 2026 05:30
@anhthii
anhthii merged commit b80a785 into main Nov 21, 2026
5 checks passed
@anhthii
anhthii deleted the fix/stellar-hash-memo-hex branch November 21, 2026 05:31
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