Skip to content

ensdomains/ethers-ccip-read

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethers-rs CCIP-Read Middleware

CI Status Crates.io Docs.rs

Ready to dive into the world of cross-chain data access? Look no further! This Rust library provides an Ethers middleware to extend ENS (Ethereum Name Service) functionality with CCIP-Read (Cross-Chain Interoperability Protocol - Secure offchain data retrieval) support. Easily interact with ENS names that support the CCIP-Read protocol and make your decentralized applications more fun and powerful!

Installation: As Easy as 1-2-3!

To install the ethers-ccip-read middleware, add it to your Cargo.toml file:

ethers-ccip-read = { git = "https://github.com/ensdomains/ethers-ccip-read" }

Usage: Let the Cross-Chain Fun Begin!

Hook up the middleware to your Ethers provider and start your cross-chain adventure! Here's a simple example to get you going;

use anyhow::Result;
use ethers_ccip_read::*;
use std::convert::TryFrom;

#[tokio::main]
async fn main() -> Result<()> {
    // Connect to the network
    let provider = Provider::<Http>::try_from("https://your.web3.provider")?;

    // Enable the middleware
    let provider = CCIPReadMiddleware::new(
        provider,
    );

    // Now you can query CCIP-Read supported ENS names.
    let ens_name = "1.offchainexample.eth";
    let resolver_address = provider.get_resolver(ens_name).await.unwrap();
    println!("resolver_address: {:?}", resolver_address);

    let supports_wildcard = provider.supports_wildcard(resolver_address).await.unwrap();
    println!("supports_wildcard: {:?}", supports_wildcard);

    let resolved_address = provider.resolve_name(ens_name).await.unwrap();
    println!("resolved_address: {:?}", resolved_address);

    Ok(())
}

For more examples, check out the examples directory.

Helpful Resources: What more I can learn about CCIP-Read?

About

Ethers-rs CCIP-Read Middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages