Struct 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§

Source§

impl SolanaClient

Source

pub fn new_with_default(default_rpc: Arc<RpcClient>) -> Self

Creates a new SolanaClient with a default RPC client.

Examples found in repository?
examples/genesysgo.rs (line 16)
11async fn main() {
12    let default_rpc = Arc::new(RpcClient::new(
13        "https://api.mainnet-beta.solana.com".to_string(),
14    ));
15    let genesysgo_rpc = Arc::new(RpcClient::new("<your-genesysgo-rpc-url>".to_string()));
16    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
17        SolanaClientRpc::new(genesysgo_rpc)
18            // Requests per second limit.
19            .add_limit(
20                SolanaClientRateLimit::new(
21                    1000, /* 1 second */
22                    1,    /* 1 request per second */
23                    1,    /* all requests count the same */
24                )
25                // Ignore GetMultipleAccounts requests here to track them in the next limit.
26                .ignore_endpoint(RpcRequest::GetMultipleAccounts),
27            )
28            // Requests per second limit for GetMultipleAccounts.
29            .add_limit(
30                SolanaClientRateLimit::new(
31                    60 * 1000, /* 1 minute */
32                    6,         /* 6 request per minute */
33                    1,         /* all requests count the same */
34                )
35                // Ignore all endpoints and include only GetMultipleAccounts requests here.
36                .ignores_all_endpoints()
37                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 1),
38            ),
39    );
40
41    let version = client.get_version().await.unwrap();
42
43    println!("Cluster version: {}", version.solana_core);
44}
More examples
Hide additional examples
examples/quicknode.rs (line 17)
12async fn main() {
13    let default_rpc = Arc::new(RpcClient::new(
14        "https://api.mainnet-beta.solana.com".to_string(),
15    ));
16    let quicknode_rpc = Arc::new(RpcClient::new("<your-quicknode-rpc-url>".to_string()));
17    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
18        SolanaClientRpc::new(quicknode_rpc)
19            // Credits / month limits.
20            .add_limit(
21                SolanaClientRateLimit::new(
22                    30 * 24 * 60 * 60 * 1000, /* 30 days */
23                    10_000_000,               /* credits per month */
24                    1,                        /* default cost in credits for endpoints */
25                )
26                // List of all endpoints whose credits are different than the default value.
27                .add_endpoint_amount(RpcRequest::GetAccountInfo, 2)
28                .add_endpoint_amount(RpcRequest::GetBlockTime, 2)
29                .add_endpoint_amount(RpcRequest::GetClusterNodes, 2)
30                .add_endpoint_amount(RpcRequest::GetBlock, 23)
31                .add_endpoint_amount(RpcRequest::GetEpochInfo, 2)
32                .add_endpoint_amount(RpcRequest::GetFirstAvailableBlock, 3)
33                .add_endpoint_amount(RpcRequest::GetHealth, 2)
34                .add_endpoint_amount(RpcRequest::GetHighestSnapshotSlot, 2)
35                .add_endpoint_amount(RpcRequest::GetInflationGovernor, 2)
36                .add_endpoint_amount(RpcRequest::GetLatestBlockhash, 2)
37                .add_endpoint_amount(RpcRequest::GetMinimumBalanceForRentExemption, 3)
38                .add_endpoint_amount(RpcRequest::GetProgramAccounts, 35)
39                .add_endpoint_amount(RpcRequest::GetRecentPerformanceSamples, 4)
40                .add_endpoint_amount(RpcRequest::GetSignaturesForAddress, 3)
41                .add_endpoint_amount(RpcRequest::GetTokenSupply, 2)
42                .add_endpoint_amount(RpcRequest::GetTransaction, 3)
43                .add_endpoint_amount(RpcRequest::GetVersion, 2)
44                .add_endpoint_amount(RpcRequest::SimulateTransaction, 4)
45                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 10)
46                .add_endpoint_amount(RpcRequest::GetLargestAccounts, 259),
47            )
48            // Requests / second limit.
49            .add_limit(SolanaClientRateLimit::new(
50                1000, /* 1 second */
51                25,   /* 25 requests per second */
52                1,    /* all requests count the same */
53            )),
54    );
55
56    let version = client.get_version().await.unwrap();
57
58    println!("Cluster version: {}", version.solana_core);
59}
Source

pub fn add_rpc(self, rpc: SolanaClientRpc) -> Self

Adds a new SolanaClientRpc to the RPC list.

Examples found in repository?
examples/genesysgo.rs (lines 16-39)
11async fn main() {
12    let default_rpc = Arc::new(RpcClient::new(
13        "https://api.mainnet-beta.solana.com".to_string(),
14    ));
15    let genesysgo_rpc = Arc::new(RpcClient::new("<your-genesysgo-rpc-url>".to_string()));
16    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
17        SolanaClientRpc::new(genesysgo_rpc)
18            // Requests per second limit.
19            .add_limit(
20                SolanaClientRateLimit::new(
21                    1000, /* 1 second */
22                    1,    /* 1 request per second */
23                    1,    /* all requests count the same */
24                )
25                // Ignore GetMultipleAccounts requests here to track them in the next limit.
26                .ignore_endpoint(RpcRequest::GetMultipleAccounts),
27            )
28            // Requests per second limit for GetMultipleAccounts.
29            .add_limit(
30                SolanaClientRateLimit::new(
31                    60 * 1000, /* 1 minute */
32                    6,         /* 6 request per minute */
33                    1,         /* all requests count the same */
34                )
35                // Ignore all endpoints and include only GetMultipleAccounts requests here.
36                .ignores_all_endpoints()
37                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 1),
38            ),
39    );
40
41    let version = client.get_version().await.unwrap();
42
43    println!("Cluster version: {}", version.solana_core);
44}
More examples
Hide additional examples
examples/quicknode.rs (lines 17-54)
12async fn main() {
13    let default_rpc = Arc::new(RpcClient::new(
14        "https://api.mainnet-beta.solana.com".to_string(),
15    ));
16    let quicknode_rpc = Arc::new(RpcClient::new("<your-quicknode-rpc-url>".to_string()));
17    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
18        SolanaClientRpc::new(quicknode_rpc)
19            // Credits / month limits.
20            .add_limit(
21                SolanaClientRateLimit::new(
22                    30 * 24 * 60 * 60 * 1000, /* 30 days */
23                    10_000_000,               /* credits per month */
24                    1,                        /* default cost in credits for endpoints */
25                )
26                // List of all endpoints whose credits are different than the default value.
27                .add_endpoint_amount(RpcRequest::GetAccountInfo, 2)
28                .add_endpoint_amount(RpcRequest::GetBlockTime, 2)
29                .add_endpoint_amount(RpcRequest::GetClusterNodes, 2)
30                .add_endpoint_amount(RpcRequest::GetBlock, 23)
31                .add_endpoint_amount(RpcRequest::GetEpochInfo, 2)
32                .add_endpoint_amount(RpcRequest::GetFirstAvailableBlock, 3)
33                .add_endpoint_amount(RpcRequest::GetHealth, 2)
34                .add_endpoint_amount(RpcRequest::GetHighestSnapshotSlot, 2)
35                .add_endpoint_amount(RpcRequest::GetInflationGovernor, 2)
36                .add_endpoint_amount(RpcRequest::GetLatestBlockhash, 2)
37                .add_endpoint_amount(RpcRequest::GetMinimumBalanceForRentExemption, 3)
38                .add_endpoint_amount(RpcRequest::GetProgramAccounts, 35)
39                .add_endpoint_amount(RpcRequest::GetRecentPerformanceSamples, 4)
40                .add_endpoint_amount(RpcRequest::GetSignaturesForAddress, 3)
41                .add_endpoint_amount(RpcRequest::GetTokenSupply, 2)
42                .add_endpoint_amount(RpcRequest::GetTransaction, 3)
43                .add_endpoint_amount(RpcRequest::GetVersion, 2)
44                .add_endpoint_amount(RpcRequest::SimulateTransaction, 4)
45                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 10)
46                .add_endpoint_amount(RpcRequest::GetLargestAccounts, 259),
47            )
48            // Requests / second limit.
49            .add_limit(SolanaClientRateLimit::new(
50                1000, /* 1 second */
51                25,   /* 25 requests per second */
52                1,    /* all requests count the same */
53            )),
54    );
55
56    let version = client.get_version().await.unwrap();
57
58    println!("Cluster version: {}", version.solana_core);
59}
Source

pub fn set_move_rpc_index(self, move_index: bool) -> Self

Whether the index must move forward when an RPC cannot be used.

Source

pub async fn send_and_confirm_transaction( &self, transaction: &impl SerializableTransaction, ) -> Result<Signature>

Source

pub async fn send_and_confirm_transaction_with_spinner( &self, transaction: &impl SerializableTransaction, ) -> Result<Signature>

Source

pub async fn send_and_confirm_transaction_with_spinner_and_commitment( &self, transaction: &impl SerializableTransaction, commitment: CommitmentConfig, ) -> Result<Signature>

Source

pub async fn send_and_confirm_transaction_with_spinner_and_config( &self, transaction: &impl SerializableTransaction, commitment: CommitmentConfig, config: RpcSendTransactionConfig, ) -> Result<Signature>

Source

pub async fn send_transaction( &self, transaction: &impl SerializableTransaction, ) -> Result<Signature>

Source

pub async fn send_transaction_with_config( &self, transaction: &impl SerializableTransaction, config: RpcSendTransactionConfig, ) -> Result<Signature>

Source

pub async fn confirm_transaction(&self, signature: &Signature) -> Result<bool>

Source

pub async fn confirm_transaction_with_commitment( &self, signature: &Signature, commitment_config: CommitmentConfig, ) -> RpcResult<bool>

Source

pub async fn confirm_transaction_with_spinner( &self, signature: &Signature, recent_blockhash: &Hash, commitment: CommitmentConfig, ) -> Result<()>

Source

pub async fn simulate_transaction( &self, transaction: &impl SerializableTransaction, ) -> RpcResult<RpcSimulateTransactionResult>

Source

pub async fn simulate_transaction_with_config( &self, transaction: &impl SerializableTransaction, config: RpcSimulateTransactionConfig, ) -> RpcResult<RpcSimulateTransactionResult>

Source

pub async fn get_highest_snapshot_slot(&self) -> Result<RpcSnapshotSlotInfo>

Source

pub async fn get_signature_status( &self, signature: &Signature, ) -> Result<Option<Result<()>>>

Source

pub async fn get_signature_statuses( &self, signatures: &[Signature], ) -> RpcResult<Vec<Option<TransactionStatus>>>

Source

pub async fn get_signature_statuses_with_history( &self, signatures: &[Signature], ) -> RpcResult<Vec<Option<TransactionStatus>>>

Source

pub async fn get_signature_status_with_commitment( &self, signature: &Signature, commitment_config: CommitmentConfig, ) -> Result<Option<Result<()>>>

Source

pub async fn get_signature_status_with_commitment_and_history( &self, signature: &Signature, commitment_config: CommitmentConfig, search_transaction_history: bool, ) -> Result<Option<Result<()>>>

Source

pub async fn get_slot(&self) -> Result<Slot>

Source

pub async fn get_slot_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<Slot>

Source

pub async fn get_block_height(&self) -> Result<u64>

Source

pub async fn get_block_height_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<u64>

Source

pub async fn get_slot_leaders( &self, start_slot: Slot, limit: u64, ) -> Result<Vec<Pubkey>>

Source

pub async fn get_block_production(&self) -> RpcResult<RpcBlockProduction>

Source

pub async fn get_block_production_with_config( &self, config: RpcBlockProductionConfig, ) -> RpcResult<RpcBlockProduction>

Source

pub async fn get_stake_activation( &self, stake_account: Pubkey, epoch: Option<Epoch>, ) -> Result<RpcStakeActivation>

Source

pub async fn supply(&self) -> RpcResult<RpcSupply>

Source

pub async fn supply_with_commitment( &self, commitment_config: CommitmentConfig, ) -> RpcResult<RpcSupply>

Source

pub async fn get_largest_accounts_with_config( &self, config: RpcLargestAccountsConfig, ) -> RpcResult<Vec<RpcAccountBalance>>

Source

pub async fn get_vote_accounts(&self) -> Result<RpcVoteAccountStatus>

Source

pub async fn get_vote_accounts_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<RpcVoteAccountStatus>

Source

pub async fn get_vote_accounts_with_config( &self, config: RpcGetVoteAccountsConfig, ) -> Result<RpcVoteAccountStatus>

Source

pub async fn wait_for_max_stake( &self, commitment: CommitmentConfig, max_stake_percent: f32, ) -> Result<()>

Source

pub async fn get_cluster_nodes(&self) -> Result<Vec<RpcContactInfo>>

Source

pub async fn get_block(&self, slot: Slot) -> Result<EncodedConfirmedBlock>

Source

pub async fn get_block_with_encoding( &self, slot: Slot, encoding: UiTransactionEncoding, ) -> Result<EncodedConfirmedBlock>

Source

pub async fn get_block_with_config( &self, slot: Slot, config: RpcBlockConfig, ) -> Result<UiConfirmedBlock>

Source

pub async fn get_blocks( &self, start_slot: Slot, end_slot: Option<Slot>, ) -> Result<Vec<Slot>>

Source

pub async fn get_blocks_with_commitment( &self, start_slot: Slot, end_slot: Option<Slot>, commitment_config: CommitmentConfig, ) -> Result<Vec<Slot>>

Source

pub async fn get_blocks_with_limit( &self, start_slot: Slot, limit: usize, ) -> Result<Vec<Slot>>

Source

pub async fn get_blocks_with_limit_and_commitment( &self, start_slot: Slot, limit: usize, commitment_config: CommitmentConfig, ) -> Result<Vec<Slot>>

Source

pub async fn get_signatures_for_address( &self, address: &Pubkey, ) -> Result<Vec<RpcConfirmedTransactionStatusWithSignature>>

Source

pub async fn get_signatures_for_address_with_config( &self, address: &Pubkey, config: GetConfirmedSignaturesForAddress2Config, ) -> Result<Vec<RpcConfirmedTransactionStatusWithSignature>>

Source

pub async fn get_transaction( &self, signature: &Signature, encoding: UiTransactionEncoding, ) -> Result<EncodedConfirmedTransactionWithStatusMeta>

Source

pub async fn get_transaction_with_config( &self, signature: &Signature, config: RpcTransactionConfig, ) -> Result<EncodedConfirmedTransactionWithStatusMeta>

Source

pub async fn get_block_time(&self, slot: Slot) -> Result<UnixTimestamp>

Source

pub async fn get_epoch_info(&self) -> Result<EpochInfo>

Source

pub async fn get_epoch_info_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<EpochInfo>

Source

pub async fn get_leader_schedule( &self, slot: Option<Slot>, ) -> Result<Option<RpcLeaderSchedule>>

Source

pub async fn get_leader_schedule_with_commitment( &self, slot: Option<Slot>, commitment_config: CommitmentConfig, ) -> Result<Option<RpcLeaderSchedule>>

Source

pub async fn get_leader_schedule_with_config( &self, slot: Option<Slot>, config: RpcLeaderScheduleConfig, ) -> Result<Option<RpcLeaderSchedule>>

Source

pub async fn get_epoch_schedule(&self) -> Result<EpochSchedule>

Source

pub async fn get_recent_performance_samples( &self, limit: Option<usize>, ) -> Result<Vec<RpcPerfSample>>

Source

pub async fn get_identity(&self) -> Result<Pubkey>

Source

pub async fn get_inflation_governor(&self) -> Result<RpcInflationGovernor>

Source

pub async fn get_inflation_rate(&self) -> Result<RpcInflationRate>

Source

pub async fn get_inflation_reward( &self, addresses: &[Pubkey], epoch: Option<Epoch>, ) -> Result<Vec<Option<RpcInflationReward>>>

Source

pub async fn get_version(&self) -> Result<RpcVersionInfo>

Examples found in repository?
examples/genesysgo.rs (line 41)
11async fn main() {
12    let default_rpc = Arc::new(RpcClient::new(
13        "https://api.mainnet-beta.solana.com".to_string(),
14    ));
15    let genesysgo_rpc = Arc::new(RpcClient::new("<your-genesysgo-rpc-url>".to_string()));
16    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
17        SolanaClientRpc::new(genesysgo_rpc)
18            // Requests per second limit.
19            .add_limit(
20                SolanaClientRateLimit::new(
21                    1000, /* 1 second */
22                    1,    /* 1 request per second */
23                    1,    /* all requests count the same */
24                )
25                // Ignore GetMultipleAccounts requests here to track them in the next limit.
26                .ignore_endpoint(RpcRequest::GetMultipleAccounts),
27            )
28            // Requests per second limit for GetMultipleAccounts.
29            .add_limit(
30                SolanaClientRateLimit::new(
31                    60 * 1000, /* 1 minute */
32                    6,         /* 6 request per minute */
33                    1,         /* all requests count the same */
34                )
35                // Ignore all endpoints and include only GetMultipleAccounts requests here.
36                .ignores_all_endpoints()
37                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 1),
38            ),
39    );
40
41    let version = client.get_version().await.unwrap();
42
43    println!("Cluster version: {}", version.solana_core);
44}
More examples
Hide additional examples
examples/quicknode.rs (line 56)
12async fn main() {
13    let default_rpc = Arc::new(RpcClient::new(
14        "https://api.mainnet-beta.solana.com".to_string(),
15    ));
16    let quicknode_rpc = Arc::new(RpcClient::new("<your-quicknode-rpc-url>".to_string()));
17    let client = SolanaClient::new_with_default(default_rpc).add_rpc(
18        SolanaClientRpc::new(quicknode_rpc)
19            // Credits / month limits.
20            .add_limit(
21                SolanaClientRateLimit::new(
22                    30 * 24 * 60 * 60 * 1000, /* 30 days */
23                    10_000_000,               /* credits per month */
24                    1,                        /* default cost in credits for endpoints */
25                )
26                // List of all endpoints whose credits are different than the default value.
27                .add_endpoint_amount(RpcRequest::GetAccountInfo, 2)
28                .add_endpoint_amount(RpcRequest::GetBlockTime, 2)
29                .add_endpoint_amount(RpcRequest::GetClusterNodes, 2)
30                .add_endpoint_amount(RpcRequest::GetBlock, 23)
31                .add_endpoint_amount(RpcRequest::GetEpochInfo, 2)
32                .add_endpoint_amount(RpcRequest::GetFirstAvailableBlock, 3)
33                .add_endpoint_amount(RpcRequest::GetHealth, 2)
34                .add_endpoint_amount(RpcRequest::GetHighestSnapshotSlot, 2)
35                .add_endpoint_amount(RpcRequest::GetInflationGovernor, 2)
36                .add_endpoint_amount(RpcRequest::GetLatestBlockhash, 2)
37                .add_endpoint_amount(RpcRequest::GetMinimumBalanceForRentExemption, 3)
38                .add_endpoint_amount(RpcRequest::GetProgramAccounts, 35)
39                .add_endpoint_amount(RpcRequest::GetRecentPerformanceSamples, 4)
40                .add_endpoint_amount(RpcRequest::GetSignaturesForAddress, 3)
41                .add_endpoint_amount(RpcRequest::GetTokenSupply, 2)
42                .add_endpoint_amount(RpcRequest::GetTransaction, 3)
43                .add_endpoint_amount(RpcRequest::GetVersion, 2)
44                .add_endpoint_amount(RpcRequest::SimulateTransaction, 4)
45                .add_endpoint_amount(RpcRequest::GetMultipleAccounts, 10)
46                .add_endpoint_amount(RpcRequest::GetLargestAccounts, 259),
47            )
48            // Requests / second limit.
49            .add_limit(SolanaClientRateLimit::new(
50                1000, /* 1 second */
51                25,   /* 25 requests per second */
52                1,    /* all requests count the same */
53            )),
54    );
55
56    let version = client.get_version().await.unwrap();
57
58    println!("Cluster version: {}", version.solana_core);
59}
Source

pub async fn minimum_ledger_slot(&self) -> Result<Slot>

Source

pub async fn get_account(&self, pubkey: &Pubkey) -> Result<Account>

Source

pub async fn get_account_with_commitment( &self, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> RpcResult<Option<Account>>

Source

pub async fn get_account_with_config( &self, pubkey: &Pubkey, config: RpcAccountInfoConfig, ) -> RpcResult<Option<Account>>

Source

pub async fn get_max_retransmit_slot(&self) -> Result<Slot>

Source

pub async fn get_max_shred_insert_slot(&self) -> Result<Slot>

Source

pub async fn get_multiple_accounts( &self, pubkeys: &[Pubkey], ) -> Result<Vec<Option<Account>>>

Source

pub async fn get_multiple_accounts_with_commitment( &self, pubkeys: &[Pubkey], commitment_config: CommitmentConfig, ) -> RpcResult<Vec<Option<Account>>>

Source

pub async fn get_multiple_accounts_with_config( &self, pubkeys: &[Pubkey], config: RpcAccountInfoConfig, ) -> RpcResult<Vec<Option<Account>>>

Source

pub async fn get_account_data(&self, pubkey: &Pubkey) -> Result<Vec<u8>>

Source

pub async fn get_minimum_balance_for_rent_exemption( &self, data_len: usize, ) -> Result<u64>

Source

pub async fn get_balance(&self, pubkey: &Pubkey) -> Result<u64>

Source

pub async fn get_balance_with_commitment( &self, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> RpcResult<u64>

Source

pub async fn get_program_accounts( &self, pubkey: &Pubkey, ) -> Result<Vec<(Pubkey, Account)>>

Source

pub async fn get_program_accounts_with_config( &self, pubkey: &Pubkey, config: RpcProgramAccountsConfig, ) -> Result<Vec<(Pubkey, Account)>>

Source

pub async fn get_stake_minimum_delegation(&self) -> Result<u64>

Source

pub async fn get_stake_minimum_delegation_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<u64>

Source

pub async fn get_transaction_count(&self) -> Result<u64>

Request the transaction count.

Source

pub async fn get_transaction_count_with_commitment( &self, commitment_config: CommitmentConfig, ) -> Result<u64>

Source

pub async fn get_first_available_block(&self) -> Result<Slot>

Source

pub async fn get_genesis_hash(&self) -> Result<Hash>

Source

pub async fn get_health(&self) -> Result<()>

Source

pub async fn get_token_account( &self, pubkey: &Pubkey, ) -> Result<Option<UiTokenAccount>>

Source

pub async fn get_token_account_with_commitment( &self, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> RpcResult<Option<UiTokenAccount>>

Source

pub async fn get_token_account_balance( &self, pubkey: &Pubkey, ) -> Result<UiTokenAmount>

Source

pub async fn get_token_account_balance_with_commitment( &self, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> RpcResult<UiTokenAmount>

Source

pub async fn get_token_accounts_by_delegate( &self, delegate: &Pubkey, token_account_filter: TokenAccountsFilter, ) -> Result<Vec<RpcKeyedAccount>>

Source

pub async fn get_token_accounts_by_delegate_with_commitment( &self, delegate: &Pubkey, token_account_filter: TokenAccountsFilter, commitment_config: CommitmentConfig, ) -> RpcResult<Vec<RpcKeyedAccount>>

Source

pub async fn get_token_accounts_by_owner( &self, owner: &Pubkey, token_account_filter: TokenAccountsFilter, ) -> Result<Vec<RpcKeyedAccount>>

Source

pub async fn get_token_accounts_by_owner_with_commitment( &self, owner: &Pubkey, token_account_filter: TokenAccountsFilter, commitment_config: CommitmentConfig, ) -> RpcResult<Vec<RpcKeyedAccount>>

Source

pub async fn get_token_supply(&self, mint: &Pubkey) -> Result<UiTokenAmount>

Source

pub async fn get_token_supply_with_commitment( &self, mint: &Pubkey, commitment_config: CommitmentConfig, ) -> RpcResult<UiTokenAmount>

Source

pub async fn request_airdrop( &self, pubkey: &Pubkey, lamports: u64, ) -> Result<Signature>

Source

pub async fn request_airdrop_with_blockhash( &self, pubkey: &Pubkey, lamports: u64, recent_blockhash: &Hash, ) -> Result<Signature>

Source

pub async fn request_airdrop_with_config( &self, pubkey: &Pubkey, lamports: u64, config: RpcRequestAirdropConfig, ) -> Result<Signature>

Source

pub async fn poll_get_balance_with_commitment( &self, pubkey: &Pubkey, commitment_config: CommitmentConfig, ) -> Result<u64>

Source

pub async fn wait_for_balance_with_commitment( &self, pubkey: &Pubkey, expected_balance: Option<u64>, commitment_config: CommitmentConfig, ) -> Result<u64>

Source

pub async fn poll_for_signature(&self, signature: &Signature) -> Result<()>

Poll the server to confirm a transaction.

Source

pub async fn poll_for_signature_with_commitment( &self, signature: &Signature, commitment_config: CommitmentConfig, ) -> Result<()>

Poll the server to confirm a transaction.

Source

pub async fn poll_for_signature_confirmation( &self, signature: &Signature, min_confirmed_blocks: usize, ) -> Result<usize>

Poll the server to confirm a transaction.

Source

pub async fn get_num_blocks_since_signature_confirmation( &self, signature: &Signature, ) -> Result<usize>

Source

pub async fn get_latest_blockhash(&self) -> Result<Hash>

Source

pub async fn get_latest_blockhash_with_commitment( &self, commitment: CommitmentConfig, ) -> Result<(Hash, u64)>

Source

pub async fn is_blockhash_valid( &self, blockhash: &Hash, commitment: CommitmentConfig, ) -> Result<bool>

Source

pub async fn get_fee_for_message( &self, message: &impl SerializableMessage, ) -> Result<u64>

Source

pub async fn get_new_latest_blockhash(&self, blockhash: &Hash) -> Result<Hash>

Source

pub async fn send<T>(&self, request: RpcRequest, params: Value) -> Result<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,