Skip to content

Commit 99a8687

Browse files
committed
fix: call installModule directly
wasn't setting up correctly so future call failed
1 parent 7899eb1 commit 99a8687

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/auth-server/composables/useRecoveryGuardian.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Account, Address, Chain, Hex, Transport, WalletClient } from "viem";
2-
import { encodeAbiParameters, keccak256, parseAbiParameters, toHex } from "viem";
2+
import { encodeAbiParameters, encodeFunctionData, keccak256, parseAbiParameters, toHex } from "viem";
33
import { waitForTransactionReceipt } from "viem/actions";
44
import { base64urlToUint8Array, getPublicKeyBytesFromPasskeySignature } from "zksync-sso-4337/utils";
55

@@ -190,8 +190,9 @@ export const useRecoveryGuardian = () => {
190190

191191
// Install module if not already installed
192192
if (!isModuleInstalled) {
193-
const installTx = await client.writeContract({
194-
address: accountAddress,
193+
// NOTE: installModule must be called DIRECTLY on the account (not wrapped in execute)
194+
// We use sendTransaction with the encoded installModule call as the data
195+
const installModuleData = encodeFunctionData({
195196
abi: [{
196197
type: "function",
197198
name: "installModule",
@@ -207,6 +208,11 @@ export const useRecoveryGuardian = () => {
207208
args: [1n, contracts.guardianExecutor, "0x"], // 1 = MODULE_TYPE_EXECUTOR, empty initData
208209
});
209210

211+
const installTx = await client.sendTransaction({
212+
to: accountAddress,
213+
data: installModuleData,
214+
});
215+
210216
const installReceipt = await client.waitForTransactionReceipt({ hash: installTx });
211217

212218
if (installReceipt.status === "reverted") {

0 commit comments

Comments
 (0)