debug
This commit is contained in:
parent
20585c8ac9
commit
3ec7fab2f2
@ -29,6 +29,7 @@ import { useWalletConnection } from './useWalletConnection';
|
||||
import { useSignTypedData } from 'wagmi';
|
||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||
import { usePrivy } from '@privy-io/react-auth';
|
||||
|
||||
const AccountsContext = createContext<ReturnType<typeof useAccountsContext> | undefined>(undefined);
|
||||
|
||||
@ -199,6 +200,7 @@ const useAccountsContext = () => {
|
||||
chainId,
|
||||
},
|
||||
});
|
||||
const { ready, authenticated } = usePrivy();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
@ -216,7 +218,7 @@ const useAccountsContext = () => {
|
||||
|
||||
const evmDerivedAccount = evmDerivedAddresses[evmAddress];
|
||||
|
||||
if (walletConnectionType === WalletConnectionType.Privy) {
|
||||
if (walletConnectionType === WalletConnectionType.Privy && authenticated && ready) {
|
||||
try {
|
||||
const signature = await signTypedDataAsync();
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ export const useWalletConnection = () => {
|
||||
[walletConnectConfig, walletType, walletConnectionType]
|
||||
);
|
||||
|
||||
const { connectAsync: connectWagmi } = useConnectWagmi({ connector: wagmiConnector })
|
||||
const { connectAsync: connectWagmi } = useConnectWagmi({ connector: wagmiConnector });
|
||||
const { suggestAndConnect: connectGraz } = useConnectGraz();
|
||||
const { login, ready, authenticated } = usePrivy();
|
||||
const { logout } = useLogout();
|
||||
@ -118,6 +118,7 @@ export const useWalletConnection = () => {
|
||||
if (!walletConnection) {
|
||||
throw new Error('Onboarding: No wallet connection found.');
|
||||
} else if (walletConnection.type === WalletConnectionType.Privy) {
|
||||
console.log({ isConnectedWagmi, authenticated, ready });
|
||||
if (!isConnectedWagmi && !authenticated && ready) {
|
||||
login();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user