Solana WASM Client

Crates.io License

Non-blocking implementation of WASM compatible Solana Client.

Usage

Most methods are identical to solana-client non-blocking API.

solana-sdk is exported which means you don't need to add it to your dependencies.

Example

```rust use solanaclientwasm::{ solana_sdk::signature::{Keypair, Signer}, WasmClient, };

// Create client let client = WasmClient::new("https://api.devnet.solana.com");

// Get a random pubkey let pubkey = Keypair::new().pubkey();

// Get balance let balance = client.get_balance(&pubkey).await?; // in lamports log::info!("Balance is {balance}"); // 0 ```

WebSocket

Requires pubsub crate feature to be activated.

Current implementation depends on web-sys and js-sys crates and is intended to work only in browsers.

```rust // Create a client let client = WasmClient::new("https://api.devnet.solana.com");

// Subscribe to changes let id = client .account_subscribe(pubkey, |data| { // Handle change... }) .await;

// Unsubscribe when its no longer being used to prevent memory leak client.account_unsubscribe(id).await; ```