fix(x402): settle Arbitrum One deposits via CDP with checksummed v2 payload#294
Merged
Conversation
…ayload Arbitrum One (42161) only settles through Coinbase CDP (x402 v2); PayAI advertises "arbitrum" in /supported but rejects it on verify with invalid_exact_evm_network_mismatch (confirmed on prod). Route Arbitrum One deposits to CDP (Base + everything else stay on PayAI v1) and fix the CDP v2 payload that was being rejected. Root cause of the CDP 400: CDP's v2 validator requires EIP-55 checksummed EVM addresses. We sent lowercase (multisig addresses are stored lowercase; the X-PAYMENT authorization carries lowercase), so the payload failed CDP's oneOf[x402V2PaymentPayload, x402V1PaymentPayload] and surfaced the misleading "x402V1PaymentPayload requires 'scheme'" error. Checksum asset/payTo in the v2 requirements leaf and authorization.from/to in the payment payload via viem getAddress. Casing does not affect the EIP-3009 signature (EIP-712 encodes addresses to the 20-byte value). PayAI v1 path is untouched. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enable agentic gasless USDC (x402) deposits on Arbitrum One (42161) by routing them through the Coinbase CDP facilitator (x402 v2), and fix the CDP v2 payload that was being rejected.
Why
"arbitrum"in/supportedbut rejects it on verify withinvalid_exact_evm_network_mismatch— confirmed on prod for both Arbitrum One and Arbitrum Sepolia. So PayAI cannot settle Arbitrum.Changes
resolveFacilitator): Arbitrum One (42161) → CDP; Base + everything else stay on PayAI v1 (untouched).CDP_SUPPORTED_NETWORKS+assertCdpNetworkSupportedguard fails fast for chains CDP can't settle.oneOf[x402V2PaymentPayload, x402V1PaymentPayload]and surfaced the misleading"x402V1PaymentPayload requires 'scheme'"error. Now checksumasset/payToin the v2 requirements leaf andauthorization.from/toin the payment payload via viemgetAddress. Casing does not affect the EIP-3009 signature (EIP-712 encodes addresses to the 20-byte value).Verified
yarn workspace @polypay/shared build+@polypay/backend build)./verify+/settleaccept the checksummed body end-to-end — CDP can't be fully exercised in CI/locally.Deploy notes
🤖 Generated with Claude Code