From 3411319f66f003a0e56bc4ec9c80032f1b33c915 Mon Sep 17 00:00:00 2001 From: leofelix077 Date: Tue, 31 Mar 2026 17:19:26 -0300 Subject: [PATCH 1/2] hide memo row on unrelated transactions --- ...sactionDetailsBottomSheetCustomContent.tsx | 6 ++- .../screens/HistoryScreen/helpers.test.ts | 46 +++++++++++++++++++ .../screens/HistoryScreen/helpers.tsx | 18 ++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/components/screens/HistoryScreen/helpers.test.ts diff --git a/src/components/screens/HistoryScreen/TransactionDetailsBottomSheetCustomContent.tsx b/src/components/screens/HistoryScreen/TransactionDetailsBottomSheetCustomContent.tsx index 340a763a5..2aa30037f 100644 --- a/src/components/screens/HistoryScreen/TransactionDetailsBottomSheetCustomContent.tsx +++ b/src/components/screens/HistoryScreen/TransactionDetailsBottomSheetCustomContent.tsx @@ -3,6 +3,7 @@ import { List, ListItemProps } from "components/List"; import { renderActionIcon, renderIconComponent, + shouldShowMemo, } from "components/screens/HistoryScreen/helpers"; import { CreateAccountTransactionDetailsContent } from "components/screens/HistoryScreen/mappers/createAccount"; import { PaymentTransactionDetailsContent } from "components/screens/HistoryScreen/mappers/payment"; @@ -164,8 +165,9 @@ export const TransactionDetailsBottomSheetCustomContent: React.FC< ), }, - // Hide memo line for M addresses (memo is encoded in the address) - !isDestinationMuxed + // Show memo only for classic Send/Receive (Payment/CreateAccount) operations + // and hide for M addresses (memo is encoded in the address) + shouldShowMemo(transactionDetails.transactionType, isDestinationMuxed) ? { icon: ( diff --git a/src/components/screens/HistoryScreen/helpers.test.ts b/src/components/screens/HistoryScreen/helpers.test.ts new file mode 100644 index 000000000..0703355b4 --- /dev/null +++ b/src/components/screens/HistoryScreen/helpers.test.ts @@ -0,0 +1,46 @@ +import { shouldShowMemo } from "components/screens/HistoryScreen/helpers"; +import { TransactionType } from "components/screens/HistoryScreen/types"; + +describe("shouldShowMemo", () => { + describe("returns true (show memo)", () => { + it("shows memo for PAYMENT when destination is not muxed", () => { + expect(shouldShowMemo(TransactionType.PAYMENT, false)).toBe(true); + }); + + it("shows memo for CREATE_ACCOUNT when destination is not muxed", () => { + expect(shouldShowMemo(TransactionType.CREATE_ACCOUNT, false)).toBe(true); + }); + }); + + describe("returns false (hide memo) for muxed destinations", () => { + it("hides memo for PAYMENT when destination is muxed", () => { + expect(shouldShowMemo(TransactionType.PAYMENT, true)).toBe(false); + }); + + it("hides memo for CREATE_ACCOUNT when destination is muxed", () => { + expect(shouldShowMemo(TransactionType.CREATE_ACCOUNT, true)).toBe(false); + }); + }); + + describe("returns false (hide memo) for non-classic transaction types", () => { + const nonClassicTypes = [ + TransactionType.SWAP, + TransactionType.CHANGE_TRUST, + TransactionType.CONTRACT, + TransactionType.CONTRACT_MINT, + TransactionType.CONTRACT_TRANSFER, + TransactionType.UNKNOWN, + ]; + + it.each(nonClassicTypes)( + "hides memo for %s (not muxed)", + (transactionType) => { + expect(shouldShowMemo(transactionType, false)).toBe(false); + }, + ); + + it.each(nonClassicTypes)("hides memo for %s (muxed)", (transactionType) => { + expect(shouldShowMemo(transactionType, true)).toBe(false); + }); + }); +}); diff --git a/src/components/screens/HistoryScreen/helpers.tsx b/src/components/screens/HistoryScreen/helpers.tsx index 3fb4e1b88..456b78f27 100644 --- a/src/components/screens/HistoryScreen/helpers.tsx +++ b/src/components/screens/HistoryScreen/helpers.tsx @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */ import { Horizon } from "@stellar/stellar-sdk"; +import { TransactionType } from "components/screens/HistoryScreen/types"; import Icon from "components/sds/Icon"; import { OPERATION_TYPES } from "config/constants"; import { SorobanTokenInterface } from "helpers/soroban"; @@ -93,3 +94,20 @@ export const isSorobanTokenMint = (fnName: string | undefined): boolean => */ export const isSorobanTokenTransfer = (fnName: string | undefined): boolean => fnName === SorobanTokenInterface.transfer; + +/** + * Determines if the memo field should be displayed for a transaction. + * Memo is only relevant for classic Send/Receive operations (Payment and + * CreateAccount). It is also hidden when the destination is a muxed address + * because the memo is encoded in the address itself. + */ +export const shouldShowMemo = ( + transactionType: TransactionType, + isDestinationMuxed: boolean, +): boolean => { + const isClassicSendReceive = + transactionType === TransactionType.PAYMENT || + transactionType === TransactionType.CREATE_ACCOUNT; + + return isClassicSendReceive && !isDestinationMuxed; +}; From 472aa9aafa1d2c27b9990a4d5cf168a2ad9de8d6 Mon Sep 17 00:00:00 2001 From: leofelix077 Date: Thu, 2 Apr 2026 14:57:24 -0300 Subject: [PATCH 2/2] Update src/components/screens/HistoryScreen/helpers.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/components/screens/HistoryScreen/helpers.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/screens/HistoryScreen/helpers.tsx b/src/components/screens/HistoryScreen/helpers.tsx index 456b78f27..9047d9253 100644 --- a/src/components/screens/HistoryScreen/helpers.tsx +++ b/src/components/screens/HistoryScreen/helpers.tsx @@ -99,7 +99,14 @@ export const isSorobanTokenTransfer = (fnName: string | undefined): boolean => * Determines if the memo field should be displayed for a transaction. * Memo is only relevant for classic Send/Receive operations (Payment and * CreateAccount). It is also hidden when the destination is a muxed address - * because the memo is encoded in the address itself. + * Determines if the memo field should be displayed in the History details UI + * for a given transaction. + * + * Although Stellar allows attaching a memo to any transaction, this screen + * currently only shows the memo for classic Send/Receive operations + * (Payment and CreateAccount). The memo is also hidden when the destination + * is a muxed address, since the destination address already encodes the + * memo-like data. */ export const shouldShowMemo = ( transactionType: TransactionType,