pub struct ArchRpcClient {
pub config: Config,
/* private fields */
}Expand description
ArchRpcClient provides a simple interface for making RPC calls to the Arch blockchain
Fields§
§config: ConfigImplementations§
Source§impl ArchRpcClient
impl ArchRpcClient
Sourcepub fn new_tcp(config: &Config, addr: String) -> Result<Self>
pub fn new_tcp(config: &Config, addr: String) -> Result<Self>
Create a new ArchRpcClient with the specified TCP server address.
Sourcepub async fn call_method<R: DeserializeOwned>(
&self,
method: &str,
) -> Result<Option<R>>
pub async fn call_method<R: DeserializeOwned>( &self, method: &str, ) -> Result<Option<R>>
Make a raw RPC call with no parameters and parse the result Returns None if the item was not found (404)
Sourcepub async fn call_method_with_params<T: Serialize + Debug, R: DeserializeOwned>(
&self,
method: &str,
params: T,
) -> Result<Option<R>>
pub async fn call_method_with_params<T: Serialize + Debug, R: DeserializeOwned>( &self, method: &str, params: T, ) -> Result<Option<R>>
Make a raw RPC call with parameters and parse the result Returns None if the item was not found (404)
Sourcepub async fn call_method_raw(&self, method: &str) -> Result<Option<Value>>
pub async fn call_method_raw(&self, method: &str) -> Result<Option<Value>>
Get raw value from a method call Returns None if the item was not found (404)
Sourcepub async fn call_method_with_params_raw<T: Serialize + Debug>(
&self,
method: &str,
params: T,
) -> Result<Option<Value>>
pub async fn call_method_with_params_raw<T: Serialize + Debug>( &self, method: &str, params: T, ) -> Result<Option<Value>>
Get raw value from a method call with parameters Returns None if the item was not found (404)
Sourcepub async fn read_account_info(&self, pubkey: Pubkey) -> Result<AccountInfo>
pub async fn read_account_info(&self, pubkey: Pubkey) -> Result<AccountInfo>
Read account information for the specified public key
Sourcepub async fn get_multiple_accounts(
&self,
pubkeys: Vec<Pubkey>,
) -> Result<Vec<Option<AccountInfoWithPubkey>>>
pub async fn get_multiple_accounts( &self, pubkeys: Vec<Pubkey>, ) -> Result<Vec<Option<AccountInfoWithPubkey>>>
Read account information for multiple public keys
Sourcepub async fn request_airdrop(
&self,
pubkey: Pubkey,
) -> Result<ProcessedTransaction>
pub async fn request_airdrop( &self, pubkey: Pubkey, ) -> Result<ProcessedTransaction>
Request an airdrop for a given public key
Sourcepub async fn create_and_fund_account_with_faucet(
&self,
keypair: &Keypair,
) -> Result<()>
pub async fn create_and_fund_account_with_faucet( &self, keypair: &Keypair, ) -> Result<()>
Create an account with lamports
Sourcepub async fn get_processed_transaction(
&self,
tx_id: &Hash,
) -> Result<Option<ProcessedTransaction>>
pub async fn get_processed_transaction( &self, tx_id: &Hash, ) -> Result<Option<ProcessedTransaction>>
Get a processed transaction by ID
Sourcepub async fn get_full_block_with_txids(
&self,
block_id: &Hash,
) -> Result<(Block, Vec<ProcessedTransaction>)>
pub async fn get_full_block_with_txids( &self, block_id: &Hash, ) -> Result<(Block, Vec<ProcessedTransaction>)>
Get a block with its transactions by ID
Sourcepub async fn wait_for_processed_transaction(
&self,
tx_id: &Hash,
) -> Result<ProcessedTransaction>
pub async fn wait_for_processed_transaction( &self, tx_id: &Hash, ) -> Result<ProcessedTransaction>
Waits for a transaction to be processed, polling until it reaches “Processed” or “Failed” status. Will timeout after 60 seconds of wall-clock time.
Sourcepub async fn wait_for_processed_transactions(
&self,
tx_ids: Vec<Hash>,
) -> Result<Vec<ProcessedTransaction>>
pub async fn wait_for_processed_transactions( &self, tx_ids: Vec<Hash>, ) -> Result<Vec<ProcessedTransaction>>
Waits for multiple transactions to be processed, showing progress with a progress bar Returns a vector of processed transactions in the same order as the input transaction IDs
pub async fn get_transaction_status( &self, tx_ids: Vec<Hash>, ) -> Result<Vec<Result<Status>>>
Sourcepub async fn get_best_block_hash(&self) -> Result<Hash>
pub async fn get_best_block_hash(&self) -> Result<Hash>
Get the best block hash
Sourcepub async fn get_best_finalized_block_hash(&self) -> Result<Hash>
pub async fn get_best_finalized_block_hash(&self) -> Result<Hash>
Get the best finalized block hash
Sourcepub async fn get_block_hash(&self, block_height: u64) -> Result<String>
pub async fn get_block_hash(&self, block_height: u64) -> Result<String>
Get the block hash for a given height
Sourcepub async fn get_block_count(&self) -> Result<u64>
pub async fn get_block_count(&self) -> Result<u64>
Get the current block count
Sourcepub async fn get_block_by_hash(&self, block_hash: &str) -> Result<Option<Block>>
pub async fn get_block_by_hash(&self, block_hash: &str) -> Result<Option<Block>>
Get block by hash with signatures only
Sourcepub async fn get_full_block_by_hash(
&self,
block_hash: &str,
) -> Result<Option<FullBlock>>
pub async fn get_full_block_by_hash( &self, block_hash: &str, ) -> Result<Option<FullBlock>>
Get full block by hash with complete transaction details
Sourcepub async fn get_block_by_height(
&self,
block_height: u64,
) -> Result<Option<Block>>
pub async fn get_block_by_height( &self, block_height: u64, ) -> Result<Option<Block>>
Get block by height with signatures only
Sourcepub async fn get_full_block_by_height(
&self,
block_height: u64,
) -> Result<Option<FullBlock>>
pub async fn get_full_block_by_height( &self, block_height: u64, ) -> Result<Option<FullBlock>>
Get full block by height with complete transaction details
Sourcepub async fn get_account_address(&self, pubkey: &Pubkey) -> Result<String>
pub async fn get_account_address(&self, pubkey: &Pubkey) -> Result<String>
Get account address for a public key
Sourcepub async fn get_program_accounts(
&self,
program_id: &Pubkey,
filters: Option<Vec<AccountFilter>>,
) -> Result<Vec<ProgramAccount>>
pub async fn get_program_accounts( &self, program_id: &Pubkey, filters: Option<Vec<AccountFilter>>, ) -> Result<Vec<ProgramAccount>>
Get program accounts for a given program ID
pub async fn check_pre_anchor_conflict( &self, accounts: Vec<Pubkey>, ) -> Result<bool>
Sourcepub async fn get_network_pubkey(&self) -> Result<String>
pub async fn get_network_pubkey(&self) -> Result<String>
Get the network pubkey from the network
Sourcepub async fn send_transaction(
&self,
transaction: RuntimeTransaction,
) -> Result<Hash>
pub async fn send_transaction( &self, transaction: RuntimeTransaction, ) -> Result<Hash>
Send a single transaction
Sourcepub async fn send_transactions(
&self,
transactions: Vec<RuntimeTransaction>,
) -> Result<Vec<Hash>>
pub async fn send_transactions( &self, transactions: Vec<RuntimeTransaction>, ) -> Result<Vec<Hash>>
Send multiple transactions
Sourcepub fn process_result(&self, response: String) -> Result<Option<Value>>
pub fn process_result(&self, response: String) -> Result<Option<Value>>
Helper methods for RPC communication
pub async fn post_data<T: Serialize + Debug>( &self, method: &str, params: T, ) -> Result<String>
Trait Implementations§
Source§impl Clone for ArchRpcClient
impl Clone for ArchRpcClient
Source§fn clone(&self) -> ArchRpcClient
fn clone(&self) -> ArchRpcClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more