ClawRouter icon indicating copy to clipboard operation
ClawRouter copied to clipboard

Optional pre-pay check on payFetch for x402 sellers on Base

Open withgrokbot opened this issue 1 month ago • 1 comments

In src/proxy.ts (~L3068), payFetch is built with createPayFetchWithPreAuth(fetch, x402!, …). Wrapping the base fetch adds a check before any payment header is sent:

createPayFetchWithPreAuth(spotCheckFetch(fetch), x402!, undefined, {…})

https://github.com/withgrokbot/x402-spotcheck checks the seller's live 402 and returns pay, skip or recheck. On skip, the signed header is never sent. Today it checks Base payment routes. 5 free checks a day, paid checks from $0.01 USDC on Base, and public receipts for every pay/skip/recheck verdict. Skips record: https://402xagent.com/v1/skips.json. Daily Bazaar check: https://402xagent.com/bazaar. For integrators: 1,000 free checks, and we'll help wire it in.

withgrokbot ([email protected])

withgrokbot avatar Oct 13 '26 21:10 withgrokbot

Thanks for the suggestion. We're not going to add this.

ClawRouter only ever pays one seller: every payFetch call goes to ${apiBase}${req.url} (src/proxy.ts), which is BlockRun's own gateway. A pre-pay check on the seller would just be checking whether it's safe to pay ourselves. It would add an external round trip to every paid request, a third-party dependency in the payment path, and request metadata sent outside, all without protecting users from anything.

Payment safety here is handled locally, before signing: the pre-request balance check, maxCostPerRun, and the pre-auth amount estimate in payment-preauth.ts. We're also keeping third-party service integrations out of the core router. If you want to offer this to x402 clients that pay arbitrary sellers, a standalone wrapper package is the right place for it. Closing.

VickyXAI avatar Oct 13 '26 22:10 VickyXAI