Marketplace has launched, further enabling blockchain developers! Learn more

Contents

avm.getUtxOs RPC method

The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. addresses - []string - A list of UTXOs such that each UTXO references at least one address in addresses.
  2. limit - Int - (optional) The limit of UTXOs to return. If limit is omitted or greater than 1024, it is set to 1024.
  3. startIndex - Object - (optional) If startIndex is omitted, will fetch all UTXOs up to limit. When using pagination (ie when startIndex is provided), UTXOs are not guaranteed to be unique across multiple calls. That is, a UTXO may appear in the result of the first call, and then again in the second call.
  4. - address - String

    - utxo - String

  5. sourceChain - String - The ID or alias of the chain the asset is being imported from.
  6. encoding - String - (optional) Encoding sets the format for the returned UTXOs. Can be either "cb58" or "hex". Defaults to "cb58".

Returns:

  1. numFetched - Int - (optional) Number of UTXOs fetched.
  2. utxos - []string

  3. endIndex - Object - Denotes the last UTXO returned. To get the next set of UTXOs, use the value of endIndex as startIndex in the next call.
  4. - address - String

    - utxo - String

Code Examples:

const ethers = require("ethers");

(async () => {
  const provider = new ethers.providers.JsonRpcProvider(
    "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ext/bc/X"
  );
  const params = {
    "addresses": ["X-avax16902ur8dhlyxpaa0rva5fx48fhptx6ryh3dv7q"],
    "limit": 5,
    "sourceChain": "X",
    "encoding": "hex",
  };
  const result = await provider.send("avm.getUTXOs", params);
  console.log(result);
})();
Ready to get started? Create a free account