Skip to content

Conversation

@pkieltyka
Copy link
Member

This PR allows you to pass in a txn hash or an array of logs, and it will output all token transfer details in terms of token/from/to/value, as well you can call .ComputeBalanceOutputs() on the token transfers and it will return the net values summing the combination of all events so you can see the balance of tokens for any account that happens in the transaction.

  1. New receipts.FetchReceiptTokenTransfers(txnHash) method to fetch receipt and return TokenTransfers
  2. new receipts.DecodeTokenTransfersFromLogs(logs) method to parse logs directly and return TokenTransfers
  3. For any given TokenTransfers object, this is an array as []*TokenTransfer
  4. A TokenTransfer is a struct of Token/From/To/Value
  5. You can call tokenTransfers.ComputeBalanceOutputs() and it will return TokenBalances which is []*TokenBalance
  6. TokenBalance is a struct that is Token/Account/Balance

@pkieltyka pkieltyka merged commit be4e227 into master Dec 13, 2025
2 checks passed
@pkieltyka pkieltyka deleted the token-transfers branch December 13, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants