import type { Account, Address, Chain, GetChainContractAddressErrorType, Hex, WriteContractErrorType, WriteContractReturnType } from 'viem'; import type { ChainWithContracts, RequireClientContracts } from '../../../clients/chain.js'; import { UnsupportedNameTypeError } from '../../../errors/general.js'; import type { Prettify, WriteTransactionParameters } from '../../../types/index.js'; import { type ClientWithOverridesErrorType } from '../../../utils/clientWithOverrides.js'; type RenewerContract = 'ensEthRegistrar' | 'ensEthRenewerV1'; export type RenewNameWriteParametersParameters = { /** Full 2LD .eth name to renew (e.g. example.eth) */ name: string; /** Renewal duration in seconds */ duration: bigint; /** ERC-20 token used for payment (must be approved for the renewer) */ paymentToken: Address; /** * Referrer id (bytes32). Defaults to zero bytes32 when omitted. */ referrer?: Hex; /** * Renewer contract to use: `ensEthRegistrar` for names registered on v2, * `ensEthRenewerV1` for unmigrated legacy (v1) names. */ contract: RenewerContract; }; export type RenewNameWriteParametersReturnType = ReturnType; export type RenewNameWriteParametersErrorType = UnsupportedNameTypeError | GetChainContractAddressErrorType; export declare const renewNameWriteParameters: (client: RequireClientContracts, { name, duration, paymentToken, referrer, contract, }: RenewNameWriteParametersParameters) => { readonly address: `0x${string}`; readonly functionName: "renew"; readonly args: readonly [{ readonly label: string; readonly duration: bigint; readonly referrer: `0x${string}`; }, `0x${string}`]; readonly chain: Omit & { contracts: { ensEthRenewerV1: import("viem").ChainContract; ensEthRegistrar: import("viem").ChainContract; }; } & { blockExplorers?: { [key: string]: { name: string; url: string; apiUrl?: string | undefined; }; default: { name: string; url: string; apiUrl?: string | undefined; }; } | undefined; blockTime?: number | undefined; contracts?: import("viem").Prettify<{ [key: string]: import("viem").ChainContract | { [sourceId: number]: import("viem").ChainContract | undefined; } | undefined; } & { ensRegistry?: import("viem").ChainContract | undefined; ensUniversalResolver?: import("viem").ChainContract | undefined; multicall3?: import("viem").ChainContract | undefined; erc6492Verifier?: import("viem").ChainContract | undefined; }> | undefined; ensTlds?: readonly string[] | undefined; id: number; name: string; nativeCurrency: { name: string; symbol: string; decimals: number; }; experimental_preconfirmationTime?: number | undefined; rpcUrls: { [key: string]: { http: readonly string[]; webSocket?: readonly string[] | undefined; }; default: { http: readonly string[]; webSocket?: readonly string[] | undefined; }; }; sourceId?: number | undefined; supportsTransactionReplacementDetection?: boolean | undefined; testnet?: boolean | undefined; } & import("viem").ChainConfig | undefined>; readonly account: Account; readonly abi: readonly [{ readonly inputs: readonly [{ readonly name: "duration"; readonly type: "uint64"; }, { readonly name: "minDuration"; readonly type: "uint64"; }]; readonly name: "DurationTooShort"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "NameNotRenewable"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "paymentToken"; readonly type: "address"; }]; readonly name: "PaymentTokenNotSupported"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "token"; readonly type: "address"; }]; readonly name: "SafeERC20FailedOperation"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "rd"; readonly type: "tuple"; readonly components: readonly [{ readonly name: "label"; readonly type: "string"; }, { readonly name: "duration"; readonly type: "uint64"; }, { readonly name: "referrer"; readonly type: "bytes32"; }]; }, { readonly name: "paymentToken"; readonly type: "address"; }]; readonly name: "renew"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; }; export type RenewNameParameters | undefined> = Prettify>; export type RenewNameReturnType = WriteContractReturnType; export type RenewNameErrorType = RenewNameWriteParametersErrorType | ClientWithOverridesErrorType | WriteContractErrorType; /** * Renews a `.eth` 2LD via the given renewer contract: the v2 `ETHRegistrar` * (`contract: 'ensEthRegistrar'`) for names registered on v2, or `ETHRenewerV1` * (`contract: 'ensEthRenewerV1'`) for unmigrated legacy (v1) names. Both expose * the same `renew((label,duration,referrer),paymentToken)` ERC-20 interface, so * `contract` only selects the target address — resolve it from your data source * (indexer) or an on-chain owner lookup ({@link getOwner}). * * Legacy `ETHRegistrarController`s were revoked at the v2 migration cutover, so an * unmigrated v1 name can only be renewed through `ETHRenewerV1`, which renews it * and syncs the underlying v1 BaseRegistrar. It renews a name while it still holds * its pre-migration `RESERVED` slot (throughout the name's active life), or — once * that slot has lapsed to `AVAILABLE` — while it is still unclaimed and within the * v2 grace window; a name that was never reserved, has already migrated to v2, or * has lapsed past grace reverts `NameNotRenewable`. * * Renews a single name. Both renewers also expose * `renewBatch(RenewData[],paymentToken)`, which this action does not wrap. * * @param client - {@link Client} * @param options - {@link RenewNameParameters} * @returns Transaction hash. {@link RenewNameReturnType} * * @example * import { createWalletClient, custom } from 'viem' * import { sepolia } from 'viem/chains' * import { addEnsContracts } from '@ensdomains/ensjs' * import { renewName } from '@ensdomains/ensjs/wallet' * * const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) * const wallet = createWalletClient({ * account, * chain: addEnsContracts(sepolia), * transport: custom(window.ethereum), * }) * * // The renewer must be approved to spend the renewal price in `paymentToken` * // first (see `getRenewPrice`) * const hash = await renewName(wallet, { * name: 'example.eth', * duration: 31536000n, // 1 year * paymentToken: '0x240b0316Df57887DBBE58b586508b19e633a14aa', // USDC (Sepolia) * contract: 'ensEthRegistrar', * }) * // 0x... */ export declare function renewName | undefined>(client: RequireClientContracts, { name, duration, paymentToken, referrer, contract, ...txArgs }: RenewNameParameters): Promise; export {}; //# sourceMappingURL=renewName.d.ts.map