First, thank you for this SDK. It has been very helpful in getting our project launched.
I have a simple function to get all the utxos for a given address. I'm testing with an address that has just a single utxo. When I run the code below, it runs forever until I kill the program.
async fn get_all_address_utxos(api_key: &str, address: &str) -> anyhow::Result<Vec<AddressUtxo>> {
let mut settings = BlockFrostSettings::new().use_mainnet();
settings
.query_parameters
.set_count(100)
.set_page(1)
.set_order(QueryOrder::Descending);
let api = BlockFrostApi::new(api_key, settings);
let mut lister = api.addresses_utxos_all(address);
let mut res = Vec::new();
while let Some(page) = lister.next().await {
res.append(&mut page?);
}
Ok(res)
}
It looks like when there aren't any more results, page is an empty Vec. I can easily check for this and break out of the while loop but I was expecting the iterator to return None when there weren't any results remaining. Is this an incorrect assumption?
First, thank you for this SDK. It has been very helpful in getting our project launched.
I have a simple function to get all the utxos for a given address. I'm testing with an address that has just a single utxo. When I run the code below, it runs forever until I kill the program.
It looks like when there aren't any more results,
page
is an emptyVec
. I can easily check for this and break out of thewhile
loop but I was expecting the iterator to returnNone
when there weren't any results remaining. Is this an incorrect assumption?