pub struct SolanaProvider { /* private fields */ }Implementations§
Source§impl SolanaProvider
impl SolanaProvider
pub fn new(config: ProviderConfig) -> Result<Self, ProviderError>
Sourcepub fn new_with_commitment_and_health(
configs: Vec<RpcConfig>,
timeout_seconds: u64,
commitment: CommitmentConfig,
failure_threshold: u32,
pause_duration_secs: u64,
failure_expiration_secs: u64,
) -> Result<Self, ProviderError>
pub fn new_with_commitment_and_health( configs: Vec<RpcConfig>, timeout_seconds: u64, commitment: CommitmentConfig, failure_threshold: u32, pause_duration_secs: u64, failure_expiration_secs: u64, ) -> Result<Self, ProviderError>
Creates a new SolanaProvider with RPC configurations and optional settings.
§Arguments
configs- A vector of RPC configurationstimeout- Optional custom timeoutcommitment- Optional custom commitment levelfailure_threshold- Number of consecutive failures before pausing a providerpause_duration_secs- Duration in seconds to pause a provider after reaching failure thresholdfailure_expiration_secs- Duration in seconds after which failures are considered stale
§Returns
A Result containing the provider or an error
Sourcepub fn get_configs(&self) -> Vec<RpcConfig>
pub fn get_configs(&self) -> Vec<RpcConfig>
Trait Implementations§
Source§impl Debug for SolanaProvider
impl Debug for SolanaProvider
Source§impl SolanaProviderTrait for SolanaProvider
impl SolanaProviderTrait for SolanaProvider
Source§fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
address: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the balance (in lamports) for the given address.
§Errors
Returns ProviderError::InvalidAddress if address parsing fails,
and ProviderError::RpcError if the RPC call fails.
Source§fn is_blockhash_valid<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
commitment: CommitmentConfig,
) -> Pin<Box<dyn Future<Output = Result<bool, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_blockhash_valid<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
commitment: CommitmentConfig,
) -> Pin<Box<dyn Future<Output = Result<bool, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a blockhash is valid
Source§fn get_latest_blockhash<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Hash, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_blockhash<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Hash, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the latest blockhash.
Source§fn send_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<Signature, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<Signature, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a transaction to the network.
Source§fn send_versioned_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 VersionedTransaction,
) -> Pin<Box<dyn Future<Output = Result<Signature, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_versioned_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 VersionedTransaction,
) -> Pin<Box<dyn Future<Output = Result<Signature, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a transaction to the network.
Source§fn confirm_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
signature: &'life1 Signature,
) -> Pin<Box<dyn Future<Output = Result<bool, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn confirm_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
signature: &'life1 Signature,
) -> Pin<Box<dyn Future<Output = Result<bool, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Confirms the given transaction signature.
Source§fn get_minimum_balance_for_rent_exemption<'life0, 'async_trait>(
&'life0 self,
data_size: usize,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_minimum_balance_for_rent_exemption<'life0, 'async_trait>(
&'life0 self,
data_size: usize,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the minimum balance for rent exemption for the given data size.
Source§fn simulate_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<RpcSimulateTransactionResult, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn simulate_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction: &'life1 Transaction,
) -> Pin<Box<dyn Future<Output = Result<RpcSimulateTransactionResult, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Simulate transaction.
Source§fn get_account_from_str<'life0, 'life1, 'async_trait>(
&'life0 self,
account: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Account, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_account_from_str<'life0, 'life1, 'async_trait>(
&'life0 self,
account: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Account, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves account data for the given account string.
Source§fn get_account_from_pubkey<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkey: &'life1 Pubkey,
) -> Pin<Box<dyn Future<Output = Result<Account, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_account_from_pubkey<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkey: &'life1 Pubkey,
) -> Pin<Box<dyn Future<Output = Result<Account, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves account data for the given pubkey.
Source§fn get_token_metadata_from_pubkey<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TokenMetadata, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_token_metadata_from_pubkey<'life0, 'life1, 'async_trait>(
&'life0 self,
pubkey: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TokenMetadata, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves token metadata from a provided mint address.
Source§fn get_fee_for_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_fee_for_message<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the fee for a message
Source§fn raw_request_dyn<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn raw_request_dyn<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a raw JSON-RPC request to the Solana node
fn get_configs(&self) -> Vec<RpcConfig>
fn get_latest_blockhash_with_commitment<'life0, 'async_trait>(
&'life0 self,
commitment: CommitmentConfig,
) -> Pin<Box<dyn Future<Output = Result<(Hash, u64), SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_recent_prioritization_fees<'life0, 'life1, 'async_trait>(
&'life0 self,
addresses: &'life1 [Pubkey],
) -> Pin<Box<dyn Future<Output = Result<Vec<RpcPrioritizationFee>, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_recent_prioritization_fees<'life0, 'life1, 'async_trait>(
&'life0 self,
addresses: &'life1 [Pubkey],
) -> Pin<Box<dyn Future<Output = Result<Vec<RpcPrioritizationFee>, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn calculate_total_fee<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn calculate_total_fee<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Result<u64, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_transaction_status<'life0, 'life1, 'async_trait>(
&'life0 self,
signature: &'life1 Signature,
) -> Pin<Box<dyn Future<Output = Result<SolanaTransactionStatus, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_transaction_status<'life0, 'life1, 'async_trait>(
&'life0 self,
signature: &'life1 Signature,
) -> Pin<Box<dyn Future<Output = Result<SolanaTransactionStatus, SolanaProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for SolanaProvider
impl !RefUnwindSafe for SolanaProvider
impl Send for SolanaProvider
impl Sync for SolanaProvider
impl Unpin for SolanaProvider
impl !UnwindSafe for SolanaProvider
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more