pub struct VaultV1TransactionClient { /* private fields */ }Expand description
Client for executing transactions against V1 (MetaMorpho) vaults.
Implementations§
Source§impl VaultV1TransactionClient
impl VaultV1TransactionClient
Sourcepub fn new(
rpc_url: &str,
private_key: &str,
) -> Result<VaultV1TransactionClient, ContractError>
pub fn new( rpc_url: &str, private_key: &str, ) -> Result<VaultV1TransactionClient, ContractError>
Create a new V1 transaction client.
Sourcepub async fn get_asset(&self, vault: Address) -> Result<Address, ContractError>
pub async fn get_asset(&self, vault: Address) -> Result<Address, ContractError>
Get the underlying asset address of a vault.
Sourcepub async fn get_decimals(&self, token: Address) -> Result<u8, ContractError>
pub async fn get_decimals(&self, token: Address) -> Result<u8, ContractError>
Get the decimals of a token.
Sourcepub async fn get_balance(
&self,
token: Address,
owner: Address,
) -> Result<Uint<256, 4>, ContractError>
pub async fn get_balance( &self, token: Address, owner: Address, ) -> Result<Uint<256, 4>, ContractError>
Get the balance of a token for an address.
Sourcepub async fn get_allowance(
&self,
token: Address,
owner: Address,
spender: Address,
) -> Result<Uint<256, 4>, ContractError>
pub async fn get_allowance( &self, token: Address, owner: Address, spender: Address, ) -> Result<Uint<256, 4>, ContractError>
Get the allowance of a token for a spender.
Sourcepub fn approve(
&self,
token: Address,
spender: Address,
amount: Uint<256, 4>,
) -> PreparedCall<'_, approveCall>
pub fn approve( &self, token: Address, spender: Address, amount: Uint<256, 4>, ) -> PreparedCall<'_, approveCall>
Create a prepared approval transaction.
Returns a PreparedCall that can be sent or used with MulticallBuilder.
Sourcepub async fn approve_if_needed(
&self,
token: Address,
spender: Address,
amount: Uint<256, 4>,
) -> Result<Option<PreparedCall<'_, approveCall>>, ContractError>
pub async fn approve_if_needed( &self, token: Address, spender: Address, amount: Uint<256, 4>, ) -> Result<Option<PreparedCall<'_, approveCall>>, ContractError>
Approve a spender to use tokens if needed.
Returns a PreparedCall if approval is needed, None otherwise.
Sourcepub fn deposit(
&self,
vault: Address,
amount: Uint<256, 4>,
receiver: Address,
) -> PreparedCall<'_, depositCall>
pub fn deposit( &self, vault: Address, amount: Uint<256, 4>, receiver: Address, ) -> PreparedCall<'_, depositCall>
Create a prepared deposit transaction.
Returns a PreparedCall that can be sent or used with MulticallBuilder.
Sourcepub fn withdraw(
&self,
vault: Address,
amount: Uint<256, 4>,
receiver: Address,
owner: Address,
) -> PreparedCall<'_, withdrawCall>
pub fn withdraw( &self, vault: Address, amount: Uint<256, 4>, receiver: Address, owner: Address, ) -> PreparedCall<'_, withdrawCall>
Create a prepared withdraw transaction.
Returns a PreparedCall that can be sent or used with MulticallBuilder.
Sourcepub fn signer_address(&self) -> Address
pub fn signer_address(&self) -> Address
Get the signer’s address.
Auto Trait Implementations§
impl Freeze for VaultV1TransactionClient
impl !RefUnwindSafe for VaultV1TransactionClient
impl Send for VaultV1TransactionClient
impl Sync for VaultV1TransactionClient
impl Unpin for VaultV1TransactionClient
impl !UnwindSafe for VaultV1TransactionClient
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
Mutably borrows from an owned value. Read more
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>
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 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>
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