@@ -138,7 +138,7 @@ export const useAggregatedSimData = (
138
138
details : t . details ,
139
139
erc20TokensRecord,
140
140
nftContracts,
141
- tokenId : t . value ,
141
+ tokenId : t . tokenId ?? t . value , // For fallback compatibility, we use the value as the tokenId. This will be ignored for ERC20 tokens
142
142
networkId : network . id ,
143
143
} )
144
144
@@ -157,7 +157,7 @@ export const useAggregatedSimData = (
157
157
details : a . details ,
158
158
erc20TokensRecord,
159
159
nftContracts,
160
- tokenId : a . value ,
160
+ tokenId : a . tokenId ?? a . value , // For fallback compatibility, we use the value as the tokenId. This will be ignored for ERC20 tokens
161
161
networkId : network . id ,
162
162
} )
163
163
@@ -217,7 +217,7 @@ export const useAggregatedSimData = (
217
217
token : a . token ,
218
218
owner : a . owner ,
219
219
spender : a . spender ,
220
- amount : BigNumber ( a . token . type === "erc721" ? 1 : a . value ) ,
220
+ amount : BigNumber ( a . value ?? 1 ) ,
221
221
usdValue : a . usdValue ? BigNumber ( a . usdValue ) : undefined ,
222
222
} ) )
223
223
. filter ( ( a ) => a . owner === account ?. address ) ?? [ ]
@@ -239,10 +239,10 @@ export const useAggregatedSimData = (
239
239
const amount = transfers . reduce < BigNumber > ( ( acc , t ) => {
240
240
const isTokenTranfer = checkIsTokenTransfer ( t )
241
241
if ( isTokenTranfer && t . from === account ?. address ) {
242
- return t . token . type === "erc721" ? acc . minus ( 1 ) : acc . minus ( t . value )
242
+ return acc . minus ( t . value ?? ONE ) // This works because ERC721 tokens have value undefined and the amount is always 1
243
243
}
244
244
245
- return t . token . type === "erc721" ? acc . plus ( 1 ) : acc . plus ( t . value )
245
+ return acc . plus ( t . value ?? ONE )
246
246
} , ZERO )
247
247
248
248
const usdValue = transfers . reduce < BigNumber > ( ( acc , t ) => {
@@ -259,7 +259,7 @@ export const useAggregatedSimData = (
259
259
} , ZERO )
260
260
261
261
const recipients = transfers . reduce < Recipient [ ] > ( ( acc , t ) => {
262
- const amount = t . token . type === "erc721" ? ONE : BigNumber ( t . value )
262
+ const amount = BigNumber ( t . value ?? 1 )
263
263
264
264
const negated = amount . negated ( )
265
265
const isTokenTranfer = checkIsTokenTransfer ( t )
@@ -330,7 +330,7 @@ export function apiTokenDetailsToToken({
330
330
tokenAddress : string
331
331
details ?: TokenDetails
332
332
networkId : string
333
- tokenId : string
333
+ tokenId ? : string
334
334
erc20TokensRecord : Record < string , Token >
335
335
nftContracts ?: string [ ]
336
336
} ) : TokenWithType | undefined {
0 commit comments