1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*!
* `eth-icons` is an icon fetching library for EVM icons.
*
* Network (Mainnet, Sepolia, etc.), Native Asset (ETH, sepETH, etc.), and ERC20 (wETH, etc.) icons are an inherit non-standardized extension of the ethereum protocol.
*
* To allow for easily integrating these into your application eth-icons aims to bring a set of helpers to obtain iconography from various sources.
*
* ```rust
* use eth_icons::{IconClient, IconQuery};
*
* #[tokio::main]
* pub async fn main() {
* // Create a client
* let client = reqwest::Client::new();
*
* // Create an icon client
* let icons = IconClient::builder()
* .with_reqwest(client)
* .with_defaults()
* .build();
*
* let weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2".to_string();
* let weth_icons = icons.resolve(IconQuery::ERC20(1u64, weth)).await;
* }
* ```
*
* ## Selecting Sources
*
* Every source is opt-in by default.
*
* ```rust
* use eth_icons::{Address, IconClient, IconQuery, modules::{Blockscout, Zerion}};
*
* #[tokio::main]
* pub async fn main() {
* let icons = IconClient::builder()
* .with_reqwest(reqwest::Client::new())
* .with_source(Blockscout)
* .with_source(Zerion)
* .build();
*
* let weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2".to_string();
* let results = icons.resolve(IconQuery::ERC20(1, weth)).await;
*
* for source in &results {
* println!("{}: {:?}", source.source, source.result);
* }
* }
* ```
*
* ## Available Sources
*
* - [Avara](crate::modules::Avara) - supports ERC20s
* - [Blockscout](crate::modules::Blockscout) - supports ERC20s
* - [SafeWallet](crate::modules::SafeWallet) - supports network and native token icons
* - [Smoldapp](crate::modules::Smoldapp) - supports network, native tokens, and ERC20s
* - [Zerion](crate::modules::Zerion) - supports ERC20s
*
*
*/
pub use ;