1

I'm working with alchemy's SDK and it looks like the getAssetTransfers API endpoint will return any value transaction from an address.

However, it also looks like it can return a list of all transactions for an address even if no value is sent (like calling a function for example).

Can it do this?

3 Answers 3

2

Heya 👋🏼 Full disclosure: Alchemy Developer Advocate speaking :)

getAssetTransfers gets all transaction types that you specify in your query, including "transactions even if no value is sent" as long as they fall under one of the supported transaction types.

The transactions you're seeing are probably internal transactions, since in the tutorial you linked, internal is one of the transaction types you're asking for:

const data = await alchemy.core.getAssetTransfers({
  fromBlock: "0x0",
  fromAddress: "0x5c43B1eD97e52d009611D89b74fA829FE4ac56b1",
  category: ["external", "internal", "erc20", "erc721", "erc1155"],
});

Our docs show table with all of the transaction types that are supported:

  1. external
  2. internal
  3. erc20
  4. erc721
  5. erc1155
  6. specialnft

Hope that helps!

2
  • 1
    so... it does get a list of all transactions? Dec 9, 2022 at 14:30
  • yes, as long as you define "all" as the union of these categories of transactions: ["external", "internal", "erc20", "erc721", "erc1155", "specialnft"] Dec 11, 2022 at 9:02
0

Yes, the Alchemy SDK's getAssetTransfers API endpoint can return a list of transactions for an address even if no value is sent. This is because the getAssetTransfers endpoint returns a list of all transactions involving an address, regardless of whether or not value was transferred in the transaction.

This example is to retrieve a list of transactions involving a specific address:

// Import the Alchemy client
const { AlchemyClient } = require('@alch/alchemy-client');

// Initialize the client
const client = new AlchemyClient({
  apiKey: 'YOUR_API_KEY'
});

// Set the address you want to get transactions for
const address = '0x0000000000000000000000000000000000000000';

// Call the getAssetTransfers API endpoint
client.getAssetTransfers(address)
  .then(response => {
    // Print the response
    console.log(response);
  })
  .catch(error => {
    // Print any errors
    console.error(error);
  });

have a try.

0

Just add on to this question. In the returned data, it contains failed tractions and which is hard to be detected from data.

example address:

0x5231fe2363e5599711d22d57895f7daf69f2bf2d

failed transaction:

https://etherscan.io/tx/0x0b0f92323703fc090854ed288ac8071e87a9ef9a8a688b7cb147b20826adb5a7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.