import { BigNumber, ethers, providers } from 'ethers'; import { TLDBalanceVerificationResult, TLDEntry } from '../types/TLD'; import { CommittedRegistration } from './types'; import BaseRegistrar, { RegistrarConfig } from '../BaseRegistrar'; import { PolygonNetwork } from '../../types/common'; interface Config extends RegistrarConfig { network: PolygonNetwork; } /** * Class that handles TLD registration on Polygon network. * Registration is done in 2 steps: * 1. Calling {@link sendCommitment} to get registration approval. * 2. Calling {@link register} to finish registration. * @example * ```ts * 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); * ``` */ declare class PolygonTLDRegistrar extends BaseRegistrar { readonly network: PolygonNetwork; readonly wethToken: ethers.Contract; constructor(options: Config); /** * Step 1. Normalizes domain names, calls the API to check if they are available and returns approval for registration. * @param request - domain name and duration pairs * @param isFeesInDweb - if true, registration fee will be paid in DWEB tokens, otherwise in WETH * @param owner - ETH address of the owner of created subdomains, defaults to signer address */ sendCommitment(request: TLDEntry | Array, isFeesInDweb?: boolean, owner?: string): Promise; /** * Step 2. Finish TLD registration. This step must be called 1 minute after `sendCommitment` step was completed. * @param request - data returned from `sendCommitment` step */ register(request: CommittedRegistration): Promise; /** {@inheritDoc EthereumTLDRegistrar.verifySignerBalance} */ verifySignerBalance(request: TLDEntry | Array, isFeesInDweb?: boolean): Promise; /** * Returns the price of registration in wei * @param {TLDEntry} entry - domain name and duration * @param {boolean} isFeesInDweb - if true, registration fee will be paid in DWEB tokens, otherwise in WETH * @returns {Promise} - amount in wei */ getRentPrice({ name, duration }: TLDEntry, isFeesInDweb?: boolean): Promise; /** * Returns the price of registration in wei for multiple domains * @param {Array} requests - array of domain names and durations * @param {boolean} isFeesInDweb - if true, registration fee will be paid in DWEB tokens, otherwise in WETH * @returns {Promise} - total amount in wei */ getRentPriceBatch(requests: Array, isFeesInDweb: boolean): Promise; } export default PolygonTLDRegistrar;