Struct solana_balanced_client::SolanaClient
source · pub struct SolanaClient {
pub inner: Mutex<SolanaClientInner>,
}
Expand description
An asynchronous Solana client that can manage multiple RPC clients, each of them with its own limits and configuration.
Fields
inner: Mutex<SolanaClientInner>
Implementations
sourceimpl SolanaClient
impl SolanaClient
sourcepub fn new_with_default(default_rpc: Arc<RpcClient>) -> Self
pub fn new_with_default(default_rpc: Arc<RpcClient>) -> Self
Creates a new SolanaClient
with a default RPC client.
sourcepub fn add_rpc(self, rpc: SolanaClientRpc) -> Self
pub fn add_rpc(self, rpc: SolanaClientRpc) -> Self
Adds a new SolanaClientRpc
to the RPC list.
sourcepub fn set_move_rpc_index(self, move_index: bool) -> Self
pub fn set_move_rpc_index(self, move_index: bool) -> Self
Whether the index must move forward when an RPC cannot be used.
pub async fn send_and_confirm_transaction(
&self,
transaction: &impl SerializableTransaction
) -> Result<Signature>
pub async fn send_and_confirm_transaction_with_spinner(
&self,
transaction: &impl SerializableTransaction
) -> Result<Signature>
pub async fn send_and_confirm_transaction_with_spinner_and_commitment(
&self,
transaction: &impl SerializableTransaction,
commitment: CommitmentConfig
) -> Result<Signature>
pub async fn send_and_confirm_transaction_with_spinner_and_config(
&self,
transaction: &impl SerializableTransaction,
commitment: CommitmentConfig,
config: RpcSendTransactionConfig
) -> Result<Signature>
pub async fn send_transaction(
&self,
transaction: &impl SerializableTransaction
) -> Result<Signature>
pub async fn send_transaction_with_config(
&self,
transaction: &impl SerializableTransaction,
config: RpcSendTransactionConfig
) -> Result<Signature>
pub async fn confirm_transaction(&self, signature: &Signature) -> Result<bool>
pub async fn confirm_transaction_with_commitment(
&self,
signature: &Signature,
commitment_config: CommitmentConfig
) -> RpcResult<bool>
pub async fn confirm_transaction_with_spinner(
&self,
signature: &Signature,
recent_blockhash: &Hash,
commitment: CommitmentConfig
) -> Result<()>
pub async fn simulate_transaction(
&self,
transaction: &impl SerializableTransaction
) -> RpcResult<RpcSimulateTransactionResult>
pub async fn simulate_transaction_with_config(
&self,
transaction: &impl SerializableTransaction,
config: RpcSimulateTransactionConfig
) -> RpcResult<RpcSimulateTransactionResult>
pub async fn get_highest_snapshot_slot(&self) -> Result<RpcSnapshotSlotInfo>
pub async fn get_signature_status(
&self,
signature: &Signature
) -> Result<Option<Result<()>>>
pub async fn get_signature_statuses(
&self,
signatures: &[Signature]
) -> RpcResult<Vec<Option<TransactionStatus>>>
pub async fn get_signature_statuses_with_history(
&self,
signatures: &[Signature]
) -> RpcResult<Vec<Option<TransactionStatus>>>
pub async fn get_signature_status_with_commitment(
&self,
signature: &Signature,
commitment_config: CommitmentConfig
) -> Result<Option<Result<()>>>
pub async fn get_signature_status_with_commitment_and_history(
&self,
signature: &Signature,
commitment_config: CommitmentConfig,
search_transaction_history: bool
) -> Result<Option<Result<()>>>
pub async fn get_slot(&self) -> Result<Slot>
pub async fn get_slot_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<Slot>
pub async fn get_block_height(&self) -> Result<u64>
pub async fn get_block_height_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<u64>
pub async fn get_slot_leaders(
&self,
start_slot: Slot,
limit: u64
) -> Result<Vec<Pubkey>>
pub async fn get_block_production(&self) -> RpcResult<RpcBlockProduction>
pub async fn get_block_production_with_config(
&self,
config: RpcBlockProductionConfig
) -> RpcResult<RpcBlockProduction>
pub async fn get_stake_activation(
&self,
stake_account: Pubkey,
epoch: Option<Epoch>
) -> Result<RpcStakeActivation>
pub async fn supply(&self) -> RpcResult<RpcSupply>
pub async fn supply_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> RpcResult<RpcSupply>
pub async fn get_largest_accounts_with_config(
&self,
config: RpcLargestAccountsConfig
) -> RpcResult<Vec<RpcAccountBalance>>
pub async fn get_vote_accounts(&self) -> Result<RpcVoteAccountStatus>
pub async fn get_vote_accounts_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<RpcVoteAccountStatus>
pub async fn get_vote_accounts_with_config(
&self,
config: RpcGetVoteAccountsConfig
) -> Result<RpcVoteAccountStatus>
pub async fn wait_for_max_stake(
&self,
commitment: CommitmentConfig,
max_stake_percent: f32
) -> Result<()>
pub async fn get_cluster_nodes(&self) -> Result<Vec<RpcContactInfo>>
pub async fn get_block(&self, slot: Slot) -> Result<EncodedConfirmedBlock>
pub async fn get_block_with_encoding(
&self,
slot: Slot,
encoding: UiTransactionEncoding
) -> Result<EncodedConfirmedBlock>
pub async fn get_block_with_config(
&self,
slot: Slot,
config: RpcBlockConfig
) -> Result<UiConfirmedBlock>
pub async fn get_blocks(
&self,
start_slot: Slot,
end_slot: Option<Slot>
) -> Result<Vec<Slot>>
pub async fn get_blocks_with_commitment(
&self,
start_slot: Slot,
end_slot: Option<Slot>,
commitment_config: CommitmentConfig
) -> Result<Vec<Slot>>
pub async fn get_blocks_with_limit(
&self,
start_slot: Slot,
limit: usize
) -> Result<Vec<Slot>>
pub async fn get_blocks_with_limit_and_commitment(
&self,
start_slot: Slot,
limit: usize,
commitment_config: CommitmentConfig
) -> Result<Vec<Slot>>
pub async fn get_signatures_for_address(
&self,
address: &Pubkey
) -> Result<Vec<RpcConfirmedTransactionStatusWithSignature>>
pub async fn get_signatures_for_address_with_config(
&self,
address: &Pubkey,
config: GetConfirmedSignaturesForAddress2Config
) -> Result<Vec<RpcConfirmedTransactionStatusWithSignature>>
pub async fn get_transaction(
&self,
signature: &Signature,
encoding: UiTransactionEncoding
) -> Result<EncodedConfirmedTransactionWithStatusMeta>
pub async fn get_transaction_with_config(
&self,
signature: &Signature,
config: RpcTransactionConfig
) -> Result<EncodedConfirmedTransactionWithStatusMeta>
pub async fn get_block_time(&self, slot: Slot) -> Result<UnixTimestamp>
pub async fn get_epoch_info(&self) -> Result<EpochInfo>
pub async fn get_epoch_info_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<EpochInfo>
pub async fn get_leader_schedule(
&self,
slot: Option<Slot>
) -> Result<Option<RpcLeaderSchedule>>
pub async fn get_leader_schedule_with_commitment(
&self,
slot: Option<Slot>,
commitment_config: CommitmentConfig
) -> Result<Option<RpcLeaderSchedule>>
pub async fn get_leader_schedule_with_config(
&self,
slot: Option<Slot>,
config: RpcLeaderScheduleConfig
) -> Result<Option<RpcLeaderSchedule>>
pub async fn get_epoch_schedule(&self) -> Result<EpochSchedule>
pub async fn get_recent_performance_samples(
&self,
limit: Option<usize>
) -> Result<Vec<RpcPerfSample>>
pub async fn get_identity(&self) -> Result<Pubkey>
pub async fn get_inflation_governor(&self) -> Result<RpcInflationGovernor>
pub async fn get_inflation_rate(&self) -> Result<RpcInflationRate>
pub async fn get_inflation_reward(
&self,
addresses: &[Pubkey],
epoch: Option<Epoch>
) -> Result<Vec<Option<RpcInflationReward>>>
pub async fn get_version(&self) -> Result<RpcVersionInfo>
pub async fn minimum_ledger_slot(&self) -> Result<Slot>
pub async fn get_account(&self, pubkey: &Pubkey) -> Result<Account>
pub async fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig
) -> RpcResult<Option<Account>>
pub async fn get_account_with_config(
&self,
pubkey: &Pubkey,
config: RpcAccountInfoConfig
) -> RpcResult<Option<Account>>
pub async fn get_max_retransmit_slot(&self) -> Result<Slot>
pub async fn get_max_shred_insert_slot(&self) -> Result<Slot>
pub async fn get_multiple_accounts(
&self,
pubkeys: &[Pubkey]
) -> Result<Vec<Option<Account>>>
pub async fn get_multiple_accounts_with_commitment(
&self,
pubkeys: &[Pubkey],
commitment_config: CommitmentConfig
) -> RpcResult<Vec<Option<Account>>>
pub async fn get_multiple_accounts_with_config(
&self,
pubkeys: &[Pubkey],
config: RpcAccountInfoConfig
) -> RpcResult<Vec<Option<Account>>>
pub async fn get_account_data(&self, pubkey: &Pubkey) -> Result<Vec<u8>>
pub async fn get_minimum_balance_for_rent_exemption(
&self,
data_len: usize
) -> Result<u64>
pub async fn get_balance(&self, pubkey: &Pubkey) -> Result<u64>
pub async fn get_balance_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig
) -> RpcResult<u64>
pub async fn get_program_accounts(
&self,
pubkey: &Pubkey
) -> Result<Vec<(Pubkey, Account)>>
pub async fn get_program_accounts_with_config(
&self,
pubkey: &Pubkey,
config: RpcProgramAccountsConfig
) -> Result<Vec<(Pubkey, Account)>>
pub async fn get_stake_minimum_delegation(&self) -> Result<u64>
pub async fn get_stake_minimum_delegation_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<u64>
sourcepub async fn get_transaction_count(&self) -> Result<u64>
pub async fn get_transaction_count(&self) -> Result<u64>
Request the transaction count.
pub async fn get_transaction_count_with_commitment(
&self,
commitment_config: CommitmentConfig
) -> Result<u64>
pub async fn get_first_available_block(&self) -> Result<Slot>
pub async fn get_genesis_hash(&self) -> Result<Hash>
pub async fn get_health(&self) -> Result<()>
pub async fn get_token_account(
&self,
pubkey: &Pubkey
) -> Result<Option<UiTokenAccount>>
pub async fn get_token_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig
) -> RpcResult<Option<UiTokenAccount>>
pub async fn get_token_account_balance(
&self,
pubkey: &Pubkey
) -> Result<UiTokenAmount>
pub async fn get_token_account_balance_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig
) -> RpcResult<UiTokenAmount>
pub async fn get_token_accounts_by_delegate(
&self,
delegate: &Pubkey,
token_account_filter: TokenAccountsFilter
) -> Result<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_delegate_with_commitment(
&self,
delegate: &Pubkey,
token_account_filter: TokenAccountsFilter,
commitment_config: CommitmentConfig
) -> RpcResult<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_owner(
&self,
owner: &Pubkey,
token_account_filter: TokenAccountsFilter
) -> Result<Vec<RpcKeyedAccount>>
pub async fn get_token_accounts_by_owner_with_commitment(
&self,
owner: &Pubkey,
token_account_filter: TokenAccountsFilter,
commitment_config: CommitmentConfig
) -> RpcResult<Vec<RpcKeyedAccount>>
pub async fn get_token_supply(&self, mint: &Pubkey) -> Result<UiTokenAmount>
pub async fn get_token_supply_with_commitment(
&self,
mint: &Pubkey,
commitment_config: CommitmentConfig
) -> RpcResult<UiTokenAmount>
pub async fn request_airdrop(
&self,
pubkey: &Pubkey,
lamports: u64
) -> Result<Signature>
pub async fn request_airdrop_with_blockhash(
&self,
pubkey: &Pubkey,
lamports: u64,
recent_blockhash: &Hash
) -> Result<Signature>
pub async fn request_airdrop_with_config(
&self,
pubkey: &Pubkey,
lamports: u64,
config: RpcRequestAirdropConfig
) -> Result<Signature>
pub async fn poll_get_balance_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig
) -> Result<u64>
pub async fn wait_for_balance_with_commitment(
&self,
pubkey: &Pubkey,
expected_balance: Option<u64>,
commitment_config: CommitmentConfig
) -> Result<u64>
sourcepub async fn poll_for_signature(&self, signature: &Signature) -> Result<()>
pub async fn poll_for_signature(&self, signature: &Signature) -> Result<()>
Poll the server to confirm a transaction.
sourcepub async fn poll_for_signature_with_commitment(
&self,
signature: &Signature,
commitment_config: CommitmentConfig
) -> Result<()>
pub async fn poll_for_signature_with_commitment(
&self,
signature: &Signature,
commitment_config: CommitmentConfig
) -> Result<()>
Poll the server to confirm a transaction.
sourcepub async fn poll_for_signature_confirmation(
&self,
signature: &Signature,
min_confirmed_blocks: usize
) -> Result<usize>
pub async fn poll_for_signature_confirmation(
&self,
signature: &Signature,
min_confirmed_blocks: usize
) -> Result<usize>
Poll the server to confirm a transaction.
pub async fn get_num_blocks_since_signature_confirmation(
&self,
signature: &Signature
) -> Result<usize>
pub async fn get_latest_blockhash(&self) -> Result<Hash>
pub async fn get_latest_blockhash_with_commitment(
&self,
commitment: CommitmentConfig
) -> Result<(Hash, u64)>
pub async fn is_blockhash_valid(
&self,
blockhash: &Hash,
commitment: CommitmentConfig
) -> Result<bool>
pub async fn get_fee_for_message(
&self,
message: &impl SerializableMessage
) -> Result<u64>
pub async fn get_new_latest_blockhash(&self, blockhash: &Hash) -> Result<Hash>
pub async fn send<T>(&self, request: RpcRequest, params: Value) -> Result<T>where
T: DeserializeOwned,
Auto Trait Implementations
impl !RefUnwindSafe for SolanaClient
impl Send for SolanaClient
impl Sync for SolanaClient
impl Unpin for SolanaClient
impl !UnwindSafe for SolanaClient
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more