fix(paywall): read token name from payment requirements instead of hardcoding USDC#1973
Open
ryanRfox wants to merge 1 commit intox402-foundation:mainfrom
Open
fix(paywall): read token name from payment requirements instead of hardcoding USDC#1973ryanRfox wants to merge 1 commit intox402-foundation:mainfrom
ryanRfox wants to merge 1 commit intox402-foundation:mainfrom
Conversation
…rdcoding USDC
The EVM paywall hardcodes "USDC" as the token label in all display
text. The payment requirements already carry the token name in
extra.name (populated by the server from the default asset registry),
but the paywall ignores it.
Read extra.name from the first payment requirement and use it for
all user-facing token text. Falls back to "USDC" when extra.name
is absent (backward compatible with EIP-3009 tokens).
5 display strings updated:
- Header: "please pay $X {tokenName}" (was "USDC")
- Testnet prompt: "Need {tokenName} on {chainName}?" (was "USDC")
- Balance: "$X {tokenName}" (was "USDC")
- Amount row: "$X {tokenName}" (was "USDC")
- Error: "Make sure you have {tokenName} on {chainName}" (was "USDC")
Regenerated Go, Python, and TS paywall templates.
bef12e1 to
ea20eb4
Compare
|
@ryanRfox is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
Thanks for the fix @ryanRfox , please rebase and regenerate the templates to resolve merge conflicts |
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.
Description
The EVM paywall hardcodes "USDC" as the token label in all display text. The payment requirements already carry the token name in
extra.name(populated from the default asset registry on the server side), but the paywall ignores it.This means any non-USDC token — MegaUSD, USDT0, or any future default stablecoin — shows a misleading "USDC" label in the paywall UI.
Fixes #1972
Related: #1971
Changes
EvmPaywall.tsx:
tokenNamefromfirstRequirement.extra.nameextra.nameis absent (backward compatible)Generated templates: Regenerated Go, Python, and TS paywall templates via
pnpm --filter @x402/paywall build:paywall.1 source file changed, +8 -7 lines (plus regenerated templates).
Testing
pnpm test— 41/41 tasks)pnpm lint:check)extra.namestill display "USDC"Checklist
pnpm format && pnpm lint:check)pnpm test)pnpm --filter @x402/paywall build:paywall)