fix(x402): align PaymentRequirement with x402 v1 spec#83
Open
zhongeric wants to merge 1 commit intoConway-Research:mainfrom
Open
fix(x402): align PaymentRequirement with x402 v1 spec#83zhongeric wants to merge 1 commit intoConway-Research:mainfrom
zhongeric wants to merge 1 commit intoConway-Research:mainfrom
Conversation
The local PaymentRequirement interface used non-standard field names (usdcAddress, payToAddress, requiredDeadlineSeconds) and hardcoded the EIP-712 domain to USDC, making it impossible to sign valid payments for other EIP-3009 tokens (e.g. EURC). - Rename fields to match x402 v1 spec: asset, payTo, maxTimeoutSeconds - Add `extra` field (name, version) for EIP-712 domain parameters - Use `extra` in signPayment instead of hardcoded "USD Coin" / "2" - Fall back to USDC defaults when server omits `extra` or `asset` - Preserve deprecated fallbacks for old non-standard field names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
PaymentRequirementfields to match the x402 v1 spec:usdcAddress→asset,payToAddress→payTo,requiredDeadlineSeconds→maxTimeoutSecondsextrafield ({ name, version }) from the spec, which carries the EIP-712 domain parameters needed forTransferWithAuthorizationsigningsignPaymentnow readsextra.name/extra.versionfrom the server's payment requirement instead of hardcoding"USD Coin"/"2", enabling valid signatures for non-USDC EIP-3009 tokens (e.g. EURC)name: "USD Coin",version: "2", USDC contract address) when the server omitsextraorassetpayToAddress,usdcAddress,requiredDeadlineSeconds), marked@deprecatedTest plan
pnpm buildpasses cleanly (confirmed locally)payTo,asset,maxTimeoutSeconds,extra)payToAddress,usdcAddress,requiredDeadlineSeconds) to confirm backwards compatextrato confirm USDC fallback defaults applyextra: { name: "EURC", version: "1" }to confirm correct EIP-712 signature🤖 Generated with Claude Code