wasm_client_solana

Crates.iowasm_client_solana
lib.rswasm_client_solana
version
sourcesrc
created_at2024-09-13 09:29:14.86293
updated_at2024-11-04 16:35:05.624921
descriptionA wasm compatible solana rpc and pubsub client
homepagehttps://github.com/ifiokjr/wasm_solana
repositoryhttps://github.com/ifiokjr/wasm_solana
max_upload_size
id1373520
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Ifiok Jr. (ifiokjr)

documentation

README

wasm_client_solana


A wasm compatible solana rpc and pubsub client.


Crate Docs Status Unlicense codecov

Installation

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

Features

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.

Usage

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(())
}
Commit count: 185

cargo fmt