@@ -22,7 +22,7 @@ import {
2222} from '../constants/activityStyles' ;
2323import { buildMoneyActivityFiatLine } from '../utils/moneyActivityFiat' ;
2424import { moneyFormatFiat } from '../utils/moneyFormatFiat' ;
25- import { fromTokenMinimalUnit } from '../../../../util/number' ;
25+ import { fromTokenMinimalUnit } from '../../../../util/number/bigint ' ;
2626import type {
2727 MoneyActivityTitleKey ,
2828 MoneyActivityTransactionMeta ,
@@ -33,15 +33,9 @@ export interface MoneyTransactionDisplayInfo {
3333 description : string | undefined ;
3434 primaryAmount : string ;
3535 fiatAmount : string ;
36- isIncoming : boolean ;
37- /** Symbol of the source token (e.g. "USDC", "ETH"). */
3836 sourceTokenSymbol : string | undefined ;
39- /** Remote image URI for the source token avatar (ERC-20 tokens). */
4037 sourceTokenImage : string | undefined ;
41- /**
42- * Chain ID of the source token — set only for native tokens (e.g. ETH)
43- * so the item can render the network logo as the token avatar.
44- */
38+ // only for native tokens so we can show the network logo
4539 sourceTokenChainId : string | undefined ;
4640}
4741
@@ -132,7 +126,6 @@ function buildSourceTokenAmount(
132126 decimals : number ,
133127 symbol : string ,
134128) : string {
135- // fromTokenMinimalUnit expects a decimal string
136129 const decimalStr = String ( Number ( rawAmount ) ) ;
137130 const humanReadable = fromTokenMinimalUnit ( decimalStr , decimals ) ;
138131 const num = parseFloat ( humanReadable ) ;
@@ -175,7 +168,7 @@ export function useMoneyTransactionDisplayInfo(
175168 const payTokenAddress = tx . metamaskPay ?. tokenAddress as Hex | undefined ;
176169 const payTokenChainId = tx . metamaskPay ?. chainId as Hex | undefined ;
177170
178- // ERC -20 token lookup (e.g. USDC on mainnet).
171+ // look up erc -20 tokens
179172 const payToken = useSelector ( ( state : RootState ) =>
180173 payTokenAddress && payTokenChainId
181174 ? selectSingleTokenByAddressAndChainId (
@@ -186,8 +179,7 @@ export function useMoneyTransactionDisplayInfo(
186179 : undefined ,
187180 ) ;
188181
189- // Native token fallback (e.g. ETH) — ERC-20 lookup returns undefined for
190- // native tokens since they aren't in the token registry.
182+ // Native token fallback - these are not in the token registry
191183 const nativeTicker = useSelector ( ( state : RootState ) => {
192184 if ( payToken || ! payTokenAddress || ! payTokenChainId ) {
193185 return undefined ;
@@ -203,8 +195,7 @@ export function useMoneyTransactionDisplayInfo(
203195
204196 const sourceTokenSymbol = payToken ?. symbol ?? nativeTicker ;
205197 const sourceTokenImage = payToken ?. image ;
206- // Pass the chain ID for native tokens so the item can render the
207- // network logo (e.g. the ETH logo for Ethereum mainnet).
198+
208199 const sourceTokenChainId =
209200 isNative && payTokenChainId ? payTokenChainId : undefined ;
210201
@@ -216,14 +207,10 @@ export function useMoneyTransactionDisplayInfo(
216207 const requiredAsset = getRequiredAsset ( tx ) ;
217208 if ( requiredAsset ) {
218209 if ( isNative ) {
219- // For native tokens (e.g. ETH), requiredAssets[0].amount is stored
210+ // For native tokens requiredAssets[0].amount is stored
220211 // in USDC-equivalent 6-decimal units (the USD value of the deposit),
221- // NOT in wei. Convert to the native token amount via the exchange
222- // rate so we can display "+0.000445 ETH" instead of a nonsensical
223- // scientific-notation value.
224- //
225- // Use BigNumber throughout to avoid floating-point precision issues
226- // (plain division produces values like 0.000445091800067904466).
212+ // NOT in wei.
213+
227214 const nativeToUsdRate = nativeTicker
228215 ? currencyRates ?. [ nativeTicker ] ?. conversionRate
229216 : undefined ;
@@ -255,7 +242,6 @@ export function useMoneyTransactionDisplayInfo(
255242
256243 // --- Fiat amount ---
257244 // Prefer calculated market-rate value.
258- // Fall back to metamaskPay.targetFiat when unavailable.
259245 let fiatAmount = buildMoneyActivityFiatLine (
260246 tx ,
261247 currencyRates ,
@@ -269,9 +255,7 @@ export function useMoneyTransactionDisplayInfo(
269255 }
270256 }
271257
272- // --- Description ---
273- // Explicit moneySubtitle takes priority; otherwise surface the source
274- // token symbol (e.g. "USDC" or "ETH") so it's clear what was deposited.
258+ // Explicit moneySubtitle takes priority; otherwise use source token symbol
275259 const description = subtitle ?? sourceTokenSymbol ;
276260
277261 return {
0 commit comments