Repository navigation
Show network details and switch wallets to the faucet chain - #21
Conversation
The faucet page only showed the chain ID and offered a bare wallet_addEthereumChain call that failed silently. It now shows the RPC and currency, asks the wallet to switch first and adds the chain only when the wallet does not know it (4902), reports the outcome, and hides the button when there is no injected wallet.
There was a problem hiding this comment.
This change shows the RPC URL and currency on the faucet page. The add-network button now tries wallet_switchEthereumChain first, falls back to wallet_addEthereumChain when the error is 4902, and reports the result. I found nothing blocking: the hidden RPC row stays hidden because app.css sets [hidden] to display: none !important, and the button is hidden whenever the RPC URL or the wallet is missing. The only other reading (openai/gpt-6.1-sol) found nothing, which matches my result, so it adds no findings.
1 nit, not posted on the code
Nits
internal/api/web/app.js:188— The 4902 check also looks ate?.data?.originalError?.codebecause MetaMask Mobile nests errors there, but the 4001 check only looks ate?.code. If that wallet nests a user rejection the same way, the page would say "Wallet could not switch to …" instead of "Wallet request was rejected".
Seidroid Review · the review wrote approve · run
There was a problem hiding this comment.
The head moved during this review. It read c2b8a0bdfc10, but the pull request is now at 8c9053daac13, which it has not read, so it lists any findings here rather than on the code and records no approval.
Nothing material has changed since my last review: the diff is the same, so my earlier nit about the 4001 check still applies. Nothing blocks, and the only other reading (openai/gpt-6.1-sol) found nothing, which matches my result, so it adds no findings.
1 nit, not posted on the code
Nits
internal/api/web/app.js:188— The 4902 check also looks ate?.data?.originalError?.codebecause MetaMask Mobile nests errors there, but the 4001 check only looks ate?.code. If that wallet nests a user rejection the same way, the page would say "Wallet could not switch to …" instead of "Wallet request was rejected".
Seidroid Review · the review wrote approve · run
|
@seidroid review |
There was a problem hiding this comment.
The update adds a walletError helper, so the 4902 fallback and the 4001 rejection message now both read the error code MetaMask Mobile nests under data.originalError, which fixes my earlier nit. Nothing blocks, and the only other reading (openai/gpt-6.1-sol) found nothing, which matches my result, so it adds no findings.
Seidroid Review · the review wrote approve · run
Wallets need the chain ID, RPC and currency to talk to giga-testnet-1, and the faucet page only showed the chain ID. Its add-network button called
wallet_addEthereumChainwith no error handling, so a rejection or an already-known chain failed silently, and it showed even when no browser wallet was injected.The page now lists the RPC and currency next to the chain ID, and the button asks the wallet to
wallet_switchEthereumChainfirst, adding the chain only on 4902 (unknown chain), which MetaMask Mobile nests underdata.originalError. It reports the outcome and is hidden without an injected provider or a--public-rpc-url. Chain ID, name and RPC still come from/api/info; the currency stays a page constant because the faucet config has no currency setting and the page already assumes 18-decimal SEI when it formats amounts.