import { FacilitatorConfig, FacilitatorClient } from '@x402/core/server'; export { FacilitatorClient, FacilitatorConfig } from '@x402/core/server'; import { Address, WalletClient, PublicClient } from 'viem'; /** * Prism contract address - same on all supported networks */ declare const PRISM_CONTRACT_ADDRESS: "0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86"; /** * Prism contract ABI (minimal, just what we need) */ declare const PRISM_ABI: readonly [{ readonly name: "getNonce"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly name: "user"; readonly type: "address"; }, { readonly name: "token"; readonly type: "address"; }]; readonly outputs: readonly [{ readonly name: ""; readonly type: "uint256"; }]; }, { readonly name: "DOMAIN_SEPARATOR"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly []; readonly outputs: readonly [{ readonly name: ""; readonly type: "bytes32"; }]; }]; /** * EIP-712 type definitions for Prism ERC20Payment */ declare const ERC20_PAYMENT_TYPES: { readonly ERC20Payment: readonly [{ readonly name: "token"; readonly type: "address"; }, { readonly name: "from"; readonly type: "address"; }, { readonly name: "to"; readonly type: "address"; }, { readonly name: "value"; readonly type: "uint256"; }, { readonly name: "nonce"; readonly type: "uint256"; }, { readonly name: "validAfter"; readonly type: "uint256"; }, { readonly name: "validBefore"; readonly type: "uint256"; }]; }; interface PrismPaymentParams { /** ERC-20 token address */ token: Address; /** Recipient address */ to: Address; /** Amount in token's smallest unit (e.g., wei for 18 decimals) */ value: bigint; /** Unix timestamp after which the payment is valid */ validAfter?: number; /** Unix timestamp before which the payment is valid */ validBefore?: number; } interface PrismPayload { x402Version: number; scheme: "exact"; network: string; payload: { signature: `0x${string}`; authorization: { from: Address; to: Address; value: string; nonce: string; validAfter: number; validBefore: number; }; }; } /** * Get the current nonce for a user/token pair from the Prism contract */ declare function getPrismNonce(publicClient: PublicClient, user: Address, token: Address): Promise; /** * Create a signed Prism payment payload * * @param walletClient - Viem wallet client for signing * @param publicClient - Viem public client for reading nonce * @param params - Payment parameters * @param network - Network identifier (e.g., "eip155:8453") * @returns Signed payload ready for x402 facilitator * * @example * ```typescript * import { createPrismPayload } from '@primersystems/primer' * import { createWalletClient, createPublicClient, http } from 'viem' * import { base } from 'viem/chains' * * const publicClient = createPublicClient({ chain: base, transport: http() }) * const walletClient = createWalletClient({ chain: base, transport: http(), account }) * * const payload = await createPrismPayload(walletClient, publicClient, { * token: '0x...', // ERC-20 token address * to: '0x...', // recipient * value: 1000000n // amount in smallest unit * }, 'eip155:8453') * ``` */ declare function createPrismPayload(walletClient: WalletClient, publicClient: PublicClient, params: PrismPaymentParams, network: string): Promise; declare const PRIMER_FACILITATOR_URL = "https://x402.primer.systems"; declare const skaleNetworks: { readonly base: "eip155:1187947933"; readonly baseSepolia: "eip155:324705682"; }; declare const skaleRpcUrls: { readonly base: "https://skale-base.skalenodes.com/v1/base"; readonly baseSepolia: "https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha"; }; declare const robinhoodNetworks: { readonly mainnet: "eip155:4663"; readonly testnet: "eip155:46630"; }; declare const robinhoodRpcUrls: { readonly mainnet: "https://rpc.mainnet.chain.robinhood.com"; readonly testnet: "https://rpc.testnet.chain.robinhood.com"; }; /** * Creates an HTTPFacilitatorClient pre-configured for the Primer facilitator. * * @param config - Optional additional config (e.g., auth headers) * @returns FacilitatorClient pointing to x402.primer.systems * * @example * ```typescript * import { paymentMiddleware } from '@x402/express' * import { primerFacilitator } from '@primersystems/primer' * * app.use(paymentMiddleware(routes, server, { facilitator: primerFacilitator() })) * ``` */ declare function primerFacilitator(config?: Omit): FacilitatorClient; export { ERC20_PAYMENT_TYPES, PRIMER_FACILITATOR_URL, PRISM_ABI, PRISM_CONTRACT_ADDRESS, type PrismPayload, type PrismPaymentParams, createPrismPayload, getPrismNonce, primerFacilitator, robinhoodNetworks, robinhoodRpcUrls, skaleNetworks, skaleRpcUrls };