Crate agsol_wasm_client
source · [−]Expand description
This is an experimental crate that aims to implement a Wasm-compatible
non-blocking (async) RpcClient
for Solana. Currently, Solana uses its
own blocking
RpcClient
for querying the blockchain which cannot be ported to Wasm.
This crate uses an async
reqwest::Client
to make [RpcRequest
]s to the blockchain. Thus, querying the blockchain
can be written entirely in Rust and then it can be easily ported to Wasm
using wasm_bindgen
.
Examples
use agsol_wasm_client::{Net, RpcClient};
use solana_program::pubkey::Pubkey;
#[tokio::main]
async fn main() {
let mut client = RpcClient::new(Net::Devnet);
let balance = client
.get_minimum_balance_for_rent_exemption(50)
.await
.unwrap();
let owner = client.get_owner(&Pubkey::default()).await.unwrap();
}
When built with the wasm-factory
feature enabled, this crate provides the
wasm_instruction!()
macro that can be used for quickly exposing a Solana
Instruction
factory to Wasm.
Modules
Structs
An async client to make rpc requests to the Solana blockchain.
Enums
Specifies which Solana cluster will be queried by the client.