Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Make 'ens' module public #435

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
7 changes: 4 additions & 3 deletions ethers-providers/src/ens.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -48,6 +48,7 @@ pub fn resolve<T: Into<Address>>(
}
}

/// Returns the reverse-registrar name of an address.
pub fn reverse_address(addr: Address) -> String {
format!("{:?}.{}", addr, ENS_REVERSE_REGISTRAR_DOMAIN)[2..].to_string()
}
Expand Down
2 changes: 1 addition & 1 deletion ethers-providers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub use transports::*;
mod provider;

// ENS support
mod ens;
pub mod ens;

mod pending_transaction;
pub use pending_transaction::PendingTransaction;
Expand Down