Repository navigation
fix(stellar): emit hash and return memos as hex - #132
Merged
Merged
Conversation
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
self-requested a review
November 21, 2026 05:30
anhthii
approved these changes
Nov 21, 2026
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
Horizon returns
MEMO_HASHandMEMO_RETURNvalues 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.stellarMemoininternal/indexer/stellar.go, used by both places that read the transaction memo:hashandreturnmemos are decoded from base64 to lowercase hex.text,idandnonememos are unchanged. A value that is not valid base64 is passed through as is, so a deposit is never dropped over its memo.MemoTypedoc inpkg/common/types/types.gonow says hash and return values are hex.Pairs with fystack/apex#871, which stores the memo on the transaction. Only the
memovalue 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 ./...deposit.*webhooks as the same hex that was sent