fix: detect imtoken injected provider by browser
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: "imToken in-app browser cannot connect after deeplink — Quick Fix"
|
||||
type: quick-fix
|
||||
date: 2026-06-04
|
||||
---
|
||||
|
||||
# imToken in-app browser cannot connect after deeplink — Quick Fix
|
||||
|
||||
## Bug
|
||||
|
||||
After Chrome opens imToken's in-app browser, wallet login cannot complete and the wallet debug panel shows `connected: no`.
|
||||
|
||||
## Root Cause
|
||||
|
||||
The frontend looked for an injected wallet provider using the wallet-specific `isImToken` flag. Some imToken mobile versions inject a usable EIP-1193 `window.ethereum` provider but do not expose `isImToken`, so `getInjectedWallet("imToken")` returned `null`. That prevented the imToken direct-login path from using the injected provider and left the flow disconnected.
|
||||
|
||||
## Fix
|
||||
|
||||
Added a narrow imToken in-app-browser fallback: when the requested wallet is `imToken`, no provider has `isImToken`, but the user agent indicates imToken and `window.ethereum` exists, use the injected provider.
|
||||
|
||||
### Files Modified
|
||||
|
||||
- `src/wallet/injected.ts` — adds imToken user-agent fallback for injected provider detection.
|
||||
|
||||
## Verification
|
||||
|
||||
- `npx tsc --noEmit`
|
||||
- `npm run format:check`
|
||||
- `npm test`
|
||||
|
||||
## Notes
|
||||
|
||||
This fallback is limited to imToken browser user agents to avoid changing MetaMask or TokenPocket provider selection behavior.
|
||||
Reference in New Issue
Block a user