Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cns

Class to support connection with Crypto 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 Cns

Properties

NetworkNameMap

NetworkNameMap: object = invert(this.NetworkIdMap)

Type declaration

name

name: CNS = NamingServiceName.CNS

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

    Parameters

    • domain: string

      domain name to be resolved

    • currencyTicker: string

      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>
  • resolves an email address stored on domain

    Parameters

    • domain: string

      domain name

    Returns 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

resolve

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