Skip to content

Commit 0dd9839

Browse files
committed
better handling of account upgrade
1 parent 0cc9442 commit 0dd9839

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

apps/connect/src/routes/authenticate.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ function AuthenticateComponent() {
396396
console.log('smart session created');
397397
const smartAccountClient = await getSmartAccountWalletClient({
398398
owner: walletClient,
399+
address: accountAddress,
399400
chain: CHAIN,
400401
rpcUrl: import.meta.env.VITE_HYPERGRAPH_RPC_URL,
401402
});

packages/hypergraph/src/connect/login.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ const getAndDeploySmartAccount = async (walletClient: WalletClient, rpcUrl: stri
124124
if (await smartAccountNeedsUpdate(smartAccountWalletClient, chain, rpcUrl)) {
125125
console.log('updating smart account');
126126
await updateLegacySmartAccount(smartAccountWalletClient, chain, rpcUrl);
127-
} else if (!(await isSmartAccountDeployed(smartAccountWalletClient))) {
127+
smartAccountParams.address = smartAccountWalletClient.account.address;
128+
// Create the client again to ensure we have the 7579 config now
129+
return getSmartAccountWalletClient(smartAccountParams);
130+
}
131+
if (!(await isSmartAccountDeployed(smartAccountWalletClient))) {
128132
// TODO: remove this once we manage to get counterfactual signatures working
129133
console.log('sending dummy userOp to deploy smart account');
130134
if (!walletClient.account) {

0 commit comments

Comments
 (0)