import { BaseError, type Address, type Hex } from 'viem'; import type { ClientWithPns } from '../../contracts/consts.js'; import type { SimpleTransactionRequest } from '../../types.js'; import { type OwnerContract } from '../../utils/ownerFromContract.js'; export type GetOwnerParameters = { /** Name to get owner for */ name: string; /** Optional specific contract to get ownership value from */ contract?: TContract; }; type BaseGetOwnerReturnType = { /** Owner of the name */ owner?: Address | null; /** Registrant of the name (registrar owner) */ registrant?: Address | null; /** The contract level that the ownership is on */ ownershipLevel: 'registry' | 'registrar' | 'nameWrapper'; }; type RegistrarOnlyOwnership = { owner?: never; registrant: Address; ownershipLevel: 'registrar'; }; type WrappedOwnership = { owner: Address; registrant?: never; ownershipLevel: 'nameWrapper'; }; type UnwrappedPls2ldOwnership = { registrant: Address | null; owner: Address; ownershipLevel: 'registrar'; }; type UnwrappedOwnership = { owner: Address; registrant?: never; ownershipLevel: 'registry'; }; export type GetOwnerReturnType = (BaseGetOwnerReturnType & (TContract extends 'registrar' ? RegistrarOnlyOwnership : TContract extends 'nameWrapper' ? WrappedOwnership : TContract extends 'registry' ? UnwrappedOwnership : WrappedOwnership | UnwrappedPls2ldOwnership | UnwrappedOwnership)) | null; declare const encode: (client: ClientWithPns, { name, contract }: GetOwnerParameters) => SimpleTransactionRequest; declare const decode: (client: ClientWithPns, data: Hex | BaseError, { name, contract }: GetOwnerParameters) => Promise>; type EncoderFunction = typeof encode; type DecoderFunction = typeof decode; type BatchableFunctionObject = { encode: EncoderFunction; decode: DecoderFunction; batch: = GetOwnerParameters>(args: TParams) => { args: [TParams]; encode: EncoderFunction; decode: typeof decode; }; }; /** * Gets the owner(s) of a name. * @param client - {@link ClientWithPns} * @param parameters - {@link GetOwnerParameters} * @returns Owner data object, or `null` if no owners exist. {@link GetOwnerReturnType} * * @example * import { createPublicClient, http } from 'viem' * import { mainnet } from 'viem/chains' * import { addPnsContracts } from '@pnsdomains/pnsjs' * import { getOwner } from '@pnsdomains/pnsjs/public' * * const client = createPublicClient({ * chain: addPnsContracts(mainnet), * transport: http(), * }) * const result = await getOwner(client, { name: 'pns.pls' }) * // { owner: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', registrant: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', ownershipLevel: 'registrar } */ declare const getOwner: ((client: ClientWithPns, { name, contract }: GetOwnerParameters) => Promise>) & BatchableFunctionObject; export default getOwner; //# sourceMappingURL=getOwner.d.ts.map