Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Functions

Const getNameHash

  • getNameHash(name: string): string
  • Get the name hash for an ENS domain, as defined in EIP-137.

    Parameters

    • name: string

    Returns string

Const isValidAddress

  • isValidAddress(address: string): boolean
  • Check if an address is a valid resolved address. Note that this does not do a full check if an address is valid, but it checks for common return values from JSON-RPC calls.

    Parameters

    • address: string

    Returns boolean

Const loadBalance

  • loadBalance<F, First>(fn: F, values: First[], retries?: number): (...args: Parameters<OmitFirstArg<F>>) => Promise<Await<ReturnType<F>>>
  • Perform a function call with sequenced first argument, useful for load balancing node calls. This will retry up to retries times if an error occurs.

    Type parameters

    • F: (first: First, ...args: any[]) => Promise<any>

    • First

    Parameters

    • fn: F
    • values: First[]
    • retries: number = 3

    Returns (...args: Parameters<OmitFirstArg<F>>) => Promise<Await<ReturnType<F>>>

      • (...args: Parameters<OmitFirstArg<F>>): Promise<Await<ReturnType<F>>>
      • Parameters

        • Rest ...args: Parameters<OmitFirstArg<F>>

        Returns Promise<Await<ReturnType<F>>>

Const normalise

  • normalise(name: string): string
  • Normalise a name according to UTS46.

    Parameters

    • name: string

    Returns string

Const resolveName

  • resolveName(network: Network, name: string): Promise<undefined | string>
  • Resolve an ENS name. Returns the resolved address, or undefined if no address was resolved.

    Parameters

    Returns Promise<undefined | string>

roundRobin

  • roundRobin<T>(array: T[]): Generator<T, T>
  • Loop through an array sequentially. This will create a generator that never completes.

    Type parameters

    • T

    Parameters

    • array: T[]

    Returns Generator<T, T>

Generated using TypeDoc