pina-rs
wasm_solana
Rust

Wasm binding for solana using rust in the browser.

Last updated Apr 6, 2026
174
Stars
5
Forks
6
Issues
0
Stars/day
Attention Score
84
Language breakdown
Rust 99.1%
Nix 0.9%
Shell 0.1%
Files click to expand
README

solana development with a rust based wasm client

Continuous integration badge for github actions


Description

This repository contains several crates that make it easier to interact with Solana in WebAssembly environments:

| Crate | Description | | ----------------------------------------------------- | ------------------------------------------------------------------------- | | memorywallet | A memory based wallet standard implementation primarily used for testing. | | testutilsinsta | Test utilities for working with insta redactions | | testutilskeypairs | Test utilities for working with pre-defined keypairs | | testutilssolana | Testing utilities for Solana programs | | wasmclientsolana | WebAssembly client for interacting with Solana programs |

Why?

The roots of Solana development have always been about "eating glass"—building against the odds with grit and determination. Lately, however, the ecosystem has matured. Development has become easier with the introduction of powerful browser libraries, SDKs, and world-class documentation.

This project asks: what if we went back to our roots? It's a return to the ethos of embracing difficulty and pain to build something truly meaningful. This library is for those who know there are easier languages than Rust, but choose to persevere regardless.

The path will not be easy. Hiring may be difficult, error messages may be cryptic, and progress can be painstaking. But you will build with Rust, you will make meaningful progress, and you will love it.

Crate Details

  • memorywallet: A wallet-standard compliant in-memory wallet, ideal for testing and prototyping. It manages Keypairs directly in memory, allowing for seamless signing of transactions and messages without requiring user interaction.
use solana_transaction::Transaction;
  use solana_keypair::Keypair;
  use wasmclientsolana::{SolanaRpcClient, WasmRpcClient};
  use memory_wallet::MemoryWallet;

// 1. Create a mock RPC client let client = SolanaRpcClient::new("https://api.devnet.solana.com");

// 2. Create a keypair for the wallet let keypair = Keypair::new();

// 3. Instantiate the in-memory wallet let mut wallet = MemoryWallet::new(client, &[keypair]);

// 4. The wallet can now be used to sign transactions, etc. // let signedtransaction = wallet.signtransaction(Transaction::newwithpayer(&[], Some(&wallet.pubkey()))).await?;

  • testutilsinsta: Provides helper functions for creating redactions in insta snapshot tests. This is useful for redacting dynamic data like signatures or timestamps, ensuring that snapshots remain consistent across test runs.
use insta::assertdebugsnapshot;
  use solana_signature::Signature;
  use testutilsinsta::createinstaredaction;

let signature = Signature::new_unique();

assertdebugsnapshot!("my_snapshot", &signature, { "signature" => createinstaredaction(signature, "SIGNATURE"), });

  • testutilskeypairs: A collection of pre-defined, constant Keypairs for use in testing. This avoids the need to generate new keypairs in every test and provides known addresses for setting up test scenarios.
use testutilskeypairs::{getadminkeypair, getwalletkeypair};

let adminkeypair = getadmin_keypair(); let walletpubkey = getwallet_keypair().pubkey();

println!("Admin pubkey: {}", admin_keypair.pubkey()); println!("Wallet pubkey: {}", wallet_pubkey);

  • testutilssolana: A suite of utilities for Solana integration testing. It simplifies the process of setting up a ProgramTest environment, managing test validators, and creating test accounts, streamlining the entire testing workflow.
use solanaprogramtest::ProgramTest;
  use testutilssolana::ProgramTestExtension;

let mut program_test = ProgramTest::default(); programtest.addprogram("myprogram", myprogram_id, None);

// Easily add an account with a specific balance programtest.addaccountwithlamports( some_pubkey, 1000000_000, // 1 SOL );

// let (mut banksclient, , ) = programtest.start().await;

  • wasmclientsolana: A general-purpose WebAssembly client for the Solana RPC API. It allows you to fetch account information, send transactions, and interact with the Solana network directly from the browser or other WASM runtimes.
use std::str::FromStr;

use solana_pubkey::Pubkey; use wasmclientsolana::SolanaRpcClient; use wasmclientsolana::WasmRpcClient;

async fn get_balance() { let client = SolanaRpcClient::new("https://api.devnet.solana.com"); let pubkey = Pubkey::from_str("So11111111111111111111111111111111111111112").unwrap();

let balance = client.get_balance(&pubkey).await; println!("Balance: {:?}", balance); }

Contributing

devenv is used to provide a reproducible development environment for this project. Follow the getting started instructions.

To automatically load the environment you should install direnv and then load the direnv.

direnv allow .

At this point you should see the nix commands available in your terminal. Any changes made to the .envrc file will require you to run the above command again.

Run the following command to install required rust binaries and solana tooling locally so you don't need to worry about polluting your global namespace or versioning.

install:all

Upgrading devenv

nix profile upgrade devenv

Editor Setup

To setup recommended configuration for your favorite editor run the following commands.

setup:vscode # Setup vscode
setup:helix

License

Unlicense, see the LICENSE file.

© 2026 GitRepoTrend · pina-rs/wasm_solana · Updated daily from GitHub