#solana #extension #testing #compatible #environments #pubkey #wallet

test_utils_solana

Utilities and extensions for testing solana in wasm compatible environments

26 releases (6 breaking)

new 0.7.2 Jan 17, 2025
0.7.0 Dec 21, 2024
0.5.5 Nov 4, 2024

#297 in Magic Beans

Download history 415/week @ 2024-09-29 1021/week @ 2024-10-06 452/week @ 2024-10-13 200/week @ 2024-10-20 8/week @ 2024-10-27 131/week @ 2024-11-03 12/week @ 2024-11-10 3/week @ 2024-11-17 1/week @ 2024-11-24 472/week @ 2024-12-08 154/week @ 2024-12-15 52/week @ 2024-12-22 5/week @ 2025-01-05 155/week @ 2025-01-12

285 downloads per month
Used in wallet_standard_wallets

Unlicense

1MB
24K SLoC

test_utils_solana


Utilities and extensions for testing solana in wasm compatible environments.


Crate Docs Status Unlicense codecov

Installation

To install you can used the following command:

cargo add --dev test_utils_solana

Or directly add the following to your Cargo.toml:

[dev-dependencies]
test_utils_solana = "0.1" # replace with the latest version

Features

Feature Description
test_validator Enables the test_validator feature for the solana_test_validator crate.

Usage

The following requires the test_validator feature to be enabled.

use solana_sdk::pubkey;
use test_utils_solana::TestValidatorRunner;
use test_utils_solana::TestValidatorRunnerProps;

async fn run() -> TestValidatorRunner {
	let pubkey = pubkey!("99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ");
	let props = TestValidatorRunnerProps::builder()
		.pubkeys(vec![pubkey]) // pubkeys to fund with an amount of sol each
		.initial_lamports(1_000_000_000) // initial lamports to add to each pubkey account
		.namespace("tests") // namespace to use for the validator client rpc
		.build();

	TestValidatorRunner::run(props).await
}

Dependencies

~148MB
~3M SLoC