import { type Account, type Address, type Hash, type Transport } from 'viem'; import type { ChainWithPns, ClientWithAccount } from '../../contracts/consts.js'; import type { Pls2ldName, Pls2ldNameSpecifier, 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 (pls-2ld only) */ newRegistrantAddress?: Address; }; type Pls2ldUnwrapNameDataParameters = { name: Pls2ldName; newRegistrantAddress: Address; }; type OtherUnwrapNameDataParameters = { name: string; newRegistrantAddress?: never; }; export type UnwrapNameDataParameters = GetNameType> = BaseUnwrapNameDataParameters & (TNameType extends Pls2ldNameSpecifier ? Pls2ldUnwrapNameDataParameters : 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 { addPnsContracts } from '@pnsdomains/pnsjs' * import { unwrapName } from '@pnsdomains/pnsjs/wallet' * * const wallet = createWalletClient({ * chain: addPnsContracts(mainnet), * transport: custom(window.ethereum), * }) * const hash = await unwrapName(wallet, { * name: 'example.pls', * 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>) => SimpleTransactionRequest; } export default unwrapName; //# sourceMappingURL=unwrapName.d.ts.map