diff --git a/CHANGELOG.md b/CHANGELOG.md index a537f377d..e4c416fa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ ### Unreleased +* Expose `ens` module + ### 0.5.2 * Set resolved ENS name during gas estimation ([1e5a9e](https://github.com/gakonst/ethers-rs/commit/1e5a9efb3c678eecd43d5c341b4932da35445831)) diff --git a/ethers-providers/src/ens.rs b/ethers-providers/src/ens.rs index 26f150421..7dddd47d9 100644 --- a/ethers-providers/src/ens.rs +++ b/ethers-providers/src/ens.rs @@ -1,11 +1,11 @@ -/// [Ethereum Name Service](https://docs.ens.domains/) support -// Adapted from https://github.com/hhatto/rust-ens/blob/master/src/lib.rs +//! [Ethereum Name Service](https://docs.ens.domains/) support +//! Adapted from https://github.com/hhatto/rust-ens/blob/master/src/lib.rs use ethers_core::{ types::{Address, NameOrAddress, Selector, TransactionRequest, H160, H256}, utils::keccak256, }; -// 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e +/// ENS registry address (`0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e`) pub const ENS_ADDRESS: Address = H160([ // cannot set type aliases as constructors 0, 0, 0, 0, 0, 12, 46, 7, 78, 198, 154, 13, 251, 41, 151, 186, 108, 125, 46, 30, @@ -48,6 +48,7 @@ pub fn resolve>( } } +/// Returns the reverse-registrar name of an address. pub fn reverse_address(addr: Address) -> String { format!("{:?}.{}", addr, ENS_REVERSE_REGISTRAR_DOMAIN)[2..].to_string() } diff --git a/ethers-providers/src/lib.rs b/ethers-providers/src/lib.rs index 63486b148..a5a340130 100644 --- a/ethers-providers/src/lib.rs +++ b/ethers-providers/src/lib.rs @@ -69,7 +69,7 @@ pub use transports::*; mod provider; // ENS support -mod ens; +pub mod ens; mod pending_transaction; pub use pending_transaction::PendingTransaction;