| Crates.io | wasm_client_solana |
| lib.rs | wasm_client_solana |
| version | 0.8.0 |
| created_at | 2024-09-13 09:29:14.86293+00 |
| updated_at | 2025-03-14 15:21:19.383387+00 |
| description | A wasm compatible solana rpc and pubsub client |
| homepage | https://github.com/ifiokjr/wasm_solana |
| repository | https://github.com/ifiokjr/wasm_solana |
| max_upload_size | |
| id | 1373520 |
| size | 917,795 |
wasm_client_solanaA wasm compatible solana rpc and pubsub client.
To install you can use the following command:
cargo add wasm_client_solana
Or directly add the following to your Cargo.toml:
[dependencies]
wasm_client_solana = "0.1" # replace with the latest version
This crate provides the following features:
js: Enables the use of the wasm-bindgen crate for the js target. This is useful for using the crate in a browser environment.ssr: Enables the use of the reqwest and tokio crates for the ssr target. This is useful for using the crate in a server or non-browser environment.zstd: Enables the use of the zstd as an encoding format and automatically activates the ssr target.The SolanaRpcClient provides a wasm compatible client for the solana rpc and pubsub methods.
use solana_sdk::native_token::sol_to_lamports;
use solana_sdk::pubkey;
use wasm_client_solana::ClientResult;
use wasm_client_solana::DEVNET;
use wasm_client_solana::SolanaRpcClient;
async fn run() -> ClientResult<()> {
let client = SolanaRpcClient::new(DEVNET);
let address = pubkey!("99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ");
client
.request_airdrop(&address, sol_to_lamports(1.0))
.await?;
let account = client.get_account(&address).await?;
log::info!("account: {account:#?}");
Ok(())
}