alloy-ens-extender

Crates.ioalloy-ens-extender
lib.rsalloy-ens-extender
version0.1.1
created_at2025-10-31 13:15:54.352598+00
updated_at2025-10-31 13:48:39.609713+00
descriptionA extension of alloy-ens. Adds more functionalities to the library.
homepage
repository
max_upload_size
id1910014
size137,332
Dipanshu Singh (dipanshuhappy)

documentation

README

alloy-ens-extender

A extension of alloy-ens. Adds more functionalities to the library.

Usage

Installation

cargo add alloy-ens-extender

Avatar Resolution

fn main(){
    let provider = ProviderBuilder::new()
        .connect_http("http://reth-ethereum.ithaca.xyz/rpc".parse().unwrap());

    let name = "nick.eth";
    let res = provider.lookup_avatar(name, None).await.unwrap();
}

Output:

https://api.opensea.io/api/v1/metadata/0x495f947276749Ce646f68AC8c248420045cb7b5e/8112316025873927737505937898915153732580103913704334048512380490797008551937

Avatar Resolution with gateway

fn main(){
    let provider = ProviderBuilder::new()
        .connect_http("http://reth-ethereum.ithaca.xyz/rpc".parse().unwrap());
    let gateway : HashMap<String,String> = HashMap::new();
    gateway.insert(
        "ipfs".to_string(),
        "https://gateway.pinata.cloud/ipfs/".to_string()
    );


    let name = "nick.eth";
    let res = provider.lookup_avatar(name,gateway)).await.unwrap();
}

Output:

https://gateway.pinata.cloud/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/0x495f947276749Ce646f68AC8c248420045cb7b5e/8112316025873927737505937898915153732580103913704334048512380490797008551937

Normalization

use alloy_ens_extender::normalize;

fn main(){
    let name = "‐Ξ1️⃣";
    let normalized_name = normalize(name);
    println!("Normalized name: {}", normalized_name);
}

Output:

Normalized name: -ξ1⃣
Commit count: 0

cargo fmt