Skip to content

Instantly share code, notes, and snippets.

@epequeno
Last active June 1, 2021 00:32
Show Gist options
  • Save epequeno/e56788eebb7994394be5e5b5123b8a16 to your computer and use it in GitHub Desktop.
Save epequeno/e56788eebb7994394be5e5b5123b8a16 to your computer and use it in GitHub Desktop.
[package]
name = "simple-rust"
version = "0.1.0"
authors = ["Steven Pequeno <steven@pequeno.in>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
algonaut_client = "0.2.0"
use algonaut_client::indexer::v2::message::{Account, QueryAccount};
use algonaut_client::indexer::v2::Client as IndexerClient;
use algonaut_client::Indexer;
use std::env;
fn main() {
let indexer_address = env::var("SANDBOX_INDEXER_URL").unwrap();
let indexer_client: IndexerClient = Indexer::new().bind(&indexer_address).client_v2().unwrap();
let query_one: QueryAccount = QueryAccount {
application_id: None,
asset_id: None,
auth_addr: None,
currency_greater_than: None,
currency_less_than: None,
limit: None,
next: None,
round: None,
};
let accounts: Vec<Account> = indexer_client.accounts(&query_one).unwrap().accounts;
println!("q1: {}", accounts.len());
let query_two: QueryAccount = QueryAccount {
application_id: None,
asset_id: None,
auth_addr: None,
currency_greater_than: None,
currency_less_than: None,
limit: Some(1),
next: None,
round: None,
};
let accounts: Vec<Account> = indexer_client.accounts(&query_two).unwrap().accounts;
println!("q2: {}", accounts.len());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment