Skip to content

Commit e45cc0f

Browse files
authored
slow down to avoid possible privy race conditions (#480)
1 parent 7508633 commit e45cc0f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

apps/connect/src/routes/login.lazy.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ function Login() {
8888
transport: custom(privyProvider),
8989
});
9090

91+
await new Promise((resolve) => setTimeout(resolve, 500)); // trying to slow down since Privy seems to have a race condition
92+
9193
await hypergraphLogin(walletClient, embeddedWallet);
9294

9395
const redirect = localStorage.getItem('geo-connect-authenticate-redirect');

packages/hypergraph/src/connect/login.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const getAndUpdateSmartAccount = async (
137137
console.log('smartAccountWalletClient', smartAccountWalletClient);
138138
console.log('address', smartAccountWalletClient.account.address);
139139
console.log('is deployed', await isSmartAccountDeployed(smartAccountWalletClient));
140+
await new Promise((resolve) => setTimeout(resolve, 250)); // trying to slow down since Privy seems to have a race condition
140141
// This will prompt the user to sign a user operation to update the smart account
141142
if (await smartAccountNeedsUpdate(smartAccountWalletClient, chain, rpcUrl)) {
142143
console.log('updating smart account');
@@ -145,6 +146,7 @@ const getAndUpdateSmartAccount = async (
145146
// Create the client again to ensure we have the 7579 config now
146147
return getSmartAccountWalletClient(smartAccountParams);
147148
}
149+
await new Promise((resolve) => setTimeout(resolve, 250)); // trying to slow down since Privy seems to have a race condition
148150
console.log('leaving getAndUpdateSmartAccount');
149151
return smartAccountWalletClient;
150152
};

0 commit comments

Comments
 (0)