pub struct TxClient { /* private fields */ }Expand description
TxClient - High-level client for sending Altius transactions
Implementations§
Source§impl TxClient
impl TxClient
Sourcepub fn new(private_key: &str, rpc_url: &str, fee_token: &str) -> Result<Self>
pub fn new(private_key: &str, rpc_url: &str, fee_token: &str) -> Result<Self>
Create a new transaction client
Sourcepub async fn build_erc20_transfer(
&mut self,
token: Address,
recipient: Address,
amount: U256,
) -> Result<TxBuilder>
pub async fn build_erc20_transfer( &mut self, token: Address, recipient: Address, amount: U256, ) -> Result<TxBuilder>
Build an ERC20 transfer transaction
Sourcepub async fn sign(&mut self, tx: TxBuilder) -> Result<SignedTx>
pub async fn sign(&mut self, tx: TxBuilder) -> Result<SignedTx>
Sign a transaction using the signer
Sourcepub async fn send(&mut self, signed: SignedTx) -> Result<String>
pub async fn send(&mut self, signed: SignedTx) -> Result<String>
Send a signed transaction to the network
Sourcepub async fn send_erc20_transfer(
&mut self,
token: Address,
recipient: Address,
amount: U256,
) -> Result<String>
pub async fn send_erc20_transfer( &mut self, token: Address, recipient: Address, amount: U256, ) -> Result<String>
Send an ERC20 transfer transaction
Sourcepub async fn send_and_wait(
&mut self,
signed: SignedTx,
timeout_ms: u64,
) -> Result<TransactionReceipt>
pub async fn send_and_wait( &mut self, signed: SignedTx, timeout_ms: u64, ) -> Result<TransactionReceipt>
Send a transaction and wait for receipt
Sourcepub async fn transfer_usda(
&mut self,
recipient: Address,
amount_micro: u64,
) -> Result<String>
pub async fn transfer_usda( &mut self, recipient: Address, amount_micro: u64, ) -> Result<String>
Transfer USDA (fee token)
Sourcepub async fn fee_token_balance(&self, address: Address) -> Result<U256>
pub async fn fee_token_balance(&self, address: Address) -> Result<U256>
Get fee token balance
Sourcepub async fn native_balance(&self, address: Address) -> Result<U256>
pub async fn native_balance(&self, address: Address) -> Result<U256>
Get native balance
Sourcepub fn reset_nonce(&self)
pub fn reset_nonce(&self)
Reset the nonce cache
Auto Trait Implementations§
impl !Freeze for TxClient
impl !RefUnwindSafe for TxClient
impl Send for TxClient
impl Sync for TxClient
impl Unpin for TxClient
impl UnsafeUnpin for TxClient
impl !UnwindSafe for TxClient
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