Skip to content

Commit ca99289

Browse files
committed
chore: remove duplication
1 parent 198ba6a commit ca99289

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

app/components/UI/Money/components/MoneyTransactionDetailsSheet/MoneyTransactionDetailsSheet.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ import { strings } from '../../../../../../locales/i18n';
1515
import { TransactionDetails } from '../../../../Views/confirmations/components/activity/transaction-details/transaction-details';
1616
import { useTransactionDetails } from '../../../../Views/confirmations/hooks/activity/useTransactionDetails';
1717

18-
/**
19-
* Maps each Money/Earn transaction type to its i18n title key.
20-
* Edit this map to customise detail-sheet titles without touching
21-
* shared confirmations code.
22-
*/
2318
const TITLE_KEYS: Partial<Record<TransactionType, string>> = {
2419
[TransactionType.moneyAccountDeposit]:
2520
'transaction_details.title.money_account_deposit',
@@ -38,21 +33,14 @@ const TITLE_KEYS: Partial<Record<TransactionType, string>> = {
3833
function getTitle(tx: TransactionMeta | undefined): string {
3934
const type =
4035
tx?.type === TransactionType.batch
41-
? (tx.nestedTransactions?.find((n) => n.type && n.type in TITLE_KEYS)
42-
?.type as TransactionType | undefined) ?? tx.type
36+
? ((tx.nestedTransactions?.find((n) => n.type && n.type in TITLE_KEYS)
37+
?.type as TransactionType | undefined) ?? tx.type)
4338
: tx?.type;
4439
return strings(
4540
(type && TITLE_KEYS[type]) ?? 'transaction_details.title.default',
4641
);
4742
}
4843

49-
/**
50-
* Renders the transaction details screen as a full-screen bottom sheet modal
51-
* inside the Money modal stack. Because this component is registered as a
52-
* navigation screen in MoneyModalStack, useTransactionDetails() (and any other
53-
* hook that calls useRoute/useParams internally) automatically picks up
54-
* { transactionId } from this screen's route params.
55-
*/
5644
const MoneyTransactionDetailsSheet = () => {
5745
const sheetRef = useRef<BottomSheetRef>(null);
5846
const navigation = useNavigation();

app/components/UI/Money/constants/activityStyles.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from '@metamask/transaction-controller';
55
import I18n from '../../../../../locales/i18n';
66
import { getIntlNumberFormatter } from '../../../../util/intl';
7-
import { fromTokenMinimalUnit } from '../../../../util/number';
7+
import { fromTokenMinimalUnit } from '../../../../util/number/bigint';
88

99
function formatNumber(num: number): string {
1010
return getIntlNumberFormatter(I18n.locale, {
@@ -62,8 +62,7 @@ export function isIncomingMoneyTransactionMeta(tx: TransactionMeta): boolean {
6262
const t = tx.type;
6363
if (
6464
t === EvmTransactionType.incoming ||
65-
t === EvmTransactionType.moneyAccountDeposit ||
66-
t === EvmTransactionType.musdConversion
65+
t === EvmTransactionType.moneyAccountDeposit
6766
) {
6867
return true;
6968
}

app/components/UI/Money/constants/moneyActivityFilters.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ export function isMoneyActivityDeposit(tx: TransactionMeta): boolean {
77
const t = tx.type;
88
if (
99
t === TransactionType.incoming ||
10-
t === TransactionType.moneyAccountDeposit ||
11-
t === TransactionType.musdConversion
10+
t === TransactionType.moneyAccountDeposit
1211
) {
1312
return true;
1413
}
1514
// EIP-7702 batch deposits: moneyAccountDeposit sits in nestedTransactions
1615
return (
1716
tx.nestedTransactions?.some(
18-
(nested) =>
19-
nested.type === TransactionType.moneyAccountDeposit ||
20-
nested.type === TransactionType.musdConversion,
17+
(nested) => nested.type === TransactionType.moneyAccountDeposit,
2118
) ?? false
2219
);
2320
}

0 commit comments

Comments
 (0)