ENS
Hierarchy
Index
Constructors
Properties
Accessors
- BatchRequest
- accountProvider
- blockHeaderTimeout
- currentProvider
- defaultAccount
- defaultBlock
- defaultChain
- defaultCommon
- defaultHardfork
- defaultMaxPriorityFeePerGas
- defaultNetworkId
- defaultTransactionType
- enableExperimentalFeatures
- events
- givenProvider
- handleRevert
- maxListenersWarningThreshold
- provider
- requestManager
- subscriptionManager
- transactionBlockTimeout
- transactionBuilder
- transactionConfirmationBlocks
- transactionConfirmationPollingInterval
- transactionPollingInterval
- transactionPollingTimeout
- transactionReceiptPollingInterval
- transactionSendTimeout
- transactionTypeParser
- wallet
Methods
- checkNetwork
- emit
- eventNames
- getAddress
- getConfig
- getContenthash
- getContextObject
- getMaxListeners
- getOwner
- getPubkey
- getResolver
- getTTL
- isApprovedForAll
- link
- listenerCount
- listeners
- off
- on
- once
- recordExists
- registerPlugin
- removeAllListeners
- setAddress
- setApprovalForAll
- setConfig
- setContenthash
- setMaxListenerWarningThreshold
- setOwner
- setProvider
- setPubkey
- setRecord
- setResolver
- setSubnodeOwner
- setSubnodeRecord
- setTTL
- supportsInterface
- use
- fromContextObject
Constructors
publicconstructor
Use to create an instance of ENS
Parameters
optionalregistryAddr: string
(Optional) The address of the ENS registry (default: mainnet registry address)
optionalprovider: string | SupportedProviders<EthExecutionAPI & Web3NetAPI> | Web3ContextObject<EthExecutionAPI & Web3NetAPI, any>
(Optional) The provider to use for the ENS instance
Returns ENS
Properties
readonlyproviders
Type declaration
HttpProvider: Web3BaseProviderConstructor
IpcProvider: Web3BaseProviderConstructor
WebsocketProvider: Web3BaseProviderConstructor
publicregistryAddress
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
staticreadonlyproviders
Type declaration
HttpProvider: Web3BaseProviderConstructor
IpcProvider: Web3BaseProviderConstructor
WebsocketProvider: Web3BaseProviderConstructor
Accessors
BatchRequest
Returns new () => Web3BatchRequest
Returns Web3BatchRequest
accountProvider
Returns undefined | Web3AccountProvider<Web3BaseWalletAccount>
blockHeaderTimeout
Returns number
Parameters
val: number
Returns void
currentProvider
Returns undefined | Web3BaseProvider<API>
Parameters
provider: undefined | string | SupportedProviders<API>
Returns void
defaultAccount
Returns undefined | string
Parameters
val: undefined | string
Returns void
defaultBlock
Returns BlockNumberOrTag
Parameters
val: BlockNumberOrTag
Returns void
defaultChain
Returns string
Parameters
val: string
Returns void
defaultCommon
defaultHardfork
Returns string
Parameters
val: string
Returns void
defaultMaxPriorityFeePerGas
defaultNetworkId
defaultTransactionType
enableExperimentalFeatures
Returns { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
useRpcCallSpecification: boolean
useSubscriptionWhenCheckingBlockTimeout: boolean
Parameters
val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
Returns void
publicevents
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
Returns undefined | SupportedProviders<never>
handleRevert
Returns boolean
Parameters
val: boolean
Returns void
maxListenersWarningThreshold
Returns number
Parameters
val: number
Returns void
provider
Returns undefined | Web3BaseProvider<API>
Parameters
provider: undefined | string | SupportedProviders<API>
Returns void
requestManager
Returns Web3RequestManager<API>
subscriptionManager
Returns undefined | Web3SubscriptionManager<API, RegisteredSubs>
transactionBlockTimeout
Returns number
Parameters
val: number
Returns void
transactionBuilder
Returns undefined | TransactionBuilder<unknown>
Parameters
val: undefined | TransactionBuilder<unknown>
Returns void
transactionConfirmationBlocks
Returns number
Parameters
val: number
Returns void
transactionConfirmationPollingInterval
Returns undefined | number
Parameters
val: undefined | number
Returns void
transactionPollingInterval
Returns number
Parameters
val: number
Returns void
transactionPollingTimeout
Returns number
Parameters
val: number
Returns void
transactionReceiptPollingInterval
Returns undefined | number
Parameters
val: undefined | number
Returns void
transactionSendTimeout
Returns number
Parameters
val: number
Returns void
transactionTypeParser
Returns undefined | TransactionTypeParser
Parameters
val: undefined | TransactionTypeParser
Returns void
wallet
Returns undefined | Web3BaseWallet<Web3BaseWalletAccount>
Methods
publiccheckNetwork
Checks if the current used network is synced and looks for ENS support there. Throws an error if not.
Returns Promise<string>
- The address of the ENS registry if the network has been detected successfully
emit
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
Returns (string | symbol)[]
publicgetAddress
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
Returns Web3ConfigOptions
publicgetContenthash
Returns the content hash object associated with an ENS node.
Parameters
ENSName: string
The ENS name
Returns Promise<MatchPrimitiveType<bytes, unknown>>
- The content hash object associated with an ENS node
getContextObject
Returns Web3ContextObject<EthExecutionAPI & Web3NetAPI, any>
getMaxListeners
Returns number
publicgetOwner
Returns the owner by the given name and current configured or detected Registry
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.
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
Returns the Resolver by the given address
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
Returns the address of the owner of an ENS name.
Parameters
name: string
The ENS name
Returns Promise<unknown>
- Returns the caching TTL (time-to-live) of a name.
publicisApprovedForAll
Returns true if the operator is approved to make ENS registry operations on behalf of the owner.
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
Type parameters
- T: Web3Context<unknown, any, T>
Parameters
parentContext: T
Returns void
listenerCount
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: CONFIG_CHANGE
Parameters
eventName: K
Returns Function[]
off
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
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
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
Returns true if the record exists
Parameters
name: string
The ENS name
Returns Promise<unknown>
- Returns
true
if node exists in this ENS registry. This will returnfalse
for records that are in the legacy ENS registry but have not yet been migrated to the new one.
registerPlugin
Parameters
plugin: Web3PluginBase<unknown>
Returns void
removeAllListeners
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
Sets or clears an approval by the given operator.
Parameters
operator: string
The operator address
approved: boolean
true
to set the approval,false
to clear ittxConfig: NonPayableCallOptions
(Optional) The transaction config
Returns Promise<TransactionReceipt | RevertInstructionError>
- The transaction receipt
setConfig
Parameters
options: Partial<Web3ConfigOptions>
Returns void
publicsetContenthash
Sets the content hash associated with an ENS node. Emits a
ContenthashChanged
event.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
Parameters
maxListenersWarningThreshold: number
Returns void
publicsetOwner
Sets the address of the owner of an ENS name.
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
Parameters
optionalprovider: string | SupportedProviders<EthExecutionAPI & Web3NetAPI>
Returns boolean
publicsetPubkey
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
Returns the address of the owner of an ENS name.
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
set the resolver of the given name
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
Creates a new subdomain of the given node, assigning ownership of it to the specified owner.
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
Sets the owner, resolver and TTL for a subdomain, creating it if necessary.
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
Sets the TTL of a name. Emits a NewTTL event.
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
Returns true if the related Resolver does support the given signature or interfaceId.
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
- T: Web3Context<unknown, any, T>
- T2: unknown[]
Parameters
ContextRef: Web3ContextConstructor<T, T2>
rest...args: [...T2[]]
Returns T
staticfromContextObject
Type parameters
- T: Web3Context<unknown, any, T>
- T3: unknown[]
Parameters
this: Web3ContextConstructor<T, T3>
rest...args: [Web3ContextObject<unknown, any>, ...T3[]]
Returns T
This class is designed to interact with the ENS system on the Ethereum blockchain.