Commit Graph

7 Commits

Author SHA1 Message Date
TerryM
355c920c80 chore: remove wallet code comments 2026-06-04 09:55:19 +08:00
TerryM
f8369b6361 fix: auto login inside imtoken browser 2026-06-04 09:46:24 +08:00
TerryM
53eab4a066 fix: restore imtoken direct login path 2026-06-04 09:39:14 +08:00
TerryM
93790cb885 fix: remove wallet verification popup 2026-06-04 09:36:20 +08:00
TerryM
469e53a860 fix: skip wallet verification gate when logged in 2026-06-04 07:39:17 +08:00
TerryM
526facb261 fix: require signature for tokenpocket direct login 2026-06-04 07:23:05 +08:00
TerryM
6800a8e9b6 feat(wallet): bypass WalletConnect for TP/imToken on mobile to fix China users
Some checks failed
Deploy Staging (terry-wallet-login) / deploy (push) Failing after 40s
The WalletConnect relay (wss://relay.walletconnect.org) is unreliable/blocked
in mainland China. Every wallet flow (desktop QR, mobile deeplink, mobile QR)
depends on it, so Chinese users see the login button hang forever and the
QR code never appears. When RainbowKit's render fails, the whole site goes
white because nothing catches the error.

Changes:
- Add WalletStackErrorBoundary around <RainbowWalletProvider> + modal so
  RainbowKit init failures no longer blank the entire app.
- Hoist <WalletProvider> above the boundary; it only depends on the injected
  provider, so useWallet keeps working for header / favorites / etc. even
  when the WC stack is dead.
- On mobile, the TP/imToken 'Open Wallet App' button now navigates directly
  to tpdapp://open / imtokenv2://navigate/DappView with an ?autoLogin=<kind>
  query, pulling the site into the wallet's in-app browser without ever
  touching the WC relay. MetaMask still uses the WC path (no equivalent
  deeplink).
- Add AutoInjectedLogin: when the page loads with ?autoLogin=<kind>, wait
  up to 8s for window.ethereum, then connectInjectedWallet + completeLogin.
  Strips the param via history.replaceState to avoid re-firing on reload.
- Guard against the in-app-browser disconnect/reconnect case: if
  getInjectedWallet(kind) is already truthy, skip the deeplink and let
  useWalletConnectLogin's deeplink mode take the injected fast path
  (avoids TP trying to open TP recursively).
2026-06-03 20:07:23 +08:00