Links
Comment on page

avm.getUTXOs

Gets the UTXOs that reference a given address. If sourceChain is specified, then it will retrieve the atomic UTXOs exported from that chain to the X Chain.

Signature

avm.getUTXOs({
addresses: []string,
limit: int, //optional
startIndex: { //optional
address: string,
utxo: string
},
sourceChain: string, //optional
encoding: string //optional
}) -> {
numFetched: int,
utxos: []string,
endIndex: {
address: string,
utxo: string
},
sourceChain: string, //optional
encoding: string
}
  • utxos is a list of UTXOs such that each UTXO references at least one address in addresses.
  • At most limit UTXOs are returned. If limit is omitted or greater than 1024, it is set to 1024.
  • This method supports pagination. endIndex denotes the last UTXO returned. To get the next set of UTXOs, use the value of endIndex as startIndex in the next call.
  • If startIndex is omitted, will fetch all UTXOs up to limit.
  • When using pagination (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.
  • When using pagination, consistency is not guaranteed across multiple calls. That is, the UTXO set of the addresses may have changed between calls.
  • encoding sets the format for the returned UTXOs. Can be either "cb58" or "hex". Defaults to "cb58".

Example

Request
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.getUTXOs",
"params" :{
"addresses":["X-avax1qsnptt6yxnwmh8up7xn5u3sajz37lmyv8u3dmu", "X-avax1qsnptt6yxnwmh8up7xn5u3sajz37lmyv8u3dmu"],
"limit":5,
"encoding": "cb58"
}
}' -H 'content-type:application/json;' https://ava-mainnet.blastapi.io/<project-id>/ext/bc/X
Result
{
"jsonrpc": "2.0",
"result": {
"numFetched": "5",
"utxos": ["11NGY9wtJ8noLPQiLCUXfZk18d3mzVY1Mo5LbYSRcQi5sPKwVzcVdrAVywpPzMFK2HL3uRbpmJrDEYJ9Yp48swpdQVUfUv9PboGxiH7FSX5Qyi8wQQgRToGnQ5EU6ibuw8G4tH5oKB5zAwufeM8674BBpzs8ha3imKKeA1", "11LPByQVNMLx23aocHNjMMpctULjiMM82NLH8k71bcTJhjNStkgeA3e56VxME7CA42LaXBY89Rutg65xqgM6BFX4eDiT3bP28cR1jSfHUrFLkm4qtRWN6tQQ6AzkfkG8r6ZaUPProzcWZ8fBfefUAKKMDAYJcueRy5vQTK", "11TGgTAq6B6dco2kGRQEtk7hDKYGDxMSEkXMXMaU2yzuQJ7nUgxyCobDxjvokz3fRsnV1YQFYFkmu9Ch1eqUBrUy31YujQ2jhkJwc6EEkpGYqZGts39pdAZWrja97JcuuLJ84EuKCd9yzRdHsnCr5vZTt7P8tfFDq4AVns", "11VYeqpaL1TGzVZK2NjNWhBxvS1Rty86TyT8hMYjoej2bRvFk9BWVwYrT7QKKMzeXv6bnjYZsu8DQjTEQ2fcgzd2Vb8Um3GDJBN2zkCgAbhenrycjGEZ6k3tPuijc1gpJAjLJmpojG33MCFihLxTfaisEkqdHCqTUeSPuT", "11w7AhUB3C9CgMyPi5ANgz6FWj5oKeE6Ye7K5v4g4Nc9J3t8DY9Bu4FAMnQxZMZPD8D8uFmVv7Nc1HXKcJMbNWf7fuEYsLgXn5GGr2Hjh36TCrPrtGYe4L9ULcUzndgoKacb5cBLatSAfvePCquThh6VKLWeMFgwC89Nb"],
"endIndex": {
"address": "X-avax1qsnptt6yxnwmh8up7xn5u3sajz37lmyv8u3dmu",
"utxo": "wtR7m3QvVd4DsiWehJ767DP483J5naBSY3m3DNR7xr9NvBWqx"
},
"encoding": "cb58"
},
"id": 1
}