import type { Context, Env, Next } from 'hono'; import { type SupportedChainName } from '@azeth/common'; /** Minimal Hono env for pre-settled payment middleware. * Consumer apps can extend this with their own variables. */ export interface ProviderEnv extends Env { Variables: { paymentFrom: `0x${string}`; paymentAmount: bigint; paymentTxHash: `0x${string}`; }; } /** Pre-settled payment verification middleware. * * Checks for X-Payment-Tx header. If present, verifies the transaction on-chain * by decoding USDC Transfer event logs and confirming the payment meets requirements. * * When valid: sets context variables (paymentFrom, paymentAmount, paymentTxHash) * and calls next() — downstream x402 middleware should be skipped. * * When invalid: falls through to let x402 middleware handle normally. */ export declare function preSettledPaymentMiddleware(config: { payTo: `0x${string}`; usdcAddress: `0x${string}`; priceAtomicAmount: bigint; rpcUrl?: string; chainName?: SupportedChainName; /** N5 fix: invoked once per freshly-verified pre-settled payment with * (resource pathname, on-chain payer). Wire to AzethSIWxStorage.recordPayment * so a later SIWx-only request from the same payer is granted access instead * of re-settling (double-charge fix). The payer is the on-chain Transfer * `from` (the smart account) — exactly the address SIWx presents. */ recordPayment?: (resource: string, payer: `0x${string}`) => void; }): (c: Context, next: Next) => Promise; //# sourceMappingURL=pre-settled.d.ts.map