fix: restore imtoken direct login path
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
connectInjectedWallet,
|
||||
getInjectedWallet,
|
||||
signInWithInjectedWallet,
|
||||
type WalletKind,
|
||||
} from "./injected";
|
||||
import { useWallet } from "./WalletProvider";
|
||||
import { localWalletToken, useWallet } from "./WalletProvider";
|
||||
|
||||
const AUTO_LOGIN_PARAM = "autoLogin";
|
||||
const ETHEREUM_WAIT_MS = 8000;
|
||||
@@ -67,6 +68,13 @@ export function AutoInjectedLogin() {
|
||||
void waitForInjected(kind).then(async (ready) => {
|
||||
if (cancelled || !ready) return;
|
||||
try {
|
||||
if (kind === "imToken") {
|
||||
const address = await connectInjectedWallet(kind);
|
||||
if (cancelled) return;
|
||||
completeLogin(localWalletToken(address), address);
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await signInWithInjectedWallet(kind);
|
||||
if (cancelled) return;
|
||||
completeLogin(res.token, res.wallet);
|
||||
|
||||
Reference in New Issue
Block a user