Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Resolution

Blockchain domain Resolution library - Resolution.

example
import Resolution from '@unstoppabledomains/resolution';

let resolution = new Resolution({ blockchain: {
       cns: {
          url: "https://mainnet.infura.io/v3/12351245223",
          network: "mainnet"
       }
     }
  });

let domain = "brad.zil";
resolution.addr(domain, "eth").then(addr => console.log(addr));;

Hierarchy

  • Resolution

Index

Constructors

constructor

Methods

addr

  • addr(domain: string, ticker: string): Promise<string>
  • Resolves given domain name to a specific currency address if exists

    async
    throws

    ResolutionError if address is not found

    Parameters

    • domain: string

      domain name to be resolved

    • ticker: string

      currency ticker like BTC, ETH, ZIL

    Returns Promise<string>

    A promise that resolves in an address

allRecords

  • Returns all record keys of the domain. This method is strongly unrecommended for production use due to lack of support for many ethereum service providers and low performance

    Parameters

    • domain: string

      domain name

    Returns Promise<CryptoRecords>

chatId

  • chatId(domain: string): Promise<string>
  • Resolve a chat id from the domain record

    throws

    ResolutionError

    Parameters

    • domain: string

      domain name to be resolved

    Returns Promise<string>

    A promise that resolves in chatId

chatPk

  • chatPk(domain: string): Promise<string>
  • Resolve a gundb public key from the domain record

    throws

    ResolutionError

    Parameters

    • domain: string

      domain name to be resolved

    Returns Promise<string>

    a promise that resolves in gundb public key

childhash

  • Parameters

    • parent: string

      namehash of a parent domain

    • label: string

      subdomain name

    • namingService: NamingServiceName

      "CNS" or "ZNS"

    • Default value options: NamehashOptions = NamehashOptionsDefault

      formatting options

    Returns string

    a namehash of a subdomain with name label

dns

email

  • email(domain: string): Promise<string>
  • Resolves the ipfs email field from whois configurations

    throws

    ResolutionError

    Parameters

    • domain: string

      domain name

    Returns Promise<string>

    A Promise that resolves in an email address configured for this domain whois

httpUrl

  • httpUrl(domain: string): Promise<string>
  • Resolves the httpUrl attached to domain

    Parameters

    • domain: string

      domain name

    Returns Promise<string>

ipfsHash

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

isSupportedDomain

  • isSupportedDomain(domain: string): boolean
  • Checks if the domain name is valid according to naming service rules for valid domain names.

    Parameters

    • domain: string

      domain name to be checked

    Returns boolean

isValidHash

  • isValidHash(domain: string, hash: string): boolean
  • Checks weather the domain name matches the hash

    Parameters

    • domain: string

      domain name to check againt

    • hash: string

      hash obtained from the blockchain

    Returns boolean

multiChainAddr

  • multiChainAddr(domain: string, ticker: string, chain: string): Promise<string>
  • Read multi-chain currency address if exists

    async
    throws

    ResolutionError if address is not found

    Parameters

    • domain: string

      domain name to be resolved

    • ticker: string

      currency ticker (USDT, FTM, etc.)

    • chain: string

      chain version, usually means blockchain ( ERC20, BEP2, OMNI, etc. )

    Returns Promise<string>

    A promise that resolves in an adress

namehash

  • throws

    ResolutionError with UnsupportedDomain error code if domain extension is unknown

    Parameters

    • domain: string

      domain name to be converted

    • Default value options: NamehashOptions = NamehashOptionsDefault

      formatting options

    Returns string

    Produces a namehash from supported naming service in hex format with 0x prefix. Corresponds to ERC721 token id in case of Ethereum based naming service like CNS.

owner

  • owner(domain: string): Promise<string | null>
  • Parameters

    • domain: string

      domain name

    Returns Promise<string | null>

    An owner address of the domain

record

  • record(domain: string, recordKey: string): Promise<string>
  • Parameters

    • domain: string

      domain name

    • recordKey: string

      a name of a record to be resolved

    Returns Promise<string>

    A record value promise for a given record name

records

  • records(domain: string, keys: string[]): Promise<CryptoRecords>
  • Parameters

    • domain: string

      domain name

    • keys: string[]

      Array of record keys to be resolved

    Returns Promise<CryptoRecords>

    A Promise with key-value mapping of domain records

resolver

  • resolver(domain: string): Promise<string>
  • Parameters

    • domain: string

      domain to look for

    Returns Promise<string>

    the resolver address for a specific domain

serviceName

twitter

  • twitter(domain: string): Promise<string>
  • Resolves given domain name to a verified twitter handle

    async
    throws

    ResolutionError if twitter is not found

    Parameters

    • domain: string

      domain name to be resolved

    Returns Promise<string>

    A promise that resolves in a verified twitter handle

Static autoNetwork

  • AutoConfigure the blockchain network between different testnets for CNS We make a "net_version" JSON RPC call to the blockchain either via url or with the help of given provider.

    Parameters

    Returns Promise<Resolution>

    configured Resolution object

Static fromEip1193Provider

Static fromEthersProvider

Static fromWeb3Version0Provider

Static fromWeb3Version1Provider

Static infura

  • Creates a resolution with configured infura id for cns

    Parameters

    • infura: string

      infura project id

    • Optional networks: undefined | { cns?: undefined | { network: CnsSupportedNetworks } }

      an optional object that describes what network to use when connecting CNS default is mainnet

    Returns Resolution

Generated using TypeDoc