From 29b5342a7975b9a4266669ad90094e2d5f7d4da8 Mon Sep 17 00:00:00 2001 From: Karandeep Singh <90941366+KannuSingh@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:31:38 -0400 Subject: [PATCH] fix: permissions module installation (#669) --- .../src/lib/smart-accounts/SafeSmartAccountLib.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/advanced/wallets/react-wallet-v2/src/lib/smart-accounts/SafeSmartAccountLib.ts b/advanced/wallets/react-wallet-v2/src/lib/smart-accounts/SafeSmartAccountLib.ts index 56f5dcf0f..514dda7fc 100644 --- a/advanced/wallets/react-wallet-v2/src/lib/smart-accounts/SafeSmartAccountLib.ts +++ b/advanced/wallets/react-wallet-v2/src/lib/smart-accounts/SafeSmartAccountLib.ts @@ -8,7 +8,14 @@ import { import { SmartAccountLib } from './SmartAccountLib' import { SmartAccount, signerToSafeSmartAccount } from 'permissionless/accounts' import { EntryPoint } from 'permissionless/types/entrypoint' -import { Address, Hex, WalletGrantPermissionsParameters, createWalletClient, http,type WalletGrantPermissionsReturnType } from 'viem' +import { + Address, + Hex, + WalletGrantPermissionsParameters, + createWalletClient, + http, + type WalletGrantPermissionsReturnType +} from 'viem' import { MultiKeySigner } from 'viem/_types/experimental/erc7715/types/signer' import { bigIntReplacer } from '@/utils/HelperUtil' import { @@ -94,7 +101,9 @@ export class SafeSmartAccountLib extends SmartAccountLib { } /* 7715 method */ - async grantPermissions(grantPermissionsRequestParameters: WalletGrantPermissionsParameters):Promise { + async grantPermissions( + grantPermissionsRequestParameters: WalletGrantPermissionsParameters + ): Promise { if (!this.client?.account) { throw new Error('Client not initialized') } @@ -173,7 +182,7 @@ export class SafeSmartAccountLib extends SmartAccountLib { }) } - if (isAccountDeployed && !mockValidatorInstalled) { + if (!isAccountDeployed || !mockValidatorInstalled) { installModules.push({ address: mockValidator, type: 'validator',