| Crates.io | memory_wallet |
| lib.rs | memory_wallet |
| version | 0.2.0 |
| created_at | 2024-12-13 07:56:23.498108+00 |
| updated_at | 2025-11-08 09:30:00.468052+00 |
| description | A memory based wallet standard implementation primarily used for testing. |
| homepage | https://github.com/ifiokjr/wasm_solana |
| repository | https://github.com/ifiokjr/wasm_solana |
| max_upload_size | |
| id | 1481962 |
| size | 154,673 |
memory_walletA memory based wallet standard implementation primarily used for testing.
To install you can used the following command:
cargo add memory_wallet
Or directly add the following to your Cargo.toml:
[dependencies]
memory_wallet = "0.2.0"
ssr Enables the ssr feature for the wallet_standard crate.js Enables the js feature to unlock wasm support for the wallet_standard crate.The memory wallet is a simple wallet that stores all accounts in memory and conforms to the WalletStandard trait.
use anyhow::Result;
use memory_wallet::MemoryWallet;
use memory_wallet::prelude::*;
use solana_keypair::Keypair;
use solana_native_token::sol_str_to_lamports;
use solana_pubkey::Pubkey;
use solana_signature::Signature;
use solana_system_interface::instruction::transfer;
use solana_transaction::versioned::VersionedTransaction;
use wallet_standard::SolanaSignTransactionProps;
use wasm_client_solana::DEVNET;
use wasm_client_solana::SolanaRpcClient;
async fn run() -> Result<()> {
let keypair = Keypair::new();
let pubkey = keypair.pubkey();
let target_pubkey = Pubkey::new_unique();
let instruction = transfer(&pubkey, &target_pubkey, sol_str_to_lamports("0.5").unwrap());
let rpc = SolanaRpcClient::new(DEVNET);
let blockhash = rpc.get_latest_blockhash().await?;
let transaction =
VersionedTransaction::new_unsigned_v0(&pubkey, &[instruction], &[], blockhash)?;
let mut memory_wallet = MemoryWallet::new(rpc, &[keypair]);
// connect the first account in the memory wallet accounts list
memory_wallet.connect().await?;
let props = SolanaSignTransactionProps::builder()
.transaction(transaction)
.build();
let signed_transaction: VersionedTransaction = memory_wallet.sign_transaction(props).await?;
Ok(())
}