1 unstable release

Uses old Rust 2015

0.1.0 Aug 7, 2018

#28 in #name-service

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(
        "http://localhost: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

~7–13MB
~191K SLoC