Options
All
  • Public
  • Public/Protected
  • All
Menu

Module index

Index

Functions

Const call

  • call(network: Network, params: [{ data?: undefined | string; from?: undefined | string; gas?: undefined | number; gasPrice?: undefined | number; to: string; value?: undefined | number }, Tag]): Promise<string>
  • Send an eth_call call to the network.

    Parameters

    • network: Network
    • params: [{ data?: undefined | string; from?: undefined | string; gas?: undefined | number; gasPrice?: undefined | number; to: string; value?: undefined | number }, Tag]

    Returns Promise<string>

Const getChainId

  • getChainId(network: Network): Promise<number>
  • Returns the current chain ID as number.

    Parameters

    Returns Promise<number>

Const getDefaultNetwork

Const getEtherBalances

  • getEtherBalances(network: Network, addresses: string[]): Promise<Record<string, bigint>>
  • Get Ether balances for multiple addresses.

    Parameters

    • network: Network
    • addresses: string[]

    Returns Promise<Record<string, bigint>>

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 getNetwork

  • getNetwork(provider: string): Promise<undefined | Network>
  • Get the current network for a provider.

    Parameters

    • provider: string

    Returns Promise<undefined | Network>

Const getSupportedNetworks

  • getSupportedNetworks(): Network[]

Const getTokenBalances

  • getTokenBalances(network: Network, tokenAddress: string, addresses: string[]): Promise<Record<string, bigint>>
  • Get token balances for multiple addresses, for a single token contract.

    Parameters

    • network: Network
    • tokenAddress: string
    • addresses: string[]

    Returns Promise<Record<string, bigint>>

Const getVersion

  • getVersion(network: Network): Promise<number>
  • Returns the current network ID as number.

    Parameters

    Returns Promise<number>

Const isEthScanSupported

  • isEthScanSupported(network: Network): Promise<boolean>
  • Check if a network is supported by eth-scan.

    Parameters

    Returns Promise<boolean>

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