pub struct RpcClient { /* private fields */ }Expand description
JSON-RPC client for Ethereum-compatible chains
Implementations§
Source§impl RpcClient
impl RpcClient
Sourcepub async fn get_chain_id(&self) -> Result<u64>
pub async fn get_chain_id(&self) -> Result<u64>
Get chain ID
Sourcepub async fn get_block_number(&self) -> Result<u64>
pub async fn get_block_number(&self) -> Result<u64>
Get block number
Sourcepub async fn get_balance(&self, address: Address) -> Result<U256>
pub async fn get_balance(&self, address: Address) -> Result<U256>
Get balance
Sourcepub async fn get_erc20_balance(
&self,
token: Address,
owner: Address,
) -> Result<U256>
pub async fn get_erc20_balance( &self, token: Address, owner: Address, ) -> Result<U256>
Get ERC20 token balance (using hardcoded selector for simplicity)
Sourcepub async fn get_transaction_count(
&self,
address: Address,
block: &str,
) -> Result<u64>
pub async fn get_transaction_count( &self, address: Address, block: &str, ) -> Result<u64>
Get transaction count (nonce) for an address
Sourcepub async fn send_raw_transaction(&self, tx: String) -> Result<String>
pub async fn send_raw_transaction(&self, tx: String) -> Result<String>
Send raw transaction
Sourcepub async fn get_transaction_receipt(
&self,
tx_hash: String,
) -> Result<Option<TransactionReceipt>>
pub async fn get_transaction_receipt( &self, tx_hash: String, ) -> Result<Option<TransactionReceipt>>
Get transaction receipt
Sourcepub async fn get_transaction_by_hash(
&self,
tx_hash: String,
) -> Result<Option<Transaction>>
pub async fn get_transaction_by_hash( &self, tx_hash: String, ) -> Result<Option<Transaction>>
Get transaction by hash
Sourcepub async fn wait_for_receipt(
&self,
tx_hash: String,
timeout_ms: u64,
) -> Result<TransactionReceipt>
pub async fn wait_for_receipt( &self, tx_hash: String, timeout_ms: u64, ) -> Result<TransactionReceipt>
Wait for transaction receipt
Auto Trait Implementations§
impl Freeze for RpcClient
impl !RefUnwindSafe for RpcClient
impl Send for RpcClient
impl Sync for RpcClient
impl Unpin for RpcClient
impl UnsafeUnpin for RpcClient
impl !UnwindSafe for RpcClient
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