Skip to content

Commit 3bab07a

Browse files
committed
fix: normalize token address casing in market data retrieval
1 parent df1cd61 commit 3bab07a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • packages/extension/src/providers/ethereum/libs/transaction

packages/extension/src/providers/ethereum/libs/transaction/decoder.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ const decodeTx = async (
6060
tokenTo = decodedInfo.tokenTo!;
6161
}
6262
await marketData
63-
.getMarketInfoByContracts([tx.to!], network.coingeckoPlatform!)
63+
.getMarketInfoByContracts(
64+
[tx.to!.toLowerCase()],
65+
network.coingeckoPlatform!,
66+
)
6467
.then(marketInfo => {
65-
if (marketInfo[tx.to!]) {
66-
currentPriceUSD = marketInfo[tx.to!]!.current_price ?? 0;
67-
CGToken = marketInfo[tx.to!]!.id;
68+
if (marketInfo[tx.to!.toLowerCase()]) {
69+
currentPriceUSD =
70+
marketInfo[tx.to!.toLowerCase()]!.current_price ?? 0;
71+
CGToken = marketInfo[tx.to!.toLowerCase()]!.id;
6872
}
6973
});
7074
} else {
@@ -82,7 +86,7 @@ const decodeTx = async (
8286
return {
8387
isContractCreation,
8488
dataHex: bufferToHex(dataDecoder.data),
85-
toAddress: tx.to!,
89+
toAddress: tx.to!.toLowerCase(),
8690
decodedHex: dataDecoder.decode().values,
8791
decoded: dataDecoder.decode().decoded,
8892
tokenDecimals,

0 commit comments

Comments
 (0)