diff --git a/src/App.tsx b/src/App.tsx index 2cae08b..715aff5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -51,7 +51,6 @@ export default function App() { }> - {/* English (root, no prefix) */} } @@ -79,7 +78,6 @@ export default function App() { element={} /> - {/* Each non-English language gets its own nested tree. */} {localizedHomeRoutes.map((route) => ( { }); } -/** - * When the page is opened via a `?autoLogin=` deeplink (typically from - * inside TokenPocket / imToken in-app browsers), wait for the wallet to inject - * `window.ethereum`, then complete wallet login without WalletConnect. imToken - * may drop the query string while opening its in-app browser, so imToken browser - * detection also starts the same direct-login path. - */ export function AutoInjectedLogin() { const { completeLogin, status } = useWallet(); @@ -81,7 +74,6 @@ export function AutoInjectedLogin() { if (cancelled) return; completeLogin(res.token, res.wallet); } catch (err) { - // eslint-disable-next-line no-console console.warn("[wallet-autologin] failed", err); } }); diff --git a/src/wallet/WalletBrandIcon.tsx b/src/wallet/WalletBrandIcon.tsx index 86eeaed..ad3fac3 100644 --- a/src/wallet/WalletBrandIcon.tsx +++ b/src/wallet/WalletBrandIcon.tsx @@ -8,11 +8,6 @@ const brands: Record = { imToken: { bg: "#11C4D1", label: "im" }, }; -/** - * Lightweight brand badge for wallet buttons — a rounded square tinted with the - * wallet's brand color and its monogram. Keeps bundle small while making each - * wallet visually distinguishable. - */ export function WalletBrandIcon({ kind, size = 28, diff --git a/src/wallet/WalletStackErrorBoundary.tsx b/src/wallet/WalletStackErrorBoundary.tsx index 2dd1d00..3a55e81 100644 --- a/src/wallet/WalletStackErrorBoundary.tsx +++ b/src/wallet/WalletStackErrorBoundary.tsx @@ -11,7 +11,6 @@ export class WalletStackErrorBoundary extends Component { } componentDidCatch(error: unknown): void { - // eslint-disable-next-line no-console console.error("[wallet-stack] error boundary caught", error); } diff --git a/src/wallet/injected.ts b/src/wallet/injected.ts index fcfc66d..e1fa866 100644 --- a/src/wallet/injected.ts +++ b/src/wallet/injected.ts @@ -120,7 +120,6 @@ async function personalSign(params: { }); } catch (error) { if (!shouldRetryPersonalSign(error)) throw error; - // Some injected wallets incorrectly expect the legacy param order. return ethereum .request({ method: "personal_sign", @@ -157,16 +156,11 @@ export function getInjectedWallet(kind?: WalletKind): EthereumProvider | null { }); if (match) return match; - // Some imToken mobile versions inject a usable EIP-1193 provider without - // setting `isImToken`. Inside the imToken in-app browser, prefer the injected - // provider instead of falling back to WalletConnect, which can leave the UI at - // connected:no on China networks. if (kind === "imToken" && isImTokenBrowser()) return providers[0] ?? ethereum; return null; } -/** Diagnostic: log what injected providers the browser exposes. */ export function logWalletProviders(): void { const ethereum = getInjectedEthereum(); const list = ( @@ -180,7 +174,6 @@ export function logWalletProviders(): void { isTokenPocket: Boolean(p.isTokenPocket), isImToken: Boolean(p.isImToken), })); - // eslint-disable-next-line no-console console.info("[wallet-login] providers", { hasEthereum: Boolean(ethereum), count: list.length, @@ -191,7 +184,6 @@ export function logWalletProviders(): void { export async function connectInjectedWallet( kind?: WalletKind, ): Promise { - /* eslint-disable no-console */ console.info("[wallet-login] start injected connect", { kind }); logWalletProviders(); const ethereum = getInjectedWallet(kind); @@ -207,14 +199,12 @@ export async function connectInjectedWallet( console.info("[wallet-login] ensuring BNB Chain (0x38)…"); await ensureBnbChain(ethereum); return address; - /* eslint-enable no-console */ } export async function signInWithInjectedWallet(kind?: WalletKind): Promise<{ token: string; wallet: string; }> { - /* eslint-disable no-console */ console.info("[wallet-login] start injected", { kind }); logWalletProviders(); const ethereum = getInjectedWallet(kind); @@ -223,8 +213,6 @@ export async function signInWithInjectedWallet(kind?: WalletKind): Promise<{ throw new Error("No injected wallet found"); } - // BNB Smart Chain is EVM-compatible, so browser wallets still expose the - // standard EIP-1193 method names (`eth_*`) while operating on BNB chain 56. console.info("[wallet-login] requesting BNB wallet account…"); const address = await requestInjectedAddress(ethereum); console.info("[wallet-login] account", address); @@ -248,5 +236,4 @@ export async function signInWithInjectedWallet(kind?: WalletKind): Promise<{ }); console.info("[wallet-login] verified, wallet =", result.wallet); return result; - /* eslint-enable no-console */ } diff --git a/src/wallet/token.ts b/src/wallet/token.ts index c27f308..1a9a043 100644 --- a/src/wallet/token.ts +++ b/src/wallet/token.ts @@ -14,7 +14,7 @@ export function writeWalletToken(token: string): void { try { window.localStorage.setItem(walletTokenKey, token); } catch { - // Ignore storage failures; session will only live in memory. + return; } } @@ -23,6 +23,6 @@ export function clearWalletToken(): void { try { window.localStorage.removeItem(walletTokenKey); } catch { - // Ignore storage failures. + return; } } diff --git a/src/wallet/useWalletConnectLogin.ts b/src/wallet/useWalletConnectLogin.ts index ca7036c..f17b3b0 100644 --- a/src/wallet/useWalletConnectLogin.ts +++ b/src/wallet/useWalletConnectLogin.ts @@ -95,17 +95,6 @@ function connectorMatchesWallet( return false; } -/** - * MetaMask / imToken QR fallback via RainbowKit + WalletConnect. - * - * Flow: connect through RainbowKit/Wagmi on BNB Chain -> once an account is - * connected, complete a local frontend wallet session. WalletConnect fallback - * does not require message signature, backend nonce, or verify call. - * - * Entirely gated behind a real `VITE_WALLETCONNECT_PROJECT_ID`: when it is - * missing `available` is false and `start` is a no-op, so callers can hide or - * disable the entry instead of triggering a connect with a fake project id. - */ export function useWalletConnectLogin() { const available = hasWalletConnectProjectId(); const { address: localAddress, completeLogin } = useWallet(); @@ -215,10 +204,6 @@ export function useWalletConnectLogin() { } } - // QR mode must always use a WalletConnect-compatible connector so the - // desktop page can render a scannable `wc:` URI instead of opening a - // local browser extension. Deeplink mode can prefer wallet-specific - // connectors (notably MetaMask SDK on mobile). const walletConnectConnector = connectors.find((item) => item.type === "walletConnect") ?? connectors.find((item) => item.id === "walletConnect");