Skip to content

feat: x402 v2 upgrade + unit/identity fixes#153

Merged
badjer merged 7 commits intomainfrom
feature/x402-v2-sdk
Apr 7, 2026
Merged

feat: x402 v2 upgrade + unit/identity fixes#153
badjer merged 7 commits intomainfrom
feature/x402-v2-sdk

Conversation

@badjer
Copy link
Copy Markdown
Contributor

@badjer badjer commented Apr 7, 2026

Summary

Upgrades x402 from v1 to v2 packages and fixes unit/identity mismatches for on-chain settlement.

  • @x402/core + @x402/evm replace x402 v1 across client, base, x402 packages
  • v2-only types: amount (not maxAmountRequired), CAIP-2 networks, x402Version 2
  • PAYMENT-SIGNATURE header detection (v2) alongside X-PAYMENT fallback
  • EIP-712 domain params in X402 accepts for facilitator validation
  • X402 identity: OAuth sub fallback (matches charge sourceAccountId)

E2E Verified

X402 on Base mainnet: 0x23f9260e913ca98d04c4496aaf4f2eff65dce2ef8446bbc5216e4e281b79b169

🤖 Generated with Claude Code

badjer and others added 7 commits April 7, 2026 16:09
Replace x402/client with @x402/core and @x402/evm across client, base,
and x402 packages. selectPaymentRequirements inlined (v2 doesn't export it).
BaseAccount uses ExactEvmScheme + x402Client for signing.
Handles both v1 (maxAmountRequired) and v2 (amount) field formats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…TURE)

- X402PaymentOption uses 'amount' not 'maxAmountRequired'
- detectProtocol detects PAYMENT-SIGNATURE (v2) and X-PAYMENT (v1 fallback)
- All tests updated to v2 field names and x402Version: 2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Middleware: X402 credential identity falls back to OAuth sub (matches charge)
- omniChallenge: includes EIP-712 domain params (name/version) in X402 accepts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…02/evm)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Read PAYMENT-SIGNATURE header (v2) in x402Wrapper and baseAccount
- x402Wrapper uses challenge x402Version (not hardcoded 2)
- Stronger isX402Challenge type guard (checks x402Version + accepts)
- USDC addresses + CAIP-2 networks centralized in @atxp/common/constants
- Identity fallback: || instead of ?? (empty string falls through)
- Inline getAtomicAmount (removes needless indirection)
- PAYMENT-SIGNATURE detection tests in protocol.test.ts
- EIP-712 domain comment noting USDC v2 contract dependency
- TODO comments for x402 client bootstrap dedup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@badjer badjer merged commit 1324938 into main Apr 7, 2026
1 check passed
@badjer badjer deleted the feature/x402-v2-sdk branch April 7, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant