export { E as ExactEvmScheme } from './scheme-B1OAu4_v.mjs'; import { F as FacilitatorEvmSigner } from './signer-B127taDR.mjs'; export { C as ClientEvmSigner, t as toClientEvmSigner, a as toFacilitatorEvmSigner } from './signer-B127taDR.mjs'; export { a as PERMIT2_ADDRESS, P as Permit2AllowanceParams, d as authorizationTypes, c as createPermit2ApprovalTx, f as eip3009ABI, e as erc20AllowanceAbi, g as getPermit2AllowanceReadParams, p as permit2WitnessTypes, u as uptoPermit2WitnessTypes, h as x402ExactPermit2ProxyABI, x as x402ExactPermit2ProxyAddress, i as x402UptoPermit2ProxyABI, b as x402UptoPermit2ProxyAddress } from './permit2-DhJRUcgY.mjs'; export { UptoEvmScheme } from './upto/client/index.mjs'; export { a as BatchSettlementEvmScheme } from './scheme-D1gMCg6J.mjs'; export { A as AuthorizerSigner, i as BatchSettlementClaimPayload, e as BatchSettlementDepositPayload, j as BatchSettlementEnrichedRefundPayload, h as BatchSettlementErc3009Authorization, m as BatchSettlementFacilitatorSettlePayload, k as BatchSettlementPayload, n as BatchSettlementPaymentRequirementsExtra, o as BatchSettlementPaymentResponseExtra, g as BatchSettlementRefundPayload, l as BatchSettlementSettlePayload, B as BatchSettlementVoucherClaim, a as BatchSettlementVoucherFields, f as BatchSettlementVoucherPayload, C as ChannelConfig, d as ChannelState, s as isBatchSettlementClaimPayload, p as isBatchSettlementDepositPayload, u as isBatchSettlementEnrichedRefundPayload, r as isBatchSettlementRefundPayload, t as isBatchSettlementSettlePayload, q as isBatchSettlementVoucherPayload } from './types-DIt9uAUy.mjs'; import { Network, FacilitatorContext, PaymentPayload, PaymentRequirements, FacilitatorExtension } from '@x402/core/types'; import { Hex, TypedDataDomain } from 'viem'; export { AuthCaptureEvmScheme } from './auth-capture/client/index.mjs'; import './rpc-DULZzRne.mjs'; import './storage-6W5MO46W.mjs'; /** * 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; /** Scheme identifier for the batch-settlement payment scheme. */ declare const BATCH_SETTLEMENT_SCHEME: "batch-settlement"; /** Deployed address of the x402BatchSettlement contract. */ declare const BATCH_SETTLEMENT_ADDRESS: "0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003"; /** Deployed address of the ERC3009DepositCollector contract. */ declare const ERC3009_DEPOSIT_COLLECTOR_ADDRESS: "0x4020806089470a89826cB9fB1f4059150b550004"; /** EIP-712 domain fields shared across all batch-settlement typed-data signatures. */ declare const BATCH_SETTLEMENT_DOMAIN: { readonly name: "x402 Batch Settlement"; readonly version: "1"; }; /** EIP-712 type definition for a cumulative voucher: `Voucher(bytes32 channelId, uint128 maxClaimableAmount)`. */ declare const voucherTypes: { readonly Voucher: readonly [{ readonly name: "channelId"; readonly type: "bytes32"; }, { readonly name: "maxClaimableAmount"; readonly type: "uint128"; }]; }; /** EIP-712 type definition for cooperative refund: `Refund(bytes32 channelId, uint256 nonce, uint128 amount)`. */ declare const refundTypes: { readonly Refund: readonly [{ readonly name: "channelId"; readonly type: "bytes32"; }, { readonly name: "nonce"; readonly type: "uint256"; }, { readonly name: "amount"; readonly type: "uint128"; }]; }; /** EIP-712 type definitions for a receiver-authorizer claim batch (nested ClaimEntry). */ declare const claimBatchTypes: { readonly ClaimBatch: readonly [{ readonly name: "claims"; readonly type: "ClaimEntry[]"; }]; readonly ClaimEntry: readonly [{ readonly name: "channelId"; readonly type: "bytes32"; }, { readonly name: "maxClaimableAmount"; readonly type: "uint128"; }, { readonly name: "totalClaimed"; readonly type: "uint128"; }]; }; /** * Base stablecoin asset configuration shared across all EVM payment schemes. * Contains the core fields needed to identify and convert tokens. */ type DefaultAssetInfo = { /** Token contract address */ address: string; /** EIP-712 domain name (must match the token's domain separator) */ name: string; /** EIP-712 domain version (must match the token's domain separator) */ version: string; /** Token decimal places (typically 6 for USDC) */ decimals: number; }; /** * Extended asset configuration for the exact scheme. * Includes transfer method hints that control client-side behaviour. */ type ExactDefaultAssetInfo = DefaultAssetInfo & { /** * Transfer method override: `"permit2"` for tokens that don't support EIP-3009. * Omit for EIP-3009 tokens (default behaviour). */ assetTransferMethod?: string; /** * Set to `true` for permit2 tokens that implement EIP-2612 `permit()`. * Controls whether name/version are included in `extra` so the client can * sign a gasless EIP-2612 permit for Permit2 approval. */ supportsEip2612?: boolean; }; /** * Default stablecoins indexed by CAIP-2 network identifier. * * Each network has the right to determine its own default stablecoin that can * be expressed as a USD string by calling servers. See DEFAULT_ASSET.md in * exact/server/ for how to add new chains. */ declare const DEFAULT_STABLECOINS: Record; /** * Look up the default stablecoin for a network. * * @param network - CAIP-2 network identifier (e.g. "eip155:8453") * @returns The default asset info * @throws If no default asset is configured for the network */ declare function getDefaultAsset(network: Network): ExactDefaultAssetInfo; declare const BUILDER_CODE_KEY: "builder-code"; interface DataSuffixContext { paymentPayload: PaymentPayload; paymentRequirements: PaymentRequirements; } interface BuilderCodeFacilitatorExtension extends FacilitatorExtension { key: typeof BUILDER_CODE_KEY; buildDataSuffix?(ctx: DataSuffixContext): Hex | undefined | Promise; } /** * Resolves and concatenates data suffixes from registered extensions. * * @param context - Facilitator context with registered extensions * @param ctx - Data suffix context passed to extension resolvers * @returns Hex-encoded suffix to append to settlement calldata, or undefined if none */ declare function resolveDataSuffix(context: FacilitatorContext | undefined, ctx: DataSuffixContext): Promise; /** * Appends a hex data suffix to encoded contract calldata. * * @param calldata - Base encoded function calldata * @param suffix - Optional hex suffix (with or without 0x prefix) * @returns Calldata with suffix appended, or the original calldata when suffix is empty */ declare function appendDataSuffix(calldata: Hex, suffix?: Hex): Hex; /** * Detection utilities for the ERC-7702 delegation designation (`0xef0100 + 20-byte address`). * * NOTE: These helpers are diagnostic only. The signature-verification path does * not branch on 7702 detection — it routes by `code.length` (matching on-chain * SignatureChecker) and the delegate decides via `isValidSignature`. See * {@link ./verifySignature.ts} for the verification primitive. * * Use these helpers for telemetry, logging, or surfacing wallet types in UIs. */ /** * Returns `true` if `bytecode` is a valid ERC-7702 delegation designation. * * The check is case-insensitive — `eth_getCode` casing is not normalized at the * JSON-RPC layer, so callers using ethers, custom signers, or post-processed * hex can pass uppercase variants. * * @param bytecode - Raw hex bytecode returned by `eth_getCode`. * @returns `true` if the bytecode is an ERC-7702 delegation designation. */ declare function isERC7702Delegation(bytecode: `0x${string}` | undefined | null): boolean; /** * Extracts the 20-byte delegate address from a 7702 delegation designation. * Returns the address in **lowercase** hex with a `0x` prefix. * The Go equivalent ({@link GetERC7702DelegateAddress}) returns a checksummed EIP-55 address. * The Python equivalent returns lowercase hex. Normalise with `getAddress()` when comparing * cross-SDK outputs or storing in a case-sensitive index. * Returns `null` for non-7702 bytecode. * * @param bytecode - Raw hex bytecode returned by `eth_getCode`. * @returns The lowercase `0x`-prefixed delegate address, or `null` if `bytecode` is not a 7702 designation. */ declare function getERC7702DelegateAddress(bytecode: `0x${string}` | undefined | null): `0x${string}` | null; /** * Parsed ERC-6492 classification for a payer address. * * `isCounterfactual` is true when the payment comes from an undeployed smart wallet * (ERC-6492 wrapper present, no bytecode at the payer address yet). In this case * pre-verification of the signature is deferred to on-chain simulation or settle. */ type Erc6492Classification = { isCounterfactual: boolean; isDeployedAtPayer: boolean; hasDeploymentInfo: boolean; innerSignature: `0x${string}`; eip6492Deployment?: { factoryAddress: `0x${string}`; factoryCalldata: `0x${string}`; }; }; /** * Classify an ERC-6492 payer in one RPC round-trip: parse the sig wrapper, fetch code, * and determine counterfactual vs deployed state. * * @param signer - Facilitator signer used to call `eth_getCode` on the payer address. * @param signature - The full signature, which may be an ERC-6492 wrapper. * @param payerAddress - The address whose bytecode is fetched to detect deployment state. * @returns Classification result including counterfactual flag, deployment state, and inner signature. */ declare function classifyErc6492Payer(signer: FacilitatorEvmSigner, signature: `0x${string}`, payerAddress: `0x${string}`): Promise; /** * Verify a typed-data signature using strict on-chain SignatureChecker semantics. * * @param signer - Facilitator signer used for `eth_getCode` and `isValidSignature` calls. * @param params - Typed-data verification parameters. * @param params.address - The address that is expected to have signed the data. * @param params.domain - EIP-712 domain. * @param params.types - EIP-712 type definitions. * @param params.primaryType - The primary type to hash. * @param params.message - The typed-data message. * @param params.signature - The signature to verify. * @returns `true` if the signature is valid, `false` otherwise. */ declare function verifyTypedDataSignature(signer: FacilitatorEvmSigner, params: { address: `0x${string}`; domain: TypedDataDomain; types: Record; primaryType: string; message: Record; signature: `0x${string}`; }): Promise; /** * Lower-level variant of {@link verifyTypedDataSignature} for callers that already have the digest. * * @param signer - Facilitator signer used for `eth_getCode` and `isValidSignature` calls. * @param address - The address that is expected to have produced the signature. * @param digest - The EIP-191 / EIP-712 message hash to verify against. * @param signature - The signature to verify. * @returns `true` if the signature is valid, `false` otherwise. */ declare function verifyHashSignature(signer: FacilitatorEvmSigner, address: `0x${string}`, digest: `0x${string}`, signature: `0x${string}`): Promise; /** * Like {@link verifyHashSignature} but accepts pre-fetched bytecode to avoid a * redundant `eth_getCode` RPC when the caller already has it (e.g. after the * ERC-6492 counterfactual check in {@link classifyErc6492Payer}). * * Pass `undefined` or `"0x"` for `code` to take the EOA (ecrecover) path. * * @param signer - Facilitator signer used for `isValidSignature` calls on deployed contracts. * @param address - The address that is expected to have produced the signature. * @param code - Pre-fetched bytecode at `address`; `undefined` or `"0x"` takes the ECDSA path. * @param digest - The message hash to verify against. * @param signature - The signature to verify. * @returns `true` if the signature is valid, `false` otherwise. */ declare function verifyHashSignatureWithCode(signer: FacilitatorEvmSigner, address: `0x${string}`, code: `0x${string}` | undefined, digest: `0x${string}`, signature: `0x${string}`): Promise; /** * auth-capture wire-format types. * * Spec-level field names (captureAuthorizer, captureDeadline, refundDeadline, * feeRecipient) live here at the extra/wire layer. The on-chain PaymentInfo * struct keeps the canonical Solidity field names (operator, authorizationExpiry, * refundExpiry, feeReceiver) so the EIP-712 typehash stays byte-identical with * the AuthCaptureEscrow contract. * * Salt is NOT in extra. It is generated client-side per signing call and rides * on the payload alongside the signature. */ interface AuthCaptureExtra { captureAuthorizer: `0x${string}`; captureDeadline: number; refundDeadline: number; feeRecipient: `0x${string}`; minFeeBps: number; maxFeeBps: number; name: string; version: string; autoCapture?: boolean; assetTransferMethod?: AssetTransferMethod; } /** * Type guard for AuthCaptureExtra. Checks the structural shape an auth-capture * scheme requires inside `PaymentRequirements.extra`: every spec-mandated * required field present with the right primitive type. * * @param value - Candidate object from `requirements.extra`. * @returns True if `value` has every required AuthCaptureExtra field. */ declare function isAuthCaptureExtra(value: unknown): value is AuthCaptureExtra; interface Eip3009Payload { authorization: { from: `0x${string}`; to: `0x${string}`; value: string; validAfter: string; validBefore: string; nonce: `0x${string}`; }; signature: `0x${string}`; salt: `0x${string}`; } interface Permit2Payload { permit2Authorization: { from: `0x${string}`; permitted: { token: `0x${string}`; amount: string; }; spender: `0x${string}`; nonce: string; deadline: string; }; signature: `0x${string}`; salt: `0x${string}`; } type AuthCapturePayload = Eip3009Payload | Permit2Payload; /** * Type guard for any auth-capture payload. Returns true if `value` matches * either the EIP-3009 envelope or the Permit2 envelope. * * @param value - Candidate payment payload from the wire. * @returns True if `value` is a valid auth-capture envelope of either shape. */ declare function isAuthCapturePayload(value: unknown): value is AuthCapturePayload; /** * On-chain PaymentInfo struct (canonical Solidity names — DO NOT RENAME). * Reconstructed by the facilitator from extra + payload.salt + payer + receiver/asset/amount. */ interface PaymentInfoStruct { operator: `0x${string}`; payer: `0x${string}`; receiver: `0x${string}`; token: `0x${string}`; maxAmount: string; preApprovalExpiry: number; authorizationExpiry: number; refundExpiry: number; minFeeBps: number; maxFeeBps: number; feeReceiver: `0x${string}`; salt: `0x${string}`; } declare const AUTH_CAPTURE_SCHEME: "auth-capture"; declare const AUTH_CAPTURE_ESCROW_ADDRESS: "0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff"; declare const EIP3009_TOKEN_COLLECTOR_ADDRESS: "0x0E3dF9510de65469C4518D7843919c0b8C7A7757"; declare const PERMIT2_TOKEN_COLLECTOR_ADDRESS: "0x992476B9Ee81d52a5BdA0622C333938D0Af0aB26"; export { AUTH_CAPTURE_ESCROW_ADDRESS, AUTH_CAPTURE_SCHEME, type AssetTransferMethod, type Eip3009Payload as AuthCaptureEip3009Payload, type AuthCaptureExtra, type AuthCapturePayload, type PaymentInfoStruct as AuthCapturePaymentInfo, type Permit2Payload as AuthCapturePermit2Payload, BATCH_SETTLEMENT_ADDRESS, BATCH_SETTLEMENT_DOMAIN, BATCH_SETTLEMENT_SCHEME, BUILDER_CODE_KEY, type BuilderCodeFacilitatorExtension, DEFAULT_STABLECOINS, type DataSuffixContext, type DefaultAssetInfo, EIP3009_TOKEN_COLLECTOR_ADDRESS, ERC3009_DEPOSIT_COLLECTOR_ADDRESS, type Erc6492Classification, type ExactDefaultAssetInfo, type ExactEIP3009Payload, type ExactEvmPayloadV1, type ExactEvmPayloadV2, type ExactPermit2Payload, FacilitatorEvmSigner, PERMIT2_TOKEN_COLLECTOR_ADDRESS, type Permit2Authorization, type Permit2Witness, type UptoPermit2Authorization, type UptoPermit2Payload, type UptoPermit2Witness, appendDataSuffix, claimBatchTypes, classifyErc6492Payer, getDefaultAsset, getERC7702DelegateAddress, isAuthCaptureExtra, isAuthCapturePayload, isEIP3009Payload, isERC7702Delegation, isPermit2Payload, isUptoPermit2Payload, refundTypes, resolveDataSuffix, verifyHashSignature, verifyHashSignatureWithCode, verifyTypedDataSignature, voucherTypes };