Skip to content

fix: RPC fallback transports and native balance display for weth wrappers - #5

Merged
seunlanlege merged 2 commits into
mainfrom
fix/weth-native-balance-rpc-fallback
Aug 1, 2026
Merged

seunlanlege merged 2 commits into
mainfrom
fix/weth-native-balance-rpc-fallback

Conversation

@seunlanlege

Copy link
Copy Markdown
Member

Root cause of "can't send WBNB even though I have BNB": the app builds every wagmi transport from rpcUrls[0] only, and BSC Testnet's first RPC (bsc-testnet-rpc.publicnode.com) is currently returning 503s. Every chapel read — balance multicall, isWeth(), host feeToken — failed, so the form fell back to an empty balance and blocked the send with "Insufficient funds". The weth/native logic itself was already correct.

  • wagmi.ts: transports now use viem's fallback() across all configured rpcUrls instead of only the first, so one flaky endpoint no longer zeroes out balances or blocks sends chain-wide.
  • evm-networks.ts: BSC Testnet RPC order now starts with data-seed-prebsc-1-s1.bnbchain.org (verified serving the balance multicall and contract reads), keeping publicnode as a fallback. Also fixes the SDK path (EvmChain.create uses rpcUrls[0]).
  • balance-helper.ts: for wrapped-hft tokens with weth: true, the form balance now shows the chain's native symbol and value (e.g. tBNB) instead of the wrapper's registry symbol, since that is what the user actually spends. Non-weth wrappers keep showing the underlying ERC20 balance.

Verified the exact multicall getEthBalance request and isWeth() read against the new primary RPC, and that the transport fallback walks all four endpoints in order. Type-check clean, 110 tests pass.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Preview deployed for 32e9c61: Open preview

View workflow run

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Preview deployed for 908544d: Open preview

View workflow run

@seunlanlege
seunlanlege merged commit d016402 into main Aug 1, 2026
2 checks passed
@seunlanlege
seunlanlege deleted the fix/weth-native-balance-rpc-fallback branch August 1, 2026 13:26
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