Add token-to-native swap detection with NATIVE_SYMBOLS map
This commit is contained in:
@@ -104,6 +104,12 @@ const ALCHEMY_NETWORKS: Record<string, string> = {
|
||||
'56': 'bnb-mainnet',
|
||||
}
|
||||
|
||||
const NATIVE_SYMBOLS: Record<string, string> = {
|
||||
'1': 'ETH',
|
||||
'137': 'POL',
|
||||
'56': 'BNB',
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function fetchAlchemyTransfers(
|
||||
@@ -272,6 +278,14 @@ async function pairTransfers(
|
||||
pairedContractAddress:
|
||||
tokIn[0].rawContract?.address ?? undefined,
|
||||
})
|
||||
} else if (tokOut.length > 0 && extIn.length > 0) {
|
||||
combined.push({
|
||||
...mapTransfer(tokOut[0]),
|
||||
pairedValue: String(extIn[0].value),
|
||||
pairedSymbol: chainid
|
||||
? NATIVE_SYMBOLS[chainid]
|
||||
: undefined,
|
||||
})
|
||||
} else if (tokOut.length > 0) {
|
||||
combined.push(mapTransfer(tokOut[0]))
|
||||
} else if (tokIn.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user