get_access_key/
get_access_key.rs

1use near_api_lib::accounts::get_access_key;
2use near_api_lib::primitives::types::AccountId;
3use near_api_lib::JsonRpcProvider;
4use std::sync::Arc;
5
6#[tokio::main]
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8    env_logger::init();
9
10    let account_id: AccountId = "near-api-rs.testnet".parse::<AccountId>()?;
11
12    let provider = Arc::new(JsonRpcProvider::new("https://rpc.testnet.near.org"));
13
14    let result = get_access_key(provider, account_id).await;
15
16    println!("response: {:#?}", result);
17
18    Ok(())
19}