Class that handles subdomain registration. Registration is done in 2 steps:

  1. Calling approveSelfRegistration or approveOndemandRegistration to get registration approval.
  2. Calling finishRegistration to finish registration.

Example

Register subdomain "john" for domain "wallet" owned by signer and pay in ETH

const subdomainRegistrar = new SubdomainRegistrar({
network: network,
provider: provider,
signer: signer
});
const registration = await subdomainRegistrar.approveSelfRegistration({ name: 'wallet', label: 'john' });
const tx = await subdomainRegistrar.finishRegistration(registration);
await tx.wait(1);

Hierarchy

  • BaseRegistrar
    • SubdomainRegistrar

Constructors

Properties

DecentraWeb API wrapper instance

chainId: number
contract: Contract
contractConfig: ContractConfig
dwebToken: Contract

DWEB token contract

network: Network

Current network name

provider: BaseProvider
signer: Signer

Ethers.js Ethereum signer for writing data to the blockchain

wethToken?: Contract

WETH token contract, only available on the Polygon network

Accessors

Methods

  • Approve unlimited token usage by the registrar contract, so no further approvals are needed

    Parameters

    • token: "DWEB" | "WETH"

      token name. WETH is only supported on the Polygon network

    Returns Promise<TransactionReceipt>

  • Get DWEB/WETH token amount that can be used by the registrar contract

    Parameters

    • token: "DWEB" | "WETH"

      token name. WETH is only supported on the Polygon network

    Returns Promise<BigNumber>

  • Get DWEB/WETH token balance of the signer

    Parameters

    • token: "DWEB" | "WETH"

      token name. WETH is only supported on the Polygon network

    Returns Promise<BigNumber>

  • Approve the DWEB/WETH token amount that can be used by the registrar contract

    Parameters

    • token: "DWEB" | "WETH"

      token name. WETH is only supported on the Polygon network

    • amount: BigNumber

      amount in wei

    Returns Promise<TransactionReceipt>

Generated using TypeDoc