| Crates.io | ethers-ccip-read |
| lib.rs | ethers-ccip-read |
| version | 0.1.2 |
| created_at | 2023-05-02 21:07:56.822991+00 |
| updated_at | 2024-02-05 17:02:39.090676+00 |
| description | CCIP-Read middleware for ethers-rs |
| homepage | https://github.com/ensdomains/ethers-ccip-read |
| repository | https://github.com/ensdomains/ethers-ccip-read |
| max_upload_size | |
| id | 854916 |
| size | 140,202 |
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!
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" }
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.