pub struct Erc20Contract { /* private fields */ }
Expand description
Interface for interacting with ERC20 token contracts on a blockchain.
This struct provides methods to fetch token metadata (name, symbol, decimals). From ERC20-compliant tokens on any EVM-compatible blockchain.
Implementations§
Source§impl Erc20Contract
impl Erc20Contract
Sourcepub const fn new(client: Arc<BlockchainHttpRpcClient>) -> Self
pub const fn new(client: Arc<BlockchainHttpRpcClient>) -> Self
Creates a new ERC20 contract interface with the specified RPC client.
Sourcepub async fn fetch_token_info(
&self,
token_address: &str,
) -> Result<TokenInfo, BlockchainRpcClientError>
pub async fn fetch_token_info( &self, token_address: &str, ) -> Result<TokenInfo, BlockchainRpcClientError>
Fetches complete token information (name, symbol, decimals) from an ERC20 contract.
§Errors
Returns an error if any of the contract calls fail.
BlockchainRpcClientError::ClientError
if an RPC call fails.BlockchainRpcClientError::AbiDecodingError
if ABI decoding fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Erc20Contract
impl !RefUnwindSafe for Erc20Contract
impl Send for Erc20Contract
impl Sync for Erc20Contract
impl Unpin for Erc20Contract
impl !UnwindSafe for Erc20Contract
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
§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> 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