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
/*!
`eth-avatars` is a library for fetching avatars, resolving urls, and more.
In simplest terms, the crate turns "ipfs://.." and "eip155:..." into your preferred output (`Url` or `Vec<u8>`).
This crate is not limited to just avatars, it also works great for banners, and much more.
# Overview
Here is a simple example showing off how you can use `eth-avatars`:
```rust
use eth_avatars::{Client, modules::{ipfs::IpfsGateway, http::HttpFetcher}};
#[tokio::main]
pub async fn main() {
let http_client = reqwest::Client::default();
let client = Client::default()
.with_fetcher(IpfsGateway::new("https://ipfs.io/"))
.with_fetcher(HttpFetcher::from(http_client));
let resource = "ipfs://bafkreifnrjhkl7ccr2ifwn2n7ap6dh2way25a6w5x2szegvj5pt4b5nvfu".parse().unwrap();
let data = client.fetch(resource).await.unwrap();
}
```
## Configurable Sources
You can configure any of the below sources (one minimum) to support a protocol.
- [`Http`](`modules::http::Http`)
- [`http::HttpFetcher`](`modules::http::HttpFetcher`)
- [`Ipfs`](`modules::ipfs::Ipfs`)
- [`ipfs::IpfsGateway`](`modules::ipfs::IpfsGateway`)
- [`Swarm`](`modules::swarm::Swarm`) module is still under development
- [`Arweave`](`modules::arweave::Arweave`) module is still under development
- [`Ethereum`](`modules::ethereum::Ethereum`)
- [`ethereum::EthereumResolver`](`modules::ethereum::EthereumResolver`)
## Features
`reqwest` enables reqwest support.
*/
pub use ;