pub trait DataProvider: Send + Sync {
// Provided methods
fn resolve_token(
&self,
chain_id: u64,
address: &str,
) -> Pin<Box<dyn Future<Output = Option<TokenMeta>> + Send + '_>> { ... }
fn resolve_ens_name(
&self,
address: &str,
chain_id: u64,
types: Option<&[String]>,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>> { ... }
fn resolve_local_name(
&self,
address: &str,
chain_id: u64,
types: Option<&[String]>,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>> { ... }
fn resolve_nft_collection_name(
&self,
collection_address: &str,
chain_id: u64,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>> { ... }
fn resolve_block_timestamp(
&self,
chain_id: u64,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + '_>> { ... }
}Expand description
Async data provider for external data resolution during formatting.
Wallets implement this trait to supply token metadata, ENS/local address names,
and NFT collection names. All methods have default implementations returning None,
so implementors only need to override the methods they support.
Provided Methods§
Sourcefn resolve_token(
&self,
chain_id: u64,
address: &str,
) -> Pin<Box<dyn Future<Output = Option<TokenMeta>> + Send + '_>>
fn resolve_token( &self, chain_id: u64, address: &str, ) -> Pin<Box<dyn Future<Output = Option<TokenMeta>> + Send + '_>>
Resolve token metadata (symbol, decimals, name) for a given chain and address.
Sourcefn resolve_ens_name(
&self,
address: &str,
chain_id: u64,
types: Option<&[String]>,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>>
fn resolve_ens_name( &self, address: &str, chain_id: u64, types: Option<&[String]>, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>>
Resolve an ENS name for an address.
types hints the expected address role (e.g. ["eoa"], ["contract"]).
Sourcefn resolve_local_name(
&self,
address: &str,
chain_id: u64,
types: Option<&[String]>,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>>
fn resolve_local_name( &self, address: &str, chain_id: u64, types: Option<&[String]>, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>>
Resolve a local/contact name for an address.
types hints the expected address role (e.g. ["eoa"], ["contract"]).