import type { Account, Address, Chain, GetChainContractAddressErrorType, Hash, WriteContractErrorType } from 'viem'; import type { ChainWithContracts, RequireClientContracts } from '../../../../clients/chain.js'; import { AdditionalParameterSpecifiedError, RequiredParameterNotSpecifiedError } from '../../../../errors/general.js'; import type { ErrorType } from '../../../../errors/utils.js'; import type { Eth2ldNameSpecifier, GetNameType, WriteTransactionParameters } from '../../../../types/index.js'; import { type ClientWithOverridesErrorType } from '../../../../utils/clientWithOverrides.js'; import { type MakeLabelNodeAndParentErrorType } from '../../../../utils/name/makeLabelNodeAndParent.js'; export type UnwrapNameWriteParametersParameters = { /** The name to unwrap */ name: name; /** The recipient of the unwrapped name */ newOwnerAddress: Address; /** The registrant of the unwrapped name (eth-2ld only) */ newRegistrantAddress?: Address; } & (GetNameType extends Eth2ldNameSpecifier ? { newRegistrantAddress: Address; } : { newRegistrantAddress?: never; }); export type UnwrapNameWriteParametersErrorType = MakeLabelNodeAndParentErrorType | AdditionalParameterSpecifiedError | RequiredParameterNotSpecifiedError | GetChainContractAddressErrorType | ErrorType; export declare const unwrapNameWriteParameters: (client: RequireClientContracts, { name, newOwnerAddress, newRegistrantAddress, }: UnwrapNameWriteParametersParameters) => { readonly address: `0x${string}`; readonly abi: readonly [{ readonly inputs: readonly []; readonly name: "CannotUpgrade"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "IncompatibleParent"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "owner"; readonly type: "address"; }]; readonly name: "IncorrectTargetOwner"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "IncorrectTokenType"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "labelHash"; readonly type: "bytes32"; }, { readonly name: "expectedLabelhash"; readonly type: "bytes32"; }]; readonly name: "LabelMismatch"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "LabelTooLong"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "LabelTooShort"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "NameIsNotWrapped"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "node"; readonly type: "bytes32"; }]; readonly name: "OperationProhibited"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "node"; readonly type: "bytes32"; }, { readonly name: "addr"; readonly type: "address"; }]; readonly name: "Unauthorised"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "labelhash"; readonly type: "bytes32"; }, { readonly name: "registrant"; readonly type: "address"; }, { readonly name: "controller"; readonly type: "address"; }]; readonly name: "unwrapETH2LD"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; readonly functionName: "unwrapETH2LD"; readonly args: readonly [`0x${string}`, `0x${string}`, `0x${string}`]; readonly chain: Omit & { contracts: { ensNameWrapper: 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 address: `0x${string}`; readonly abi: readonly [{ readonly inputs: readonly []; readonly name: "CannotUpgrade"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "IncompatibleParent"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "owner"; readonly type: "address"; }]; readonly name: "IncorrectTargetOwner"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "IncorrectTokenType"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "labelHash"; readonly type: "bytes32"; }, { readonly name: "expectedLabelhash"; readonly type: "bytes32"; }]; readonly name: "LabelMismatch"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }]; readonly name: "LabelTooLong"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "LabelTooShort"; readonly type: "error"; }, { readonly inputs: readonly []; readonly name: "NameIsNotWrapped"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "node"; readonly type: "bytes32"; }]; readonly name: "OperationProhibited"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "node"; readonly type: "bytes32"; }, { readonly name: "addr"; readonly type: "address"; }]; readonly name: "Unauthorised"; readonly type: "error"; }, { readonly inputs: readonly [{ readonly name: "parentNode"; readonly type: "bytes32"; }, { readonly name: "labelhash"; readonly type: "bytes32"; }, { readonly name: "controller"; readonly type: "address"; }]; readonly name: "unwrap"; readonly outputs: readonly []; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; readonly functionName: "unwrap"; readonly args: readonly [`0x${string}`, `0x${string}`, `0x${string}`]; readonly chain: Omit & { contracts: { ensNameWrapper: 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; }; export type UnwrapNameParameters> = UnwrapNameWriteParametersParameters & WriteTransactionParameters; export type UnwrapNameReturnType = Hash; export type UnwrapNameErrorType = UnwrapNameWriteParametersErrorType | ClientWithOverridesErrorType | WriteContractErrorType; /** * Unwraps a name. * @param client - {@link Client} * @param options - {@link UnwrapNameParameters} * @returns Transaction hash. {@link UnwrapNameReturnType} * * @example * import { createWalletClient, custom } from 'viem' * import { mainnet } from 'viem/chains' * import { addEnsContracts } from '@ensdomains/ensjs' * import { unwrapName } from '@ensdomains/ensjs/wallet/v1' * * const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) * const wallet = createWalletClient({ * account, * chain: addEnsContracts(mainnet), * transport: custom(window.ethereum), * }) * const hash = await unwrapName(wallet, { * name: 'example.eth', * newOwnerAddress: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7', * newRegistrantAddress: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7', * }) * // 0x... */ export declare function unwrapName>(client: RequireClientContracts, { name, newOwnerAddress, newRegistrantAddress, ...txArgs }: UnwrapNameParameters): Promise; //# sourceMappingURL=unwrapName.d.ts.map