fix(wallet): improve imtoken mobile login fallback
This commit is contained in:
@@ -175,6 +175,28 @@ export function logWalletProviders(): void {
|
||||
});
|
||||
}
|
||||
|
||||
export async function connectInjectedWallet(
|
||||
kind?: WalletKind,
|
||||
): Promise<string> {
|
||||
/* eslint-disable no-console */
|
||||
console.info("[wallet-login] start injected connect", { kind });
|
||||
logWalletProviders();
|
||||
const ethereum = getInjectedWallet(kind);
|
||||
if (!ethereum) {
|
||||
console.warn("[wallet-login] no injected provider found");
|
||||
throw new Error("No injected wallet found");
|
||||
}
|
||||
|
||||
console.info("[wallet-login] requesting BNB wallet account…");
|
||||
const address = await requestInjectedAddress(ethereum);
|
||||
console.info("[wallet-login] injected account", address);
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user