feat(paywall): chain-aware faucetUrl resolution across TS/Python/Go SDKs#2160
Conversation
|
@ryanRfox is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
Per upstream Python Towncrier convention, fragment files are named after the PR number they describe. The PR_TBD placeholder was used during local CI verification before the upstream PR was filed. This commit only renames; content is unchanged.
765aa35 to
d2ddab4
Compare
d2ddab4 to
19e7865
Compare
1f023ef to
a88cac3
Compare
|
Hi @ryanRfox, as faucet links are a paywall UX concern only, I think they should not be added to the @x402/evm etc packages. Also feel there are too many layers of fallbacks in your solution. I'd suggest the following:
|
|
Would be great if you could also include a fix for the solana devnet bug you mentioned above |
Per x402-foundation#2160 review: faucet links are a paywall UX concern. Curated defaults live in @x402/paywall/src/faucetUrls.ts (single Record<network, string>), with PaywallConfig.faucetUrls?.[network] as the sole server override. Unmapped chains render "No faucet configured." rather than a wrong link. - Drop SDK-catalog faucetUrl/FaucetURL/faucet_url additions; @x402/evm, @x402/avm, go/mechanisms/{evm,svm}, python/x402/mechanisms/{evm,svm} retain their original chain-identity-only contract. - Drop PaywallConfig.faucetUrl (global override); keep faucetUrls (per-chain). - Replace 3 gen/faucetUrls.ts codegen files with a single hand-curated source. - Add SOLANA_NETWORK_REFS.TESTNET; extend isTestnetNetwork() to cover it. - Unify testnet gate via isTestnetNetwork() in {Solana,Avm}Paywall. - Normalize "Need {tokenName} on {chainName}?" copy across all 3 paywalls. Closes x402-foundation#2159
a88cac3 to
fc1f3fe
Compare
Per x402-foundation#2160 review: faucet links are a paywall UX concern. Curated defaults live in @x402/paywall/src/faucetUrls.ts (single Record<network, string>), with PaywallConfig.faucetUrls?.[network] as the sole server override. Unmapped chains render "No faucet configured." rather than a wrong link. - Drop SDK-catalog faucetUrl/FaucetURL/faucet_url additions; @x402/evm, @x402/avm, go/mechanisms/{evm,svm}, python/x402/mechanisms/{evm,svm} retain their original chain-identity-only contract. - Drop PaywallConfig.faucetUrl (global override); keep faucetUrls (per-chain). - Replace 3 gen/faucetUrls.ts codegen files with a single hand-curated source. - Add SOLANA_NETWORK_REFS.TESTNET; extend isTestnetNetwork() to cover it. - Unify testnet gate via isTestnetNetwork() in {Solana,Avm}Paywall. - Normalize "Need {tokenName} on {chainName}?" copy across all 3 paywalls. Closes x402-foundation#2159
fc1f3fe to
dc7fa5e
Compare
Per x402-foundation#2160 review: faucet links are a paywall UX concern. Curated defaults live in @x402/paywall/src/faucetUrls.ts (single Record<network, string>), with PaywallConfig.faucetUrls?.[network] as the sole server override. Unmapped chains render "No faucet configured." rather than a wrong link. - Drop SDK-catalog faucetUrl/FaucetURL/faucet_url additions; @x402/evm, @x402/avm, go/mechanisms/{evm,svm}, python/x402/mechanisms/{evm,svm} retain their original chain-identity-only contract. - Drop PaywallConfig.faucetUrl (global override); keep faucetUrls (per-chain). - Replace 3 gen/faucetUrls.ts codegen files with a single hand-curated source. - Add SOLANA_NETWORK_REFS.TESTNET; extend isTestnetNetwork() to cover it. - Unify testnet gate via isTestnetNetwork() in {Solana,Avm}Paywall. - Normalize "Need {tokenName} on {chainName}?" copy across all 3 paywalls. Closes x402-foundation#2159
dc7fa5e to
67ffe7d
Compare
…dev framing
Address forensic review-quorum findings and conform SVM paywall to upstream pattern:
- Drop dead solana:TESTNET FAUCET_URLS entry (Circle faucet does not
dispense USDC on Solana Testnet; Option B renders "No faucet configured."
for any unmapped chain).
- Revert all Solana Testnet recognition added by prior refactor pass
(SOLANA_NETWORK_REFS.TESTNET constant, getNetworkDisplayName branch,
isTestnetNetwork OR-branch). The paywall now recognizes one non-mainnet
SVM network — Devnet — matching upstream/main. No SVM dev expects
paywall Testnet support; upstream doesn't provide it.
- Unify "Need {tokenName} on {chainName}?" copy in SolanaPaywall and
AvmPaywall payment-required headers (were hardcoded "USDC"; matches
EvmPaywall).
Closes x402-foundation#2159
67ffe7d to
7ca399b
Compare
|
@phdargen ready for re-review. Addressed your three asks:
|
Summary
Re-scopes #2160 to address @phdargen's review feedback: faucet links are a paywall UX concern and don't belong in the SDK chain catalog. Replaces the prior 4-layer fallback chain with a single-layer resolution path inside
@x402/paywall.Resolution path (single layer)
PaywallConfig.faucetUrls) wins for any chain it covers.@x402/paywall/src/faucetUrls.tsprovides defaults for known testnets (Base Sepolia, Arbitrum Sepolia, Mezo Testnet, Stable Testnet, Radius Testnet, Solana Devnet, Algorand Testnet).<span>No faucet configured.</span>instead of a wrong link (e.g.faucet.circle.comfor non-Circle chains).What changed vs the previous PR head
@x402/evm,@x402/avm,go/mechanisms/{evm,svm},python/x402/mechanisms/{evm,svm}revert to their original chain-identity-only contract — nofaucetUrl/FaucetURL/faucet_urlfields.PaywallConfig.faucetUrl(single URL applied to every chain) is gone; only the per-chainfaucetUrlsmap remains.gen/faucetUrls.tsfiles removed; a singlesrc/faucetUrls.tsnow hosts the testnet map plus aresolveFaucetUrl(network, x402)helper.isTestnetNetwork()helper, replacing divergentString(network).includes("devnet")(SVM) andnetwork.includes(ALGORAND_NETWORK_REFS.TESTNET)(AVM) substring checks. SVM recognition matches upstream/main: Mainnet + Devnet only (no Solana Testnet — Circle's faucet doesn't drop USDC there and no SVM dev expects paywall Testnet support)."Need {tokenName} on {chainName}?"text; the hardcoded "Need Solana Devnet USDC?" / "Need Algorand Testnet USDC?" strings are gone. SolanaPaywall and AvmPaywall payment-required headers now use{tokenName}instead of hardcoded"USDC", matching EvmPaywall.Boundary alignment
This aligns with #2250's "consume from
DEFAULT_STABLECOINS, don't extend it" principle. The same canon, defended from the other side: paywall UX concerns stay in@x402/paywall; chain catalogs stay focused on chain identity.Onboarding
DEFAULT_ASSETS.mdgains a "Paywall faucet link (recommended for testnets)" section. Adding a faucet for your testnet is a one-line edit totypescript/packages/http/paywall/src/faucetUrls.ts. No cross-SDK lockstep — the map is bundled exclusively by the TypeScript paywall and read by the Python and Go handlers through the rendered template.Closes
Closes #2159.