import type { Account, Address, Chain, Client, Hash, Transport, WriteContractErrorType } from 'viem'; import type { Prettify, WriteTransactionParameters } from '../../../../types/index.js'; import { type ClientWithOverridesErrorType } from '../../../../utils/clientWithOverrides.js'; export type CreateSubnameWriteParametersParameters = { /** The parent registry address */ registryAddress: Address; /** The label of the subname to create */ label: string; /** The owner address of the new subname */ owner: Address; /** The subregistry address for the new subname (use address(0) for no subregistry) */ subregistryAddress: Address; /** The resolver address for the new subname */ resolverAddress: Address; /** The role bitmap to grant to the owner */ roleBitmap: bigint; /** The expiration timestamp in seconds (defaults to one year from now) */ expires?: bigint; }; export type CreateSubnameWriteParametersReturnType = ReturnType; export declare const createSubnameWriteParameters: (client: Client, { registryAddress, label, owner, subregistryAddress, resolverAddress, roleBitmap, expires, }: CreateSubnameWriteParametersParameters) => { readonly address: `0x${string}`; readonly abi: readonly [{ readonly inputs: readonly [{ readonly name: "label"; readonly type: "string"; }, { readonly name: "owner"; readonly type: "address"; }, { readonly name: "registry"; readonly type: "address"; }, { readonly name: "resolver"; readonly type: "address"; }, { readonly name: "roleBitmap"; readonly type: "uint256"; }, { readonly name: "expiry"; readonly type: "uint64"; }]; readonly name: "register"; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; readonly stateMutability: "nonpayable"; readonly type: "function"; }]; readonly functionName: "register"; readonly args: readonly [string, `0x${string}`, `0x${string}`, `0x${string}`, bigint, bigint]; readonly chain: chain; readonly account: Account; }; export type CreateSubnameParameters = Prettify>; export type CreateSubnameReturnType = Hash; export type CreateSubnameErrorType = ClientWithOverridesErrorType | WriteContractErrorType; /** * Creates a subname in a UserRegistry using the register function (V2). * @param client - {@link Client} * @param parameters - {@link CreateSubnameParameters} * @returns Transaction hash. {@link CreateSubnameReturnType} * * @example * import { createWalletClient, custom } from 'viem' * import { mainnet } from 'viem/chains' * import { createSubname } from '@ensdomains/ensjs/wallet/v2' * * const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) * const wallet = createWalletClient({ * account, * chain: mainnet, * transport: custom(window.ethereum), * }) * const hash = await createSubname(wallet, { * registryAddress: '0x...', // parent registry * label: 'mysubname', * owner: '0x...', * subregistryAddress: '0x0000000000000000000000000000000000000000', * resolverAddress: '0x...', * roleBitmap: 0n, // or encoded role bitmap * // expires: optional, defaults to one year from now * }) * // 0x... */ export declare function createSubname(client: Client, { registryAddress, label, owner, subregistryAddress, resolverAddress, roleBitmap, expires, ...txArgs }: CreateSubnameParameters): Promise; //# sourceMappingURL=createSubname.d.ts.map