Skip to content

fix: inherit consumer transport + safer mainnet default#53

Draft
technophile-04 wants to merge 2 commits into
mainfrom
fix/inherit-parent-transport
Draft

fix: inherit consumer transport + safer mainnet default#53
technophile-04 wants to merge 2 commits into
mainfrom
fix/inherit-parent-transport

Conversation

@technophile-04
Copy link
Copy Markdown
Collaborator

@technophile-04 technophile-04 commented Apr 13, 2026

NOTE: This doesn't fix scaffold-eth/scaffold-eth-2#1265 specifically for SE-2 sinec our wagmi config has things configured via fallback route but if peole use a simple route using just transport to configure then it shall work.

why

The cause is viem's http() with no URL falls through to chain.rpcUrls.default.http[0]. For mainnet that's eth.merkle.io, which blocks cross-origin requests from most live domains and rate-limits hard.

what changed

New resolution order for the burner's RPC in burner.ts:

  1. rpcUrls[chainId] passed to the burner. Same as before.
  2. config.transports[chainId] from the consumer's wagmi config. Preserves fallback chains, Alchemy keys, anything else they configured. This is the same pattern the official walletConnect connector uses via extractRpcUrls in @wagmi/core.
  3. A curated default for chains whose viem default is broken in production. Right now just mainnet → mainnet.rpc.buidlguidl.com. Easy to extend if other chains hit the same thing.
  4. chain.rpcUrls.default.http[0]. Existing final fallback.

Also swapped the raw RPC passthrough from getHttpRpcClient(url) to publicClient.request(...) so it works with any transport shape, including the consumer's fallback([...]) chain.

All additive, no breaking changes. Anyone already using rpcUrls keeps the exact same behavior.

what this doesn't fix

Consumers using the client({ chain }) factory form of createConfig (SE-2's current pattern) won't see their transport inherited. config.transports is undefined when the consumer uses client(), and the wagmi connector surface does not expose the client factory to connectors. Step 3 covers SE-2 on mainnet directly, so the reported CORS issue is resolved out of the box. For other chains those consumers would still need to set rainbowkitBurnerWallet.rpcUrls explicitly, or switch their wagmi config to the transports: {} form.

test

The example app was updated to use transports: {} so inheritance is visible in the network tab. Connect with the burner, watch the RPC calls go to whatever Alchemy URL you configured at the wagmi level. No second RPC config needed on the wallet side.

refs

Address the mainnet burner CORS/429 issue reported in
scaffold-eth/scaffold-eth-2#1265.

New RPC resolution order in getProvider:
1. rpcUrls[chainId] (existing override)
2. config.transports[chainId] from the consumer's wagmi config
   (preserves fallback chains, Alchemy keys, etc.) — same pattern
   used by the official walletConnect connector via extractRpcUrls
3. Curated safer default for chains whose viem default is broken
   in production (just mainnet -> mainnet.rpc.buidlguidl.com for now)
4. chain.rpcUrls.default.http[0] (existing final fallback)

Additive, no breaking changes. Example app updated to use the
transports:{} form so inheritance is visible in the network tab.
@technophile-04 technophile-04 marked this pull request as draft April 13, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant