fix: require signature for tokenpocket direct login
This commit is contained in:
@@ -3,8 +3,8 @@ import { useAccount, useConnect, useDisconnect } from "wagmi";
|
||||
import { bsc } from "wagmi/chains";
|
||||
import { hasWalletConnectProjectId } from "./RainbowWalletProvider";
|
||||
import {
|
||||
connectInjectedWallet,
|
||||
getInjectedWallet,
|
||||
signInWithInjectedWallet,
|
||||
type WalletKind,
|
||||
} from "./injected";
|
||||
import { localWalletToken, useWallet } from "./WalletProvider";
|
||||
@@ -98,8 +98,8 @@ function connectorMatchesWallet(
|
||||
* 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. No message signature,
|
||||
* backend nonce, or verify call is required.
|
||||
* 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
|
||||
@@ -177,21 +177,26 @@ export function useWalletConnectLogin() {
|
||||
getInjectedWallet(preferredWallet)
|
||||
) {
|
||||
try {
|
||||
const injectedAddress = await connectInjectedWallet(preferredWallet);
|
||||
console.info("[wallet-login] injected connected", {
|
||||
setState("signing");
|
||||
const result = await signInWithInjectedWallet(preferredWallet);
|
||||
console.info("[wallet-login] injected verified", {
|
||||
preferredWallet,
|
||||
address: injectedAddress,
|
||||
address: result.wallet,
|
||||
chain: "BNB Chain",
|
||||
chainId: bsc.id,
|
||||
});
|
||||
completeLogin(localWalletToken(injectedAddress), injectedAddress);
|
||||
completeLogin(result.token, result.wallet);
|
||||
setState("idle");
|
||||
return;
|
||||
} catch (err) {
|
||||
console.info("[wallet-login] injected connect fallback to wc", {
|
||||
pendingRef.current = false;
|
||||
setState("idle");
|
||||
setError(err instanceof Error ? err.message : "Wallet login failed");
|
||||
console.info("[wallet-login] injected verification failed", {
|
||||
preferredWallet,
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user