Class that handles TLD registration on Polygon network. Registration is done in 2 steps:

  1. Calling sendCommitment to get registration approval.
  2. Calling register to finish registration.

Example

import { registration } from '@decentraweb/core';

const registrar = new registration.PolygonTLDRegistrar({
network: network as any,
provider: provider,
signer: signer
});

const registration = await registrar.sendCommitment({ name: 'wallet', duration: registration.DURATION.ONE_YEAR });
const tx = await registrar.register(registration);
await tx.wait(1);

Hierarchy

  • BaseRegistrar
    • PolygonTLDRegistrar

Constructors

Properties

DecentraWeb API wrapper instance

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

DWEB token contract

provider: BaseProvider
signer: Signer

Ethers.js Ethereum signer for writing data to the blockchain

wethToken: Contract

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>

  • Returns the price of registration in wei

    Parameters

    • entry: TLDEntry

      domain name and duration

    • isFeesInDweb: boolean = false

      if true, registration fee will be paid in DWEB tokens, otherwise in WETH

    Returns Promise<BigNumber>

    • amount in wei
  • Returns the price of registration in wei for multiple domains

    Parameters

    • requests: TLDEntry[]

      array of domain names and durations

    • isFeesInDweb: boolean

      if true, registration fee will be paid in DWEB tokens, otherwise in WETH

    Returns Promise<BigNumber>

    • total amount in wei
  • 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>

  • Step 2. Finish TLD registration. This step must be called 1 minute after sendCommitment step was completed.

    Parameters

    • request: CommittedRegistration

      data returned from sendCommitment step

    Returns Promise<TransactionResponse>

  • Step 1. Normalizes domain names, calls the API to check if they are available and returns approval for registration.

    Parameters

    • request: TLDEntry | TLDEntry[]

      domain name and duration pairs

    • isFeesInDweb: boolean = false

      if true, registration fee will be paid in DWEB tokens, otherwise in WETH

    • Optional owner: string

      ETH address of the owner of created subdomains, defaults to signer address

    Returns Promise<CommittedRegistration>

  • 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