eth-avatars 0.0.2

A library for fetching Ethereum avatars.
Documentation

Ethereum Avatars come in all shapes and sizes, sometimes its ipfs:// sometimes eip155: and plenty others. To easily integrate these into your application eth-avatars takes care of the resolution for you.

Quickstart

cargo add eth-avatars
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();
}

Data Sources

Currently supported data sources include:

Selecting Sources

Every source is opt-in by default.

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();
}

Documentation

You can read the documentation at docs.rs/eth-avatars.