fix(payment): pin real Arbitrum RPC transports so large gas preflights succeed - #203
Merged
Merged
Conversation
…s succeed The gas preflight added for explicit payment gas limits routes eth_estimateGas through the app's own wagmi public client. Without an explicit transport, Reown's WagmiAdapter points that client at its RPC proxy (rpc.walletconnect.org), which rejects any request body over 16KB with an HTTP 403 - and since the adapter also rewrites the chain's default RPC list to the same proxy URL, the viem fallback transport retried the identical broken endpoint. Large payForMerkleTree / payForQuotes estimates (a ~460MB merkle upload is ~100KB of calldata) therefore failed deterministically before any wallet prompt, surfacing as "Payment would fail on-chain: HTTP request failed." Two changes: - Pin explicit transports (arb1.arbitrum.io/rpc, sepolia-rollup) on the WagmiAdapter. The adapter keeps its proxy as an automatic fallback leg, so we gain the real RPC as primary without losing redundancy. - When every preflight attempt dies at the transport layer, say "Couldn't reach the Arbitrum RPC to estimate gas" instead of falsely claiming the payment would fail on-chain. Verified live: 462MB (119-chunk, depth-7) merkle upload now reaches the wallet with a normal fee quote. Co-Authored-By: Claude Fable 5 <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.
Problem
On 0.9.6-rc.1, larger uploads fail at payment with
Payment failed: Payment would fail on-chain: HTTP request failed.— before any wallet prompt appears (bridge users see no extension popup at all).Root cause: the new gas preflight (#201) runs
eth_estimateGasthrough the app's wagmi public client. With no explicit transport configured, Reown'sWagmiAdapterpoints that client at its RPC proxy (rpc.walletconnect.org), which returns HTTP 403 for any request body over 16KB (verified empirically: 16,382-byte bodies pass, 16,397-byte bodies fail). A ~460MB merkle upload produces ~100KB ofpayForMerkleTreecalldata, so the estimate is rejected deterministically. The adapter's built-in viemfallbackdoesn't help becauseextendCaipNetworkrewrites the chain's default RPC list to the same proxy URL — both fallback legs hit the identical broken endpoint, andarb1.arbitrum.io/rpc(which handles 256KB bodies fine) was never tried.Small requests (allowance reads, wave-batch estimates for few-chunk uploads) stay under 16KB, which is why light testing passed.
Fix
plugins/appkit.client.ts— pass explicittransportsto theWagmiAdapter:arb1.arbitrum.io/rpcfor Arbitrum One,sepolia-rollup.arbitrum.io/rpcfor Sepolia. The adapter'sextendWagmiTransportskeeps its own proxy as an automatic fallback leg behind the pinned transport, so redundancy is preserved — the real RPC just becomes primary.utils/payment.ts— when every preflight attempt dies at the transport layer (HttpRequestError/TimeoutErrorin the cause chain), the error now readsCouldn't reach the Arbitrum RPC to estimate gas: …instead of falsely claiming the payment would revert.Testing
nuxi typecheckclean.🤖 Generated with Claude Code