Problem
When an x402 server offers multiple networks (e.g. both Base mainnet eip155:8453 and Base Sepolia eip155:84532), purl always selects the first one listed. If the wallet only has funds on the second network, the payment fails with:
Error: Payment was not accepted by the server
No indication is given that the failure is due to insufficient funds on the selected network.
Steps to reproduce
- Create a wallet funded on Base Sepolia only (
purl balance shows 0.249 USDC on base-sepolia, 0.000 USDC on base)
- Hit an endpoint that offers both networks:
purl inspect https://api.run402.com/v1/ping
# Shows: eip155:8453 (compatible: true), eip155:84532 (compatible: true)
- Try to pay:
PURL_PASSWORD=xxx purl https://api.run402.com/v1/ping --max-amount 10000
# Error: Payment was not accepted by the server
- Workaround — force network manually:
PURL_PASSWORD=xxx purl https://api.run402.com/v1/ping --max-amount 10000 --network eip155:84532
# Works! Payment settled on Sepolia.
Expected behavior
purl should check the wallet's balance on each offered network and automatically select one where the wallet has sufficient funds. If no network has sufficient funds, show a clear error like:
Error: Insufficient balance on all offered networks.
eip155:8453: 0.000 USDC (need 0.001)
eip155:84532: 0.249 USDC (need 0.001) ← sufficient
Or at minimum, when the payment is rejected, suggest trying --network eip155:84532 if the wallet has funds there.
Environment
- purl v0.1.1
- macOS (Apple Silicon)
- Server: Run402 (api.run402.com), offers both Base mainnet and Base Sepolia
Problem
When an x402 server offers multiple networks (e.g. both Base mainnet
eip155:8453and Base Sepoliaeip155:84532), purl always selects the first one listed. If the wallet only has funds on the second network, the payment fails with:No indication is given that the failure is due to insufficient funds on the selected network.
Steps to reproduce
purl balanceshows0.249 USDCon base-sepolia,0.000 USDCon base)purl inspect https://api.run402.com/v1/ping # Shows: eip155:8453 (compatible: true), eip155:84532 (compatible: true)PURL_PASSWORD=xxx purl https://api.run402.com/v1/ping --max-amount 10000 # Error: Payment was not accepted by the serverPURL_PASSWORD=xxx purl https://api.run402.com/v1/ping --max-amount 10000 --network eip155:84532 # Works! Payment settled on Sepolia.Expected behavior
purl should check the wallet's balance on each offered network and automatically select one where the wallet has sufficient funds. If no network has sufficient funds, show a clear error like:
Or at minimum, when the payment is rejected, suggest trying
--network eip155:84532if the wallet has funds there.Environment