import { type Account, type Address, type Hash, type Transport } from 'viem'; import type { ChainWithEns, ClientWithAccount } from '../../contracts/consts.js'; import type { Eth2ldName, Eth2ldNameSpecifier, GetNameType, SimpleTransactionRequest, WriteTransactionParameters } from '../../types.js'; type BaseUnwrapNameDataParameters = { /** The name to unwrap */ name: TName; /** The recipient of the unwrapped name */ newOwnerAddress: Address; /** The registrant of the unwrapped name (eth-2ld only) */ newRegistrantAddress?: Address; }; type Eth2ldUnwrapNameDataParameters = { name: Eth2ldName; newRegistrantAddress: Address; }; type OtherUnwrapNameDataParameters = { name: string; newRegistrantAddress?: never; }; export type UnwrapNameDataParameters = GetNameType> = BaseUnwrapNameDataParameters & (TNameType extends Eth2ldNameSpecifier ? Eth2ldUnwrapNameDataParameters : OtherUnwrapNameDataParameters); export type UnwrapNameDataReturnType = SimpleTransactionRequest; export type UnwrapNameParameters = UnwrapNameDataParameters & WriteTransactionParameters; export type UnwrapNameReturnType = Hash; export declare const makeFunctionData: (wallet: ClientWithAccount, { name, newOwnerAddress, newRegistrantAddress, }: UnwrapNameDataParameters) => UnwrapNameDataReturnType; /** * Unwraps a name. * @param wallet - {@link ClientWithAccount} * @param parameters - {@link UnwrapNameParameters} * @returns Transaction hash. {@link UnwrapNameReturnType} * * @example * import { createWalletClient, custom } from 'viem' * import { mainnet } from 'viem/chains' * import { addEnsContracts } from '@etn-sc/ensjs' * import { unwrapName } from '@etn-sc/ensjs/wallet' * * const wallet = createWalletClient({ * chain: addEnsContracts(mainnet), * transport: custom(window.ethereum), * }) * const hash = await unwrapName(wallet, { * name: 'example.eth', * newOwnerAddress: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7', * newRegistrantAddress: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7', * }) * // 0x... */ declare function unwrapName(wallet: ClientWithAccount, { name, newOwnerAddress, newRegistrantAddress, ...txArgs }: UnwrapNameParameters): Promise; declare namespace unwrapName { var makeFunctionData: (wallet: ClientWithAccount, { name, newOwnerAddress, newRegistrantAddress, }: UnwrapNameDataParameters) => UnwrapNameDataReturnType; } export default unwrapName;