Skip to content

Commit

Permalink
TW-1479: [EVM] Transactions history with Alchemy. Transfer -> Send/Re…
Browse files Browse the repository at this point in the history
…ceive
  • Loading branch information
alex-tsx committed Nov 26, 2024
1 parent d105fcf commit dd48519
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib/activity/evm/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export function parseTransfer(transfer: AssetTransfersWithMetadataResult, accAdd

if (!fromAddress || !toAddress) return buildInteraction(transfer, accAddress);

// TODO: to/from contract/account recognition
const type = fromAddress === accAddress ? ActivityOperTransferType.send : ActivityOperTransferType.receive;
// (!) Note: Cannot distinguish contract addresses here
const type =
fromAddress === accAddress ? ActivityOperTransferType.sendToAccount : ActivityOperTransferType.receiveFromAccount;

if (transfer.category === AssetTransfersCategory.EXTERNAL) {
// fromAddress is an account's address for 'external' transfers
const type = toAddress === accAddress ? ActivityOperTransferType.receiveFromAccount : ActivityOperTransferType.send;

const { decimal, value } = transfer.rawContract;

Expand All @@ -43,7 +43,6 @@ export function parseTransfer(transfer: AssetTransfersWithMetadataResult, accAdd

if (transfer.category === AssetTransfersCategory.INTERNAL) {
// fromAddress is contract address for 'internal' transfers
const type = toAddress === accAddress ? ActivityOperTransferType.receive : ActivityOperTransferType.send;

const { decimal, value } = transfer.rawContract;

Expand Down

0 comments on commit dd48519

Please sign in to comment.