/** * EVM X402 payment signing. * * Two schemes are supported and produce different envelopes: * * - `exact` — EIP-3009 `TransferWithAuthorization` against the token's own * EIP-712 domain. Pre-authorises the exact amount in the 402 response. * - `upto` — Permit2 `PermitWitnessTransferFrom` against the Permit2 EIP-712 * domain, with the AceData upto-proxy as spender. The signer authorises a * ceiling; the facilitator settles for any amount ≤ that ceiling at /record * time (zero settles with no on-chain transaction). * * Both work with any EIP-1193 provider (MetaMask, WalletConnect, etc.) — only * `eth_signTypedData_v4` is used. */ import type { EVMProvider, PaymentRequirement, X402PaymentEnvelope } from './types.js'; /** Canonical CREATE2 deployment of the Uniswap Permit2 contract. */ export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; /** Canonical CREATE2 deployment of the AceData upto-proxy spender. */ export declare const X402_UPTO_PERMIT2_PROXY_ADDRESS = "0x4020A4f3b7b90ccA423B9fabCc0CE57C6C240002"; export declare function signEVMPayment(requirements: PaymentRequirement, provider: EVMProvider, address: string): Promise; /** * Build the Permit2 `PermitWitnessTransferFrom` typed-data object. * * Mirrors the Python reference (`acedatacloud_x402.signing.evm._build_upto_typed_data`) * and the facilitator's `chain_handlers.upto_constants.build_upto_permit2_typed_data` * byte-for-byte: any drift breaks signature recovery. * * Critical: * - The Permit2 EIP-712 domain has **no** `version` field. Adding one * changes the digest and the facilitator recovers a different signer. * - The witness struct is named `Witness` (NOT `X402Witness`). * - The token's own domain is irrelevant — Permit2 holds the allowance. */ export declare function buildUptoTypedData(requirements: PaymentRequirement, params: { from: string; permittedAmount: bigint | string | number; nonce: bigint | string | number; deadline: bigint | string | number; validAfter: bigint | string | number; }): { types: { PermitWitnessTransferFrom: { name: string; type: string; }[]; TokenPermissions: { name: string; type: string; }[]; Witness: { name: string; type: string; }[]; }; primaryType: "PermitWitnessTransferFrom"; domain: { name: string; chainId: number; verifyingContract: string; }; message: { permitted: { token: string; amount: string; }; spender: string; nonce: string; deadline: string; witness: { to: string; facilitator: string; validAfter: string; }; }; }; /** * Sign a Permit2 `PermitWitnessTransferFrom` envelope (`upto` scheme). * * `requirements.maxAmountRequired` is the **ceiling** the payer signs over. * The facilitator may settle any amount `≤` that ceiling at `/record` time. * * The signer must have already approved Permit2 to pull the token — * see {@link approvePermit2} for the one-time on-chain approval. */ export declare function signEVMUptoPayment(requirements: PaymentRequirement, provider: EVMProvider, address: string, opts?: { validAfter?: number; deadlineBuffer?: number; nonce?: bigint | string; }): Promise;