pub struct EvmWallet { /* private fields */ }
Implementations§
Source§impl Wallet
impl Wallet
Sourcepub fn new(network: Network, wallet: EthereumWallet) -> Wallet
pub fn new(network: Network, wallet: EthereumWallet) -> Wallet
Creates a new Wallet object with the specific Network and EthereumWallet.
Sourcepub fn new_with_random_wallet(network: Network) -> Wallet
pub fn new_with_random_wallet(network: Network) -> Wallet
Convenience function that creates a new Wallet with a random EthereumWallet.
Sourcepub fn new_from_private_key(
network: Network,
private_key: &str,
) -> Result<Wallet, Error>
pub fn new_from_private_key( network: Network, private_key: &str, ) -> Result<Wallet, Error>
Creates a new Wallet based on the given Ethereum private key. It will fail with Error::PrivateKeyInvalid if private_key is invalid.
Sourcepub async fn balance_of_tokens(&self) -> Result<Uint<256, 4>, Error>
pub async fn balance_of_tokens(&self) -> Result<Uint<256, 4>, Error>
Returns the raw balance of payment tokens for this wallet.
Sourcepub async fn balance_of_gas_tokens(&self) -> Result<Uint<256, 4>, Error>
pub async fn balance_of_gas_tokens(&self) -> Result<Uint<256, 4>, Error>
Returns the raw balance of gas tokens for this wallet.
Sourcepub async fn transfer_tokens(
&self,
to: Address,
amount: Uint<256, 4>,
) -> Result<FixedBytes<32>, Error>
pub async fn transfer_tokens( &self, to: Address, amount: Uint<256, 4>, ) -> Result<FixedBytes<32>, Error>
Transfer a raw amount of payment tokens to another address.
Sourcepub async fn transfer_gas_tokens(
&self,
to: Address,
amount: Uint<256, 4>,
) -> Result<FixedBytes<32>, Error>
pub async fn transfer_gas_tokens( &self, to: Address, amount: Uint<256, 4>, ) -> Result<FixedBytes<32>, Error>
Transfer a raw amount of gas tokens to another address.
Sourcepub async fn token_allowance(
&self,
spender: Address,
) -> Result<Uint<256, 4>, Error>
pub async fn token_allowance( &self, spender: Address, ) -> Result<Uint<256, 4>, Error>
See how many tokens of the owner may be spent by the spender.
Sourcepub async fn approve_to_spend_tokens(
&self,
spender: Address,
amount: Uint<256, 4>,
) -> Result<FixedBytes<32>, Error>
pub async fn approve_to_spend_tokens( &self, spender: Address, amount: Uint<256, 4>, ) -> Result<FixedBytes<32>, Error>
Approve an address / smart contract to spend this wallet’s payment tokens.
Sourcepub async fn pay_for_quotes<I>(
&self,
quote_payments: I,
) -> Result<BTreeMap<FixedBytes<32>, FixedBytes<32>>, PayForQuotesError>
pub async fn pay_for_quotes<I>( &self, quote_payments: I, ) -> Result<BTreeMap<FixedBytes<32>, FixedBytes<32>>, PayForQuotesError>
Function for batch payments of quotes. It accepts an iterator of QuotePayment and returns transaction hashes of the payments by quotes.
Sourcepub fn to_provider(
&self,
) -> FillProvider<JoinFill<JoinFill<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, NonceFiller<SimpleNonceManager>>, WalletFiller<EthereumWallet>>, RootProvider>
pub fn to_provider( &self, ) -> FillProvider<JoinFill<JoinFill<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, NonceFiller<SimpleNonceManager>>, WalletFiller<EthereumWallet>>, RootProvider>
Build a provider using this wallet.
Sourcepub async fn lock(&self) -> MutexGuard<'_, ()>
pub async fn lock(&self) -> MutexGuard<'_, ()>
Lock the wallet to prevent concurrent use. Drop the guard to unlock the wallet.
Sourcepub fn random_private_key() -> String
pub fn random_private_key() -> String
Returns a random private key string.
Sourcepub fn set_transaction_config(&mut self, config: TransactionConfig)
pub fn set_transaction_config(&mut self, config: TransactionConfig)
Sets the transaction configuration for the wallet.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Wallet
impl !RefUnwindSafe for Wallet
impl Send for Wallet
impl Sync for Wallet
impl Unpin for Wallet
impl !UnwindSafe for Wallet
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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