Skip to main content

ENS

This class is designed to interact with the ENS system on the Ethereum blockchain.

Hierarchy

Index

Constructors

publicconstructor

  • Use to create an instance of ENS

    @example
    const ens = new ENS(
    "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
    "http://localhost:8545"
    );

    console.log( ens.defaultChain);
    > mainnet

    Parameters

    Returns ENS

Properties

readonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; IpcProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

publicregistryAddress

registryAddress: string

The registryAddress property can be used to define a custom registry address when you are connected to an unknown chain. It defaults to the main registry address.

staticoptionalgivenProvider

givenProvider?: SupportedProviders<never>

staticreadonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; IpcProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

Accessors

BatchRequest

accountProvider

blockHeaderTimeout

  • get blockHeaderTimeout(): number
  • set blockHeaderTimeout(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

currentProvider

  • Returns undefined | Web3BaseProvider<API>

  • Parameters

    Returns void

defaultAccount

  • get defaultAccount(): undefined | string
  • set defaultAccount(val: undefined | string): void
  • Returns undefined | string

  • Parameters

    • val: undefined | string

    Returns void

defaultBlock

defaultChain

  • get defaultChain(): string
  • set defaultChain(val: string): void
  • Returns string

  • Parameters

    • val: string

    Returns void

defaultCommon

  • get defaultCommon(): undefined | Common
  • set defaultCommon(val: undefined | Common): void
  • Returns undefined | Common

  • Parameters

    Returns void

defaultHardfork

  • get defaultHardfork(): string
  • set defaultHardfork(val: string): void
  • Returns string

  • Parameters

    • val: string

    Returns void

defaultMaxPriorityFeePerGas

  • get defaultMaxPriorityFeePerGas(): Numbers
  • set defaultMaxPriorityFeePerGas(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

defaultNetworkId

  • get defaultNetworkId(): undefined | Numbers
  • set defaultNetworkId(val: undefined | Numbers): void
  • Returns undefined | Numbers

  • Parameters

    Returns void

defaultTransactionType

  • get defaultTransactionType(): Numbers
  • set defaultTransactionType(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

enableExperimentalFeatures

  • get enableExperimentalFeatures(): { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
  • set enableExperimentalFeatures(val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }): void
  • Returns { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }

    • useRpcCallSpecification: boolean
    • useSubscriptionWhenCheckingBlockTimeout: boolean
  • Parameters

    • val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }

    Returns void

publicevents

  • get events(): ContractEventsInterface<readonly [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint64; name: ttl; type: uint64 }]; name: NewTTL; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }], ContractEvents<readonly [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint64; name: ttl; type: uint64 }]; name: NewTTL; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }]>>
  • Returns ContractEventsInterface<readonly [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint64; name: ttl; type: uint64 }]; name: NewTTL; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }], ContractEvents<readonly [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint64; name: ttl; type: uint64 }]; name: NewTTL; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }]>>

    • Returns all events that can be emitted by the ENS registry.

givenProvider

handleRevert

  • get handleRevert(): boolean
  • set handleRevert(val: boolean): void
  • Returns boolean

  • Parameters

    • val: boolean

    Returns void

maxListenersWarningThreshold

  • get maxListenersWarningThreshold(): number
  • set maxListenersWarningThreshold(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

provider

  • Returns undefined | Web3BaseProvider<API>

  • Parameters

    Returns void

requestManager

subscriptionManager

transactionBlockTimeout

  • get transactionBlockTimeout(): number
  • set transactionBlockTimeout(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionBuilder

  • Returns undefined | TransactionBuilder<unknown>

  • Parameters

    Returns void

transactionConfirmationBlocks

  • get transactionConfirmationBlocks(): number
  • set transactionConfirmationBlocks(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionConfirmationPollingInterval

  • get transactionConfirmationPollingInterval(): undefined | number
  • set transactionConfirmationPollingInterval(val: undefined | number): void
  • Returns undefined | number

  • Parameters

    • val: undefined | number

    Returns void

transactionPollingInterval

  • get transactionPollingInterval(): number
  • set transactionPollingInterval(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionPollingTimeout

  • get transactionPollingTimeout(): number
  • set transactionPollingTimeout(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionReceiptPollingInterval

  • get transactionReceiptPollingInterval(): undefined | number
  • set transactionReceiptPollingInterval(val: undefined | number): void
  • Returns undefined | number

  • Parameters

    • val: undefined | number

    Returns void

transactionSendTimeout

  • get transactionSendTimeout(): number
  • set transactionSendTimeout(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

transactionTypeParser

wallet

Methods

publiccheckNetwork

  • checkNetwork(): Promise<string>
  • Checks if the current used network is synced and looks for ENS support there. Throws an error if not.

    @example
    console.log(await web3.eth.ens.checkNetwork());
    > '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'

    Returns Promise<string>

    • The address of the ENS registry if the network has been detected successfully

emit

  • emit<K>(eventName: K, params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

publicgetAddress

  • getAddress(ENSName: string, coinType?: number): Promise<MatchPrimitiveType<bytes, unknown>>
  • Resolves an ENS name to an Ethereum address.


    Parameters

    • ENSName: string

      The ENS name to resolve

    • coinType: number = 60

      (Optional) The coin type, defaults to 60 (ETH)

    Returns Promise<MatchPrimitiveType<bytes, unknown>>

    • The Ethereum address of the given name
      const address = await web3.eth.ens.getAddress('ethereum.eth');
      console.log(address);
      > '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'

getConfig

publicgetContenthash

  • Returns the content hash object associated with an ENS node.

    @example
    const hash = await web3.eth.ens.getContenthash('ethereum.eth');
    console.log(hash);
    > 'QmaEBknbGT4bTQiQoe2VNgBJbRfygQGktnaW5TbuKixjYL'

    Parameters

    • ENSName: string

      The ENS name

    Returns Promise<MatchPrimitiveType<bytes, unknown>>

    • The content hash object associated with an ENS node

getContextObject

getMaxListeners

  • getMaxListeners(): number
  • Returns number

publicgetOwner

  • getOwner(name: string): Promise<unknown>
  • Returns the owner by the given name and current configured or detected Registry

    @example
    const owner = await web3.eth.ens.getOwner('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns the address of the owner of the name.

publicgetPubkey

  • Returns the X and Y coordinates of the curve point for the public key.

    @example
    const key = await web3.eth.ens.getPubkey('ethereum.eth');
    console.log(key);
    > {
    "0": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "1": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "x": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "y": "0x0000000000000000000000000000000000000000000000000000000000000000"
    }

    Parameters

    • ENSName: string

      The ENS name

    Returns Promise<unknown[] & Record<1, MatchPrimitiveType<bytes32, unknown>> & Record<0, MatchPrimitiveType<bytes32, unknown>> & [] & Record<x, MatchPrimitiveType<bytes32, unknown>> & Record<y, MatchPrimitiveType<bytes32, unknown>>>

    • The X and Y coordinates of the curve point for the public key

publicgetResolver

  • getResolver(name: string): Promise<Contract<readonly [{ inputs: readonly [{ internalType: contract ENS; name: _ens; type: address }, { internalType: contract INameWrapper; name: wrapperAddress; type: address }, { internalType: address; name: _trustedETHController; type: address }, { internalType: address; name: _trustedReverseRegistrar; type: address }]; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: uint256; name: contentType; type: uint256 }]; name: ABIChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: a; type: address }]; name: AddrChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint256; name: coinType; type: uint256 }, { indexed: false; internalType: bytes; name: newAddress; type: bytes }]; name: AddressChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: hash; type: bytes }]; name: ContenthashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }, { indexed: false; internalType: bytes; name: record; type: bytes }]; name: DNSRecordChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }]; name: DNSRecordDeleted; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }]; name: DNSZoneCleared; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: lastzonehash; type: bytes }, { indexed: false; internalType: bytes; name: zonehash; type: bytes }]; name: DNSZonehashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes4; name: interfaceID; type: bytes4 }, { indexed: false; internalType: address; name: implementer; type: address }]; name: InterfaceChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: string; name: name; type: string }]; name: NameChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes32; name: x; type: bytes32 }, { indexed: false; internalType: bytes32; name: y; type: bytes32 }]; name: PubkeyChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: string; name: indexedKey; type: string }, { indexed: false; internalType: string; name: key; type: string }]; name: TextChanged; type: event }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentTypes; type: uint256 }]; name: ABI; outputs: readonly [{ internalType: uint256; name: ; type: uint256 }, { internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: addr; outputs: readonly [{ internalType: address payable; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }]; name: addr; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: clearDNSZone; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: contenthash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }, { internalType: uint16; name: resource; type: uint16 }]; name: dnsRecord; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }]; name: hasDNSRecords; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }]; name: interfaceImplementer; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: account; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes[]; name: data; type: bytes[] }]; name: multicall; outputs: readonly [{ internalType: bytes[]; name: results; type: bytes[] }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: name; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: pubkey; outputs: readonly [{ internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentType; type: uint256 }, { internalType: bytes; name: data; type: bytes }]; name: setABI; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }, { internalType: bytes; name: a; type: bytes }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setContenthash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: data; type: bytes }]; name: setDNSRecords; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }, { internalType: address; name: implementer; type: address }]; name: setInterface; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: newName; type: string }]; name: setName; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; name: setPubkey; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }, { internalType: string; name: value; type: string }]; name: setText; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setZonehash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes4; name: interfaceID; type: bytes4 }]; name: supportsInterface; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }]; name: text; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: zonehash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }]>>
  • Returns the Resolver by the given address

    @example
    const resolver = await ens.getResolver('resolver');

    console.log(resolver.options.address);
    > '0x1234567890123456789012345678901234567890'

    Parameters

    • name: string

      The name of the ENS domain

    Returns Promise<Contract<readonly [{ inputs: readonly [{ internalType: contract ENS; name: _ens; type: address }, { internalType: contract INameWrapper; name: wrapperAddress; type: address }, { internalType: address; name: _trustedETHController; type: address }, { internalType: address; name: _trustedReverseRegistrar; type: address }]; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: uint256; name: contentType; type: uint256 }]; name: ABIChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: a; type: address }]; name: AddrChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint256; name: coinType; type: uint256 }, { indexed: false; internalType: bytes; name: newAddress; type: bytes }]; name: AddressChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: hash; type: bytes }]; name: ContenthashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }, { indexed: false; internalType: bytes; name: record; type: bytes }]; name: DNSRecordChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }]; name: DNSRecordDeleted; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }]; name: DNSZoneCleared; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: lastzonehash; type: bytes }, { indexed: false; internalType: bytes; name: zonehash; type: bytes }]; name: DNSZonehashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes4; name: interfaceID; type: bytes4 }, { indexed: false; internalType: address; name: implementer; type: address }]; name: InterfaceChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: string; name: name; type: string }]; name: NameChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes32; name: x; type: bytes32 }, { indexed: false; internalType: bytes32; name: y; type: bytes32 }]; name: PubkeyChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: string; name: indexedKey; type: string }, { indexed: false; internalType: string; name: key; type: string }]; name: TextChanged; type: event }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentTypes; type: uint256 }]; name: ABI; outputs: readonly [{ internalType: uint256; name: ; type: uint256 }, { internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: addr; outputs: readonly [{ internalType: address payable; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }]; name: addr; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: clearDNSZone; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: contenthash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }, { internalType: uint16; name: resource; type: uint16 }]; name: dnsRecord; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }]; name: hasDNSRecords; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }]; name: interfaceImplementer; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: account; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes[]; name: data; type: bytes[] }]; name: multicall; outputs: readonly [{ internalType: bytes[]; name: results; type: bytes[] }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: name; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: pubkey; outputs: readonly [{ internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentType; type: uint256 }, { internalType: bytes; name: data; type: bytes }]; name: setABI; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }, { internalType: bytes; name: a; type: bytes }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setContenthash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: data; type: bytes }]; name: setDNSRecords; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }, { internalType: address; name: implementer; type: address }]; name: setInterface; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: newName; type: string }]; name: setName; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; name: setPubkey; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }, { internalType: string; name: value; type: string }]; name: setText; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setZonehash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes4; name: interfaceID; type: bytes4 }]; name: supportsInterface; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }]; name: text; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: zonehash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }]>>

    • An contract instance of the resolver

publicgetTTL

  • getTTL(name: string): Promise<unknown>
  • Returns the address of the owner of an ENS name.

    @example
    const owner = await web3.eth.ens.getOwner('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns the caching TTL (time-to-live) of a name.

publicisApprovedForAll

  • isApprovedForAll(owner: string, operator: string, returnFormat?: DataFormat): Promise<unknown>
  • Returns true if the operator is approved to make ENS registry operations on behalf of the owner.

    @example
    const approved = await web3.eth.ens.isApprovedForAll('0x1234567890123456789012345678901234567890', '0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990');

    Parameters

    • owner: string

      The owner address

    • operator: string

      The operator address

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<unknown>

    • true if the operator is approved, false otherwise

link

  • link<T>(parentContext: T): void
  • Type parameters

    Parameters

    • parentContext: T

    Returns void

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): Function[]
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns Function[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } }[K]>

    Returns void

publicrecordExists

  • recordExists(name: string): Promise<unknown>
  • Returns true if the record exists

    @example
    const exists = await web3.eth.ens.recordExists('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns true if node exists in this ENS registry. This will return false for records that are in the legacy ENS registry but have not yet been migrated to the new one.

registerPlugin

  • Parameters

    Returns void

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

publicsetAddress

  • Sets the address of an ENS name in his resolver.


    Parameters

    • name: string

      The ENS name

    • address: string

      The address to set

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt
      const receipt = await ens.setAddress('web3js.eth','0xe2597eb05cf9a87eb1309e86750c903ec38e527e');

publicsetApprovalForAll

  • setApprovalForAll(operator: string, approved: boolean, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets or clears an approval by the given operator.

    @example
    const receipt = web3.eth.ens.setApprovalForAll('0x1234567890123456789012345678901234567890', true )

    Parameters

    • operator: string

      The operator address

    • approved: boolean

      true to set the approval, false to clear it

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setConfig

  • Parameters

    Returns void

publicsetContenthash

  • setContenthash(name: string, hash: string, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the content hash associated with an ENS node. Emits a ContenthashChanged event.

    @example
    const receipt = web3.eth.ens.setContenthash(
    'ethereum.eth',
    'ipfs://QmaEBknbGT4bTQiQoe2VNgBJbRfygQGktnaW5TbuKixjYL',
    )

    Parameters

    • name: string

      The ENS name

    • hash: string

      The content hash to set

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

publicsetOwner

  • Sets the address of the owner of an ENS name.

    @example
    const receipt = await ens.setOwner('ethereum.eth', , sendOptions);

    Parameters

    • name: string

      The ENS name

    • address: string

      The address of the new owner

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setProvider

publicsetPubkey

  • setPubkey(name: string, x: string, y: string, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the SECP256k1 public key associated with an ENS node. (Emits a PublicKeyChanged event)


    Parameters

    • name: string

      The ENS name

    • x: string

      The X coordinate of the public key

    • y: string

      The Y coordinate of the public key

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt
      const receipt = await web3.eth.ens.setPubkey(
      'ethereum.eth',
      '0x0000000000000000000000000000000000000000000000000000000000000000',
      '0x0000000000000000000000000000000000000000000000000000000000000000',
      { from: '0x9CC9a2c777605Af16872E0997b3Aeb91d96D5D8c' });

publicsetRecord

  • setRecord(name: string, owner: string, resolver: string, ttl: number, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Returns the address of the owner of an ENS name.

    @example
    const receipt = await ens.setRecord( 'web3js.eth','0xe2597eb05cf9a87eb1309e86750c903ec38e527e', '0x7ed0e85b8e1e925600b4373e6d108f34ab38a401', 1000);

    Parameters

    • name: string

      The ENS name

    • owner: string

      The owner of the name record.

    • resolver: string

      The resolver of the name record.

    • ttl: number

      Time to live value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

publicsetResolver

  • setResolver(name: string, address: string, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint } | { code: bigint; innerError: undefined | { name: string; message: string; stack?: string | undefined; } | { name: string; message: string; stack?: string | undefined; }[]; name: string; reason: string; signature: string; stack: undefined | string; toJSON: any }>
  • set the resolver of the given name

    @example
    const receipt = await ens.setResolver('resolver', '0x1234567890123456789012345678901234567890', {from: '0x1234567890123456789012345678901234567890'});

    Parameters

    • name: string

      The name of the ENS domain

    • address: string

      The address of the resolver

    • txConfig: NonPayableCallOptions

      The transaction config

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint } | { code: bigint; innerError: undefined | { name: string; message: string; stack?: string | undefined; } | { name: string; message: string; stack?: string | undefined; }[]; name: string; reason: string; signature: string; stack: undefined | string; toJSON: any }>

    The transaction receipt

publicsetSubnodeOwner

  • setSubnodeOwner(node: string, label: string, address: string, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<TransactionReceipt | RevertInstructionError>
  • Creates a new subdomain of the given node, assigning ownership of it to the specified owner.

    @example
    const receipt = await ens.setSubnodeOwner('ethereum.eth', 'web3', '0x1234567890123456789012345678901234567890', {from: '0x1234567890123456789012345678901234567890'});

    Parameters

    • node: string

      The ENS name

    • label: string

      The name of the sub-domain or the sha3 hash of it

    • address: string

      The registrar of this sub-domain

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

publicsetSubnodeRecord

  • setSubnodeRecord(name: string, label: string, owner: string, resolver: string, ttl: number, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the owner, resolver and TTL for a subdomain, creating it if necessary.

    @example
    const receipt = await web3.eth.ens.setSubnodeRecord('ethereum.eth', 'web3', '0x1234567890123456789012345678901234567890','0xAA9133EeC3ae5f9440C1a1E61E2D2Cc571675527', 1000000);

    Parameters

    • name: string

      The ENS name

    • label: string

      The name of the sub-domain or sha3 hash of it

    • owner: string

      The owner of the name record

    • resolver: string

      The resolver address of the name record

    • ttl: number

      Time to live value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • returnFormat: DataFormat = DEFAULT_RETURN_FORMAT

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

publicsetTTL

  • setTTL(name: string, ttl: number, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the TTL of a name. Emits a NewTTL event.

    @example
    const receipt = await web3.eth.ens.setTTL('ethereum.eth', 1000);

    Parameters

    • name: string

      THe ENS name

    • ttl: number

      The TTL value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

publicsupportsInterface

  • supportsInterface(ENSName: string, interfaceId: string): Promise<MatchPrimitiveType<bool, unknown>>
  • Returns true if the related Resolver does support the given signature or interfaceId.

    @example
    const supports = await web3.eth.ens.supportsInterface('ethereum.eth', 'addr(bytes32');
    console.log(supports);
    > true

    Parameters

    • ENSName: string

      The ENS name

    • interfaceId: string

      The signature of the function or the interfaceId as described in the ENS documentation

    Returns Promise<MatchPrimitiveType<bool, unknown>>

    • true if the related Resolver does support the given signature or interfaceId.

use

  • Type parameters

    Parameters

    Returns T

staticfromContextObject