Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ens

Class to support connection with Ethereum naming service

param

network string such as

  • mainnet
  • ropsten
param

main api url such as

param

address for a registry contract

Hierarchy

Index

Constructors

constructor

  • Source object describing the network naming service operates on

    throws

    ConfigurationError - when either network or url is setup incorrectly

    Parameters

    • Default value source: NamingServiceSource = true

      if specified as a string will be used as main url, if omited then defaults are used

    Returns Ens

Properties

NetworkNameMap

NetworkNameMap: object = invert(this.NetworkIdMap)

Type declaration

name

name: ENS = NamingServiceName.ENS

network

network: string

Optional registryAddress

registryAddress: string

Protected registryContract

registryContract: Contract

url

url: string

Methods

address

  • address(domain: string, currencyTicker: string): Promise<string>
  • Resolves domain to a specific cryptoAddress

    throws

    ResolutionError

    Parameters

    • domain: string

      domain name to be resolved

    • currencyTicker: string

      specific currency ticker such as

      • ZIL
      • BTC
      • ETH

    Returns Promise<string>

    A promise that resolves in a string

Protected buildContract

  • buildContract(abi: any, address: any): Contract

Protected callMethod

  • callMethod(contract: Contract, methodname: string, params: any): Promise<any>
  • Internal wrapper for ens method. Used to throw an error when ens is down @param method - method to be called @throws ResolutionError -> When blockchain is down

    Parameters

    • contract: Contract
    • methodname: string
    • params: any

    Returns Promise<any>

childhash

  • Returns the childhash

    Parameters

    • parent: nodeHash

      nodehash of a parent

    • label: string

      child

    • Default value options: object = {prefix: true}

    Returns nodeHash

email

  • email(domain: string): Promise<string>

Protected ensureSupportedDomain

  • ensureSupportedDomain(domain: string): void

httpUrl

  • httpUrl(domain: string): Promise<string>

Protected ignoreResolutionError

  • ignoreResolutionError<T>(code: ResolutionErrorCode | undefined, promise: Promise<T>): Promise<T | undefined>

ipfsHash

  • ipfsHash(domain: string): Promise<string>

Protected isResolutionError

isSupportedDomain

  • isSupportedDomain(domain: string): boolean

isSupportedNetwork

  • isSupportedNetwork(): boolean

namehash

owner

  • owner(domain: string): Promise<string | null>
  • Owner of the domain

    Parameters

    • domain: string

      domain name

    Returns Promise<string | null>

    An owner address of the domain

resolve

reverse

  • reverse(address: string, currencyTicker: string): Promise<string>
  • Reverse the ens address to a ens registered domain name

    async

    Parameters

    • address: string

      address you wish to reverse

    • currencyTicker: string

      currency ticker like BTC, ETH, ZIL

    Returns Promise<string>

    Domain name attached to this address

serviceName

Protected throwOwnershipError

  • throwOwnershipError(domain: any, ownerPromise?: Promise<string>): Promise<void>

Object literals

UrlMap

UrlMap: object

goerli

goerli: string = "https://goerli.infura.io"

kovan

kovan: string = "https://kovan.infura.io"

mainnet

mainnet: string = "https://mainnet.infura.io"

rinkeby

rinkeby: string = "https://rinkeby.infura.io"

ropsten

ropsten: string = "https://ropsten.infura.io"

Generated using TypeDoc