import { signTypedData as _signTypedData } from 'viem/actions'; import type { Account, Address, BaseUnits, NativeUnits } from '../types.js'; import type { Chain, Client } from 'viem'; /** * Parameters for the {@link signEIP2612Permit} function. */ export type SignEIP2612PermitParams = { /** * The token contract address or contract object that supports EIP-2612 permit functionality. */ token: Address | { address: Address; }; /** * The account that owns the tokens and will sign the permit. */ owner: Address | Account; /** * The account that will be granted permission to spend the tokens. */ spender: Address | Account; /** * The amount of tokens to permit for spending. */ value: NativeUnits | BaseUnits; /** * The deadline timestamp for the permit. Defaults to maximum uint256 value. */ deadline?: bigint; /** * The blockchain network on which the permit will be created. */ chain?: Chain; /** * The name of the token. Defaults to the name of the token contract. */ name?: string; /** * The version of the token. Defaults to the version of the token contract. If the token contract does not have a version, defaults to '1'. */ version?: string; }; /** * Return type for the signEIP2612Permit function. */ export type SignEIP2612PermitReturnType = ReturnType; /** * Creates a signed EIP-2612 permit * * @param client - The client instance. * @param params - The permit parameters. * @returns An object containing the typed data structure and signature. * * @example * Creating a permit for USDC spending * ```typescript * const permit = await client.signEIP2612Permit({ * token: client.chain.contracts.USDC, * owner: '0x0000000000000000000000000000000000000000', * spender: '0x1111111111111111111111111111111111111111', * value: 1000000n, // 1 USDC (6 decimals) * }) * ``` * * @example * Creating a permit with custom deadline * ```typescript * const permit = await client.signEIP2612Permit({ * token: '0x...', * owner: account1, * spender: account2, * value: '100', * deadline: BigInt(Math.floor(Date.now() / 1000) + 3600), // 1 hour from now * }) * ``` */ export declare function signEIP2612Permit(client: Client, params: SignEIP2612PermitParams): Promise<{ typedData: { readonly types: { readonly EIP712Domain: readonly [{ readonly name: "name"; readonly type: "string"; }, { readonly name: "version"; readonly type: "string"; }, { readonly name: "chainId"; readonly type: "uint256"; }, { readonly name: "verifyingContract"; readonly type: "address"; }]; readonly Permit: readonly [{ readonly name: "owner"; readonly type: "address"; }, { readonly name: "spender"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }, { readonly name: "nonce"; readonly type: "uint256"; }, { readonly name: "deadline"; readonly type: "uint256"; }]; }; readonly primaryType: "Permit"; readonly domain: { readonly name: string; readonly version: string; readonly chainId: bigint; readonly verifyingContract: `0x${string}`; }; readonly message: { readonly owner: `0x${string}`; readonly spender: `0x${string}`; readonly value: bigint; readonly nonce: bigint; readonly deadline: bigint; }; }; signature: `0x${string}`; r: `0x${string}`; s: `0x${string}`; yParity: number; v: number; }>;