/** * Asset transfer methods for the exact EVM scheme. * - eip3009: Uses transferWithAuthorization (USDC, etc.) - recommended for compatible tokens * - permit2: Uses Permit2 + x402Permit2Proxy - universal fallback for any ERC-20 */ type AssetTransferMethod = "eip3009" | "permit2"; /** * EIP-3009 payload for tokens with native transferWithAuthorization support. */ type ExactEIP3009Payload = { signature?: `0x${string}`; authorization: { from: `0x${string}`; to: `0x${string}`; value: string; validAfter: string; validBefore: string; nonce: `0x${string}`; }; }; /** * Permit2 witness data structure. * Matches the Witness struct in x402Permit2Proxy contract. * Note: Upper time bound is enforced by Permit2's `deadline` field, not a witness field. */ type Permit2Witness = { to: `0x${string}`; validAfter: string; }; /** * Permit2 authorization parameters. * Used to reconstruct the signed message for verification. */ type Permit2Authorization = { permitted: { token: `0x${string}`; amount: string; }; spender: `0x${string}`; nonce: string; deadline: string; witness: Permit2Witness; }; /** * Permit2 payload for tokens using the Permit2 + x402Permit2Proxy flow. */ type ExactPermit2Payload = { signature: `0x${string}`; permit2Authorization: Permit2Authorization & { from: `0x${string}`; }; }; type ExactEvmPayloadV1 = ExactEIP3009Payload; type ExactEvmPayloadV2 = ExactEIP3009Payload | ExactPermit2Payload; /** * Type guard to check if a payload is a Permit2 payload. * Permit2 payloads have a `permit2Authorization` field. * * @param payload - The payload to check. * @returns True if the payload is a Permit2 payload, false otherwise. */ declare function isPermit2Payload(payload: ExactEvmPayloadV2): payload is ExactPermit2Payload; /** * Type guard to check if a payload is an EIP-3009 payload. * EIP-3009 payloads have an `authorization` field. * * @param payload - The payload to check. * @returns True if the payload is an EIP-3009 payload, false otherwise. */ declare function isEIP3009Payload(payload: ExactEvmPayloadV2): payload is ExactEIP3009Payload; /** * Upto Permit2 witness — includes `facilitator` field absent from exact witness. * Only the address matching `witness.facilitator` can call settle() on-chain. */ type UptoPermit2Witness = { to: `0x${string}`; facilitator: `0x${string}`; validAfter: string; }; type UptoPermit2Authorization = { permitted: { token: `0x${string}`; amount: string; }; spender: `0x${string}`; nonce: string; deadline: string; witness: UptoPermit2Witness; }; type UptoPermit2Payload = { signature: `0x${string}`; permit2Authorization: UptoPermit2Authorization & { from: `0x${string}`; }; }; /** * Type guard to check if a payload is an upto Permit2 payload. * Validates structural presence of all required fields: signature, permit2Authorization * (with from, permitted, spender, nonce, deadline), and a witness containing facilitator. * * @param payload - The payload to check. * @returns True if the payload is an upto Permit2 payload, false otherwise. */ declare function isUptoPermit2Payload(payload: Record): payload is UptoPermit2Payload; export { type AssetTransferMethod as A, type ExactEIP3009Payload as E, type Permit2Authorization as P, type UptoPermit2Authorization as U, type ExactEvmPayloadV1 as a, type ExactEvmPayloadV2 as b, type ExactPermit2Payload as c, type Permit2Witness as d, type UptoPermit2Payload as e, type UptoPermit2Witness as f, isPermit2Payload as g, isUptoPermit2Payload as h, isEIP3009Payload as i };