From 2e195d91e1c376d6b1e16770afda7a3b8bb6d6dc Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 6 Sep 2021 10:52:44 +0200 Subject: [PATCH] Make 'ens' module public (#435) --- CHANGELOG.md | 2 ++ ethers-providers/src/ens.rs | 7 ++++--- ethers-providers/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a537f377..e4c416fa 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 26f15042..7dddd47d 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 63486b14..a5a34013 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;