Skip to content

Show network details and switch wallets to the faucet chain - #21

Merged
masih merged 2 commits into
mainfrom
masih/1795456539-faucet-wallet-network
Nov 24, 2026
Merged

masih merged 2 commits into
mainfrom
masih/1795456539-faucet-wallet-network

Conversation

@masih

@masih masih commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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_addEthereumChain with 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_switchEthereumChain first, adding the chain only on 4902 (unknown chain), which MetaMask Mobile nests under data.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.

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.
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review November 23, 2026 18:00

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 at e?.data?.originalError?.code because MetaMask Mobile nests errors there, but the 4001 check only looks at e?.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 seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 at e?.data?.originalError?.code because MetaMask Mobile nests errors there, but the 4001 check only looks at e?.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

@masih

masih commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@masih
masih merged commit 7ed9fa1 into main Nov 24, 2026
18 checks passed
@masih
masih deleted the masih/1795456539-faucet-wallet-network branch November 24, 2026 09:24
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