1 unstable release

Uses old Rust 2015

0.1.0 Aug 7, 2018

#15 in #addr

MIT license

17KB
245 lines

rust-ens

Rust ENS interface, based on rust-web3.

Usage

Cargo.toml

[dependencies]
ens = "0.1"
extern crate ens;
extern crate web3;

use ens::ENS;

fn main() {
    let (_evloop, transport) = web3::transports::Http::new(
        "https://127.0.0.1:8545",
    ).unwrap();

    let ens_name = "hexacosa.eth";

    let ens = ENS::new(web3::Web3::new(transport));
    match ens.address(ens_name) {
        Ok(addr) => println!("{:?}", addr),
        Err(_) => println!("unknown"),
    };
}

for Developer

Contract

use ENS Contract from https://github.com/ensdomains/ens/tree/master/contracts .

  • ENS.sol
  • PublicResolver.sol
$ solc --bin --abi --optimize contract/PublicResolver.sol -o contract
$ ls contract
ENS.abi             ENS.bin             ENS.sol             PublicResolver.abi  PublicResolver.bin  PublicResolver.sol

Dependencies

~6.5–9MB
~203K SLoC