Crates.io | solana-program-client |
lib.rs | solana-program-client |
version | 0.1.0 |
source | src |
created_at | 2024-06-03 18:13:03.299353 |
updated_at | 2024-06-03 18:13:03.299353 |
description | lightweight crate to call Solana programs |
homepage | https://github.com/cenwadike/solana-program-client |
repository | https://github.com/cenwadike/solana-program-client |
max_upload_size | |
id | 1260347 |
size | 151,378 |
solana_program_client
is a lightweight crate to call Solana programs. It focuses on abstracting away relevant crates used for interacting with Solana programs.
solana_program_client
is a crate for developing clients for Solana programs and client-side web applications using Rust. The primary goal behind this project is to provide an ergonomic interface for interacting with Solana programs.
This in turn allows developers to use call program functions using simple RPC requests.
An example is available here:
use solana_program_client::legacy_tx::*;
#[derive(BorshSerialize, BorshDeserialize)]
#[borsh(crate = "borsh")]
pub struct UpdateBlob {
pub data: Vec<u8>,
}
fn main() {
// create a Rpc client connection
let connection = RpcClient::new("https://api.devnet.solana.com");
let program_id = blob::ID;
// get blob PDA
let (blob_account, _) = Pubkey::find_program_address(&[&b"blob"[..]], &program_id);
let payer = Keypair::read_from_file("~/.config/solana/id.json").unwrap();
let instruction_name = "update_blob";
// construct instruction data
let instruction_data = UpdateBlob {
data: "data".as_bytes().to_vec(),
};
// set up accounts
let accounts = vec![
AccountMeta::new(blob_account, false),
AccountMeta::new(payer.pubkey(), true),
];
// call signed call
let _tx_signature = signed_call(
connection,
program_id,
payer,
instruction_name,
instruction_data,
accounts,
).unwrap();
}
Submit signed call to Solana program
Create a lookup table
Extend a lookup table
Submit versioned transaction
The crate is currently under development and should be considered in the alpha stage. Additional work is needed on further extensions.
solana: Fj72ApTUaYEwC3RKCKQ7iX3s8i8CVAnZW1f9PAXSKtbY