import { BigNumber, providers } from 'ethers'; import { ApprovedRegistration, CommittedRegistration, RegistrationContext } from './types'; import { TLDBalanceVerificationResult, TLDEntry } from '../types/TLD'; import BaseRegistrar from '../BaseRegistrar'; export type { ApprovedRegistration, TLDBalanceVerificationResult, CommittedRegistration, TLDEntry, RegistrationContext }; /** * Class that handles TLD registration on Ethereum network. * Registration is done in 4 steps: * 1. Calling {@link requestApproval} to get registration approval. * 2. Calling {@link sendCommitment} to create commitment for registration. * 3. Waiting for 1 minute. * 4. Calling {@link register} to finish registration. * * **Note:** After approval is receieved, domain will be reserved for 30 minutes. Since process may fail on one of following steps, * it is recommended to save result of each step to be able to continue in case of failure. * @example * ```ts * import { registration } from '@decentraweb/core'; * const registrar = new registration.EthereumTLDRegistrar({ * network: network, * provider: provider, * signer: signer * }); * const approval = await registrar.requestApproval({ name: 'wallet', duration: registration.DURATION.ONE_YEAR }); * const commitment = await registrar.sendCommitment(approval); * await commitment.tx.wait(1); * // Wait for 1 minute * const tx = await registrar.register(commitment); * await tx.wait(1); * ``` */ export declare class EthereumTLDRegistrar extends BaseRegistrar { /** * Step 1. Normalizes domain names, calls the API to check if they are available and returns approval for registration. * Approved request is valid for 30 minutes. * @param request - one or more domain names and durations * @param owner - ETH address of the owner of created TLDs * @returns - ApprovedRegistration object that can be used to commit and register */ requestApproval(request: TLDEntry | Array, owner?: string): Promise; /** * Step 2. Creates a commitment for registration. Commitment is valid after 1 minute. * @param request - data returned from `requestApproval` step * @returns - object that can be used to register TLD */ sendCommitment(request: ApprovedRegistration): Promise; /** * Step 3. Finish TLD registration. This step can be called only 1 minute after `sendCommitment` step was completed. * Also, it will throw an error if signer balance is not enough to pay for registration. Registration considered * successful after 1st confirmation received. * @param request - data returned from `sendCommitment` step * @param isFeesInDweb - if true, fees will be paid in DWEB tokens, otherwise in ETH * @returns - Transaction response for registration */ register(request: CommittedRegistration, isFeesInDweb?: boolean): Promise; /** * Returns the price of registration in ETH and DWEB tokens and verifies if signer has enough balance to pay for registration. * @param request * @param isFeesInDweb */ verifySignerBalance(request: RegistrationContext, isFeesInDweb: boolean): Promise; /** * Returns the price of registration in wei * @param entry - domain name and duration * @param isFeesInDweb - if true, registration fee will be paid in DWEB tokens, otherwise in ETH * @returns - amount in wei */ getRentPrice({ name, duration }: TLDEntry, isFeesInDweb?: boolean): Promise; /** * Returns the price of registration in wei for multiple domains * @param requests - array of domain names and durations * @param isFeesInDweb - if true, registration fee will be paid in DWEB tokens, otherwise in ETH * @returns - total amount in wei */ getRentPriceBatch(requests: Array, isFeesInDweb: boolean): Promise; } export default EthereumTLDRegistrar;