npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@smilo-platform/ethereum-ens

v0.7.4

Published

Javascript bindings for the Ethereum Name Service

Downloads

22

Readme

Resolver

Parameters

  • ens
  • node
  • contract

resolverAddress

resolverAddress returns the address of the resolver.

Returns any A promise for the address of the resolver.

reverseAddr

reverseAddr looks up the reverse record for the address returned by the resolver's addr()

Returns any A promise for the Resolver for the reverse record.

abi

abi returns the ABI associated with the name. Automatically looks for an ABI on the reverse record if none is found on the name itself.

Parameters

  • Optional.null bool If false, do not look up the ABI on the reverse entry.
  • reverse

Returns object A promise for the contract ABI.

contract

contract returns a web3 contract object. The address is that returned by this resolver's addr(), and the ABI is loaded from this resolver's ABI() method, or the ABI on the reverse record if that's not found. Returns null if no address is specified or no ABI was found. The returned contract object will not be promisifed or otherwise modified.

Returns object A promise for the contract instance.

ENS

Provides an easy-to-use interface to the Ethereum Name Service.

Example usage:

var ENS = require('ethereum-ens');
var Web3 = require('@smilo-platform/web3');

var provider = new Web3.providers.HttpProvider();
var ens = new ENS(provider);

var address = ens.resolver('foo.eth').addr().then(function(addr) { ... });

Functions that require communicating with the node return promises, rather than using callbacks. A promise has a then function, which takes a callback and will call it when the promise is fulfilled; then returns another promise, so you can chain callbacks. For more details, see http://bluebirdjs.com/.

Notably, the resolver method returns a resolver instance immediately; lookup of the resolver address is done in the background or when you first call an asynchronous method on the resolver.

Functions that create transactions also take an optional 'options' argument; this has the same parameters as web3.

Parameters

  • provider object A web3 provider to use to communicate with the blockchain.
  • address address Optional. The address of the ENS registry. Defaults to the public ENS registry.

Meta

resolver

resolver returns a resolver object for the specified name, throwing ENS.NameNotFound if the name does not exist in ENS. Resolver objects are wrappers around web3 contract objects, with the first argument - always the node ID in an ENS resolver - automatically supplied. So, to call the addr(node) function on a standard resolver, you only have to call addr(). Returned objects are also 'promisified' - they return a Bluebird Promise object instead of taking a callback.

Parameters

  • name string The name to look up.
  • abi list Optional. The JSON ABI definition to use for the resolver. if none is supplied, a default definition implementing has, addr, name, setName and setAddr is supplied.

Returns any The resolver object.

reverse

reverse returns a resolver object for the reverse resolution of the specified address, throwing ENS.NameNotFound if the reverse record does not exist in ENS. Resolver objects are wrappers around web3 contract objects, with the first argument - always the node ID in an ENS resolver - automatically supplied. So, to call the addr(node) function on a standard resolver, you only have to call addr(). Returned objects are also 'promisified' - they return a Bluebird Promise object instead of taking a callback.

Parameters

  • address string The address to look up.
  • abi list Optional. The JSON ABI definition to use for the resolver. if none is supplied, a default definition implementing has, addr, name, setName and setAddr is supplied.

Returns any The resolver object.

setResolver

setResolver sets the address of the resolver contract for the specified name. The calling account must be the owner of the name in order for this call to succeed.

Parameters

  • name string The name to update
  • address address The address of the resolver
  • options object An optional dict of parameters to pass to web3.
  • addr
  • params

Returns any A promise that returns the transaction ID when the transaction is mined.

owner

owner returns the address of the owner of the specified name.

Parameters

  • name string The name to look up.
  • callback

Returns any A promise returning the owner address of the specified name.

setOwner

setOwner sets the owner of the specified name. Only the owner may call setResolver or setSubnodeOwner. The calling account must be the current owner of the name in order for this call to succeed.

Parameters

  • name string The name to update
  • address address The address of the new owner
  • options object An optional dict of parameters to pass to web3.
  • addr
  • params

Returns any A promise returning the transaction ID of the transaction, once mined.

setSubnodeOwner

setSubnodeOwner sets the owner of the specified name. The calling account must be the owner of the parent name in order for this call to succeed - for example, to call setSubnodeOwner on 'foo.bar.eth', the caller must be the owner of 'bar.eth'.

Parameters

  • name string The name to update
  • address address The address of the new owner
  • options object An optional dict of parameters to pass to web3.
  • addr
  • params

Returns any A promise returning the transaction ID of the transaction, once mined.