Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A smol rust crate for fetching Ethereum avatars from various sources.

Documentation Crates.io Repository License: LGPL-3.0

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages