From 2d9d35bc978f6e310445050ce1f8a0231022f242 Mon Sep 17 00:00:00 2001 From: VGabriel45 Date: Fri, 27 Dec 2024 13:17:04 +0200 Subject: [PATCH 1/4] fix: signer typescript issues --- src/sdk/account/toNexusAccount.ts | 13 +- src/sdk/account/utils/Utils.ts | 41 ++++-- src/sdk/account/utils/toSigner.test.ts | 13 +- src/sdk/account/utils/toSigner.ts | 170 +++++++++++----------- src/sdk/account/utils/utils.test.ts | 5 +- src/sdk/clients/createNexusClient.test.ts | 34 +++-- src/sdk/clients/createNexusClient.ts | 66 ++++----- 7 files changed, 184 insertions(+), 158 deletions(-) diff --git a/src/sdk/account/toNexusAccount.ts b/src/sdk/account/toNexusAccount.ts index 4f475d915..357ba8cb0 100644 --- a/src/sdk/account/toNexusAccount.ts +++ b/src/sdk/account/toNexusAccount.ts @@ -6,8 +6,6 @@ import { type Chain, type ClientConfig, type Hex, - type LocalAccount, - type OneOf, type Prettify, type PublicClient, type RpcSchema, @@ -67,8 +65,8 @@ import { // Utils import type { Call } from "./utils/Types" import { - type EthersWallet, type TypedDataWith712, + type ValidSigner, addressEquals, eip712WrapHash, getAccountDomainStructFields, @@ -76,7 +74,7 @@ import { isNullOrUndefined, typeToString } from "./utils/Utils" -import { type EthereumProvider, type Signer, toSigner } from "./utils/toSigner" +import { type Signer, toSigner } from "./utils/toSigner" /** * Parameters for creating a Nexus Smart Account @@ -87,12 +85,7 @@ export type ToNexusSmartAccountParameters = { /** The transport configuration */ transport: ClientConfig["transport"] /** The signer account or address */ - signer: OneOf< - | EthereumProvider - | WalletClient - | LocalAccount - | EthersWallet - > + signer: ValidSigner /** Optional index for the account */ index?: bigint | undefined /** Optional active validation module */ diff --git a/src/sdk/account/utils/Utils.ts b/src/sdk/account/utils/Utils.ts index 0ad96ada3..dfbdb39b9 100644 --- a/src/sdk/account/utils/Utils.ts +++ b/src/sdk/account/utils/Utils.ts @@ -1,12 +1,17 @@ import { + type Account, type Address, + type Chain, type Client, type Hash, type Hex, + type LocalAccount, type PublicClient, + type Transport, type TypedData, type TypedDataDomain, type TypedDataParameter, + type WalletClient, concat, decodeFunctionResult, encodeAbiParameters, @@ -276,7 +281,7 @@ export const getAccountMeta = async ( chainId: decoded?.[3] } } - } catch (error) {} + } catch (error) { } return { name: NEXUS_DOMAIN_NAME, version: NEXUS_DOMAIN_VERSION, @@ -385,15 +390,6 @@ export const isTesting = () => { export const safeMultiplier = (bI: bigint, multiplier: number): bigint => BigInt(Math.round(Number(bI) * multiplier)) -export type EthersWallet = { - signTransaction: (...args: AnyData[]) => Promise - signMessage: (...args: AnyData[]) => Promise - signTypedData: (...args: AnyData[]) => Promise - getAddress: () => Promise - address: Address | string - provider: AnyData -} - export const getAllowance = async ( client: PublicClient, accountAddress: Address, @@ -408,3 +404,28 @@ export const getAllowance = async ( return approval as bigint } + +type EthersWalletSigner = { + signTransaction: (...args: AnyData) => AnyData + signMessage: (...args: AnyData) => AnyData + signTypedData: (...args: AnyData) => AnyData + getAddress: () => Promise + address: Address | string + provider: unknown +} + +type LocalAccountSigner = { + type: "local" +} & LocalAccount + +type WalletClientSigner = WalletClient + +type ProviderSigner = { + request(...args: AnyData): Promise +} + +export type ValidSigner = + | EthersWalletSigner + | LocalAccountSigner + | WalletClientSigner + | ProviderSigner diff --git a/src/sdk/account/utils/toSigner.test.ts b/src/sdk/account/utils/toSigner.test.ts index 2f288e3f8..8b6e34eaf 100644 --- a/src/sdk/account/utils/toSigner.test.ts +++ b/src/sdk/account/utils/toSigner.test.ts @@ -1,10 +1,10 @@ -import { JsonRpcProvider, JsonRpcSigner, ethers } from "ethers" +import { JsonRpcProvider, ethers } from "ethers" import { http, type Address, type Hex, createWalletClient } from "viem" import { privateKeyToAccount } from "viem/accounts" import { afterAll, beforeAll, describe, expect, it } from "vitest" import { toNetwork } from "../../../test/testSetup" import { type NetworkConfig, killNetwork, pKey } from "../../../test/testUtils" -import { type EthersWallet, addressEquals } from "./Utils" +import { addressEquals } from "./Utils" import { toSigner } from "./toSigner" const TEST_TYPED_DATA = { @@ -72,8 +72,15 @@ describe("utils.toSigner", () => { }) it("should work with ethers Wallet", async () => { - const wallet = new ethers.Wallet(pKey) as EthersWallet + const wallet = new ethers.Wallet(pKey) const signer = await toSigner({ signer: wallet }) expect(signer.address).toBe(wallet.address) }) + + it("should work with ethers JsonRpcSigner", async () => { + const provider = new JsonRpcProvider(network.rpcUrl) + const signer = await provider.getSigner() + const nexusSigner = await toSigner({ signer }) + expect(nexusSigner.address).toBe(await signer.getAddress()) + }) }) diff --git a/src/sdk/account/utils/toSigner.ts b/src/sdk/account/utils/toSigner.ts index 289e6b398..2d4daf5c4 100644 --- a/src/sdk/account/utils/toSigner.ts +++ b/src/sdk/account/utils/toSigner.ts @@ -4,7 +4,6 @@ import { type Chain, type Hex, type LocalAccount, - type OneOf, type Transport, type WalletClient, createWalletClient, @@ -17,7 +16,7 @@ import { toAccount } from "viem/accounts" import { signTypedData } from "viem/actions" import { getAction } from "viem/utils" import type { AnyData } from "../../modules/utils/Types" -import type { EthersWallet } from "./Utils" +import type { ValidSigner } from "./Utils" export type EthereumProvider = { request(...args: AnyData): Promise } @@ -36,103 +35,106 @@ export type Signer = LocalAccount * @throws {Error} When signTransaction is called (not supported) * @throws {Error} When address is required but not provided */ -export async function toSigner< - provider extends EthereumProvider, - wallet extends EthersWallet ->({ +export async function toSigner({ signer, address }: { - signer: OneOf< - | provider - | wallet - | WalletClient - | LocalAccount - > + signer: ValidSigner address?: Address }): Promise { - if ("provider" in signer) { - const wallet = signer as EthersWallet - const address = await wallet.getAddress() - return toAccount({ - address: getAddress(address), - async signMessage({ message }): Promise { - if (typeof message === "string") { - return await wallet.signMessage(message) - } - if (typeof message?.raw === "string") { - return await wallet.signMessage(hexToBytes(message.raw)) + if (typeof signer === "object") { + if ("provider" in signer) { + const wallet = signer + const address = await wallet.getAddress() + return toAccount({ + address: getAddress(address), + async signMessage({ message }): Promise { + if (typeof message === "string") { + return await wallet.signMessage(message) + } + if (typeof message?.raw === "string") { + return await wallet.signMessage(hexToBytes(message.raw)) + } + return await wallet.signMessage(message.raw) + }, + async signTransaction(_) { + throw new Error("Not supported") + }, + async signTypedData(typedData) { + return wallet.signTypedData( + typedData.domain, + typedData.types, + typedData.message + ) } - return await wallet.signMessage(message.raw) - }, - async signTransaction(_) { - throw new Error("Not supported") - }, - async signTypedData(typedData) { - return wallet.signTypedData( - typedData.domain, - typedData.types, - typedData.message - ) - } - }) - } + }) + } - if ("type" in signer && signer.type === "local") { - return signer as LocalAccount - } + if ("type" in signer && signer.type === "local") { + return signer as LocalAccount + } - let walletClient: - | WalletClient - | undefined = undefined + let walletClient: + | WalletClient + | undefined = undefined - if ("request" in signer) { - if (!address) { - try { - ;[address] = await (signer as EthereumProvider).request({ - method: "eth_requestAccounts" - }) - } catch { - ;[address] = await (signer as EthereumProvider).request({ - method: "eth_accounts" - }) + if ("request" in signer) { + if (!address) { + try { + ;[address] = await (signer as EthereumProvider).request({ + method: "eth_requestAccounts" + }) + } catch { + ;[address] = await (signer as EthereumProvider).request({ + method: "eth_accounts" + }) + } + } + if (!address) { + // For TS to be happy + throw new Error("address is required") } + walletClient = createWalletClient({ + account: address, + transport: custom(signer as EthereumProvider) + }) } - if (!address) { - // For TS to be happy - throw new Error("address is required") + + if (!walletClient) { + walletClient = signer as WalletClient< + Transport, + Chain | undefined, + Account + > } - walletClient = createWalletClient({ - account: address, - transport: custom(signer as EthereumProvider) - }) - } - if (!walletClient) { - walletClient = signer as WalletClient - } + const addressFromWalletClient = + walletClient?.account?.address ?? + (await walletClient?.getAddresses())?.[0] - const addressFromWalletClient = - walletClient?.account?.address ?? (await walletClient?.getAddresses())?.[0] + if (!addressFromWalletClient) { + throw new Error("address not found in wallet client") + } - if (!addressFromWalletClient) { - throw new Error("address not found in wallet client") + return toAccount({ + address: addressFromWalletClient, + async signMessage({ message }) { + return walletClient.signMessage({ message }) + }, + async signTypedData(typedData) { + return getAction( + walletClient, + signTypedData, + "signTypedData" + )(typedData as AnyData) + }, + async signTransaction(_) { + throw new Error( + "Smart account signer doesn't need to sign transactions" + ) + } + }) } - return toAccount({ - address: addressFromWalletClient, - async signMessage({ message }) { - return walletClient.signMessage({ message }) - }, - async signTypedData(typedData) { - return getAction( - walletClient, - signTypedData, - "signTypedData" - )(typedData as AnyData) - }, - async signTransaction(_) { - throw new Error("Smart account signer doesn't need to sign transactions") - } - }) + throw new Error("Signer must be an non empty object") } diff --git a/src/sdk/account/utils/utils.test.ts b/src/sdk/account/utils/utils.test.ts index 986ba514f..4a7ac17a9 100644 --- a/src/sdk/account/utils/utils.test.ts +++ b/src/sdk/account/utils/utils.test.ts @@ -2,7 +2,6 @@ import { ParamType, ethers } from "ethers" import { type AbiParameter, encodeAbiParameters } from "viem" import { generatePrivateKey } from "viem/accounts" import { describe, expect, test } from "vitest" -import type { EthersWallet } from "./Utils" import { toSigner } from "./toSigner" describe("utils", async () => { @@ -61,14 +60,14 @@ describe("utils", async () => { ) test.concurrent("should support ethers Wallet", async () => { - const wallet = new ethers.Wallet(privKey) as EthersWallet + const wallet = new ethers.Wallet(privKey) const signer = await toSigner({ signer: wallet }) const sig = await signer.signMessage({ message: "test" }) expect(sig).toBeDefined() }) test.concurrent("should support ethers Wallet signTypedData", async () => { - const wallet = new ethers.Wallet(privKey) as EthersWallet + const wallet = new ethers.Wallet(privKey) const signer = await toSigner({ signer: wallet }) const appDomain = { chainId: 1, diff --git a/src/sdk/clients/createNexusClient.test.ts b/src/sdk/clients/createNexusClient.test.ts index 08a3b7cf3..67eac47dc 100644 --- a/src/sdk/clients/createNexusClient.test.ts +++ b/src/sdk/clients/createNexusClient.test.ts @@ -1,4 +1,4 @@ -import { Wallet, ethers } from "ethers" +import { JsonRpcProvider, Wallet, ethers } from "ethers" import { http, type Account, @@ -25,14 +25,9 @@ import { import type { MasterClient, NetworkConfig } from "../../test/testUtils" import { ERROR_MESSAGES } from "../account/utils/Constants" import { Logger } from "../account/utils/Logger" -import { - type EthersWallet, - getAccountMeta, - makeInstallDataAndHash -} from "../account/utils/Utils" +import { getAccountMeta, makeInstallDataAndHash } from "../account/utils/Utils" import { getChain } from "../account/utils/getChain" import { k1ValidatorAddress } from "../constants" -import type { AnyData } from "../modules" import { type NexusClient, createNexusClient } from "./createNexusClient" describe("nexus.client", async () => { @@ -272,7 +267,7 @@ describe("nexus.client", async () => { }) const ethersNexusClient = await createNexusClient({ - signer: wallet as EthersWallet, + signer: wallet, chain, transport: http(), bundlerTransport: http(bundlerUrl) @@ -287,7 +282,7 @@ describe("nexus.client", async () => { test("should send user operation using ethers Wallet", async () => { const ethersWallet = new ethers.Wallet(privKey) const ethersNexusClient = await createNexusClient({ - signer: ethersWallet as EthersWallet, + signer: ethersWallet, chain, transport: http(), bundlerTransport: http(bundlerUrl) @@ -307,7 +302,26 @@ describe("nexus.client", async () => { expect(receipt.success).toBe(true) }) - test("should send sequential user ops", async () => { + test("should send user operation using ethers Wallet JsonRpcSigner", async () => { + const provider = new JsonRpcProvider(network.rpcUrl) + const signer = await provider.getSigner() + const nexusClient = await createNexusClient({ + signer, + chain: network.chain, + transport: http(), + bundlerTransport: http(bundlerUrl) + }) + + await topUp(testClient, nexusClient.account.address, parseEther("0.01")) + + const hash = await nexusClient.sendTransaction({ + calls: [{ to: recipientAddress, value: 0n }] + }) + const receipt = await nexusClient.waitForTransactionReceipt({ hash }) + console.log("Nexus client receipt: ", receipt) + }) + + test.skip("should send sequential user ops", async () => { const start = performance.now() const receipts: UserOperationReceipt[] = [] for (let i = 0; i < 3; i++) { diff --git a/src/sdk/clients/createNexusClient.ts b/src/sdk/clients/createNexusClient.ts index 7e0a6d8ba..ad11237ff 100644 --- a/src/sdk/clients/createNexusClient.ts +++ b/src/sdk/clients/createNexusClient.ts @@ -1,17 +1,13 @@ import type { - Account, Address, BundlerRpcSchema, Chain, Client, ClientConfig, EstimateFeesPerGasReturnType, - LocalAccount, - OneOf, Prettify, RpcSchema, - Transport, - WalletClient + Transport } from "viem" import type { BundlerActions, @@ -21,13 +17,12 @@ import type { UserOperationRequest } from "viem/account-abstraction" +import type { ValidSigner } from "../account" import { type NexusAccount, type ToNexusSmartAccountParameters, toNexusAccount } from "../account/toNexusAccount" -import type { EthersWallet } from "../account/utils/Utils" -import type { EthereumProvider } from "../account/utils/toSigner" import { k1ValidatorAddress as k1ValidatorAddress_, k1ValidatorFactoryAddress @@ -54,14 +49,14 @@ export type NexusClient< Client< transport, chain extends Chain - ? chain - : client extends Client - ? chain - : undefined, + ? chain + : client extends Client + ? chain + : undefined, account, rpcSchema extends RpcSchema - ? [...BundlerRpcSchema, ...rpcSchema] - : BundlerRpcSchema, + ? [...BundlerRpcSchema, ...rpcSchema] + : BundlerRpcSchema, BundlerActions > > & @@ -115,38 +110,33 @@ export type NexusClientConfig< client?: client | Client | undefined /** Paymaster configuration. */ paymaster?: - | true - | { - /** Retrieves paymaster-related User Operation properties to be used for sending the User Operation. */ - getPaymasterData?: PaymasterActions["getPaymasterData"] | undefined - /** Retrieves paymaster-related User Operation properties to be used for gas estimation. */ - getPaymasterStubData?: - | PaymasterActions["getPaymasterStubData"] - | undefined - } + | true + | { + /** Retrieves paymaster-related User Operation properties to be used for sending the User Operation. */ + getPaymasterData?: PaymasterActions["getPaymasterData"] | undefined + /** Retrieves paymaster-related User Operation properties to be used for gas estimation. */ + getPaymasterStubData?: + | PaymasterActions["getPaymasterStubData"] | undefined + } + | undefined /** Paymaster context to pass to `getPaymasterData` and `getPaymasterStubData` calls. */ paymasterContext?: PaymasterContext /** User Operation configuration. */ userOperation?: - | { - /** Prepares fee properties for the User Operation request. */ - estimateFeesPerGas?: - | ((parameters: { - account: SmartAccount | undefined - bundlerClient: Client - userOperation: UserOperationRequest - }) => Promise>) - | undefined - } + | { + /** Prepares fee properties for the User Operation request. */ + estimateFeesPerGas?: + | ((parameters: { + account: SmartAccount | undefined + bundlerClient: Client + userOperation: UserOperationRequest + }) => Promise>) | undefined + } + | undefined /** Owner of the account. */ - signer: OneOf< - | EthereumProvider - | WalletClient - | LocalAccount - | EthersWallet - > + signer: ValidSigner /** Index of the account. */ index?: bigint /** Active module of the account. */ From e89dd079282da216bb248173b00816d4565d00d0 Mon Sep 17 00:00:00 2001 From: VGabriel45 Date: Fri, 27 Dec 2024 13:36:43 +0200 Subject: [PATCH 2/4] feat: add JsonRpcSigner type --- src/sdk/account/utils/Utils.ts | 10 +++++++++- src/sdk/account/utils/toSigner.ts | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sdk/account/utils/Utils.ts b/src/sdk/account/utils/Utils.ts index dfbdb39b9..8dad86fec 100644 --- a/src/sdk/account/utils/Utils.ts +++ b/src/sdk/account/utils/Utils.ts @@ -410,7 +410,14 @@ type EthersWalletSigner = { signMessage: (...args: AnyData) => AnyData signTypedData: (...args: AnyData) => AnyData getAddress: () => Promise - address: Address | string + provider: unknown +} + +type JsonRpcSigner = { + signTransaction: (...args: AnyData) => AnyData + signMessage: (...args: AnyData) => AnyData + _signTypedData: (...args: AnyData) => AnyData + getAddress: () => Promise provider: unknown } @@ -429,3 +436,4 @@ export type ValidSigner = | LocalAccountSigner | WalletClientSigner | ProviderSigner + | JsonRpcSigner diff --git a/src/sdk/account/utils/toSigner.ts b/src/sdk/account/utils/toSigner.ts index 2d4daf5c4..070492d5c 100644 --- a/src/sdk/account/utils/toSigner.ts +++ b/src/sdk/account/utils/toSigner.ts @@ -61,6 +61,13 @@ export async function toSigner({ throw new Error("Not supported") }, async signTypedData(typedData) { + if ("_signTypedData" in wallet) { + return wallet._signTypedData( + typedData.domain, + typedData.types, + typedData.message + ) + } return wallet.signTypedData( typedData.domain, typedData.types, From fc99bf9b95e6eeb3d0abb10a586051124e378f8c Mon Sep 17 00:00:00 2001 From: VGabriel45 Date: Wed, 15 Jan 2025 12:06:20 +0200 Subject: [PATCH 3/4] chore: lint --- src/sdk/account/utils/Utils.ts | 2 +- .../clients/createSmartAccountClient.test.ts | 26 +++++----- src/sdk/clients/createSmartAccountClient.ts | 50 +++++++++---------- .../decorators/preparePermission.ts | 1 + 4 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/sdk/account/utils/Utils.ts b/src/sdk/account/utils/Utils.ts index 332210b26..4fcc3459c 100644 --- a/src/sdk/account/utils/Utils.ts +++ b/src/sdk/account/utils/Utils.ts @@ -281,7 +281,7 @@ export const getAccountMeta = async ( chainId: decoded?.[3] } } - } catch (error) { } + } catch (error) {} return { name: NEXUS_DOMAIN_NAME, version: NEXUS_DOMAIN_VERSION, diff --git a/src/sdk/clients/createSmartAccountClient.test.ts b/src/sdk/clients/createSmartAccountClient.test.ts index c35058099..fb829aeed 100644 --- a/src/sdk/clients/createSmartAccountClient.test.ts +++ b/src/sdk/clients/createSmartAccountClient.test.ts @@ -204,19 +204,19 @@ describe("nexus.client", async () => { test("should have correct fields", async () => { const chainId = 1 const chain = getChain(chainId) - ;[ - "blockExplorers", - "contracts", - "fees", - "formatters", - "id", - "name", - "nativeCurrency", - "rpcUrls", - "serializers" - ].every((field) => { - expect(chain).toHaveProperty(field) - }) + ;[ + "blockExplorers", + "contracts", + "fees", + "formatters", + "id", + "name", + "nativeCurrency", + "rpcUrls", + "serializers" + ].every((field) => { + expect(chain).toHaveProperty(field) + }) }) test("should throw an error, chain id not found", async () => { diff --git a/src/sdk/clients/createSmartAccountClient.ts b/src/sdk/clients/createSmartAccountClient.ts index b4b7ccee7..c5cd6ca2b 100644 --- a/src/sdk/clients/createSmartAccountClient.ts +++ b/src/sdk/clients/createSmartAccountClient.ts @@ -54,14 +54,14 @@ export type NexusClient< Client< transport, chain extends Chain - ? chain - : client extends Client - ? chain - : undefined, + ? chain + : client extends Client + ? chain + : undefined, account, rpcSchema extends RpcSchema - ? [...BundlerRpcSchema, ...rpcSchema] - : BundlerRpcSchema, + ? [...BundlerRpcSchema, ...rpcSchema] + : BundlerRpcSchema, BundlerActions > > & @@ -121,31 +121,31 @@ export type SmartAccountClientConfig< client?: client | Client | undefined /** Paymaster configuration. */ paymaster?: - | true - | { - /** Retrieves paymaster-related User Operation properties to be used for sending the User Operation. */ - getPaymasterData?: PaymasterActions["getPaymasterData"] | undefined - /** Retrieves paymaster-related User Operation properties to be used for gas estimation. */ - getPaymasterStubData?: - | PaymasterActions["getPaymasterStubData"] + | true + | { + /** Retrieves paymaster-related User Operation properties to be used for sending the User Operation. */ + getPaymasterData?: PaymasterActions["getPaymasterData"] | undefined + /** Retrieves paymaster-related User Operation properties to be used for gas estimation. */ + getPaymasterStubData?: + | PaymasterActions["getPaymasterStubData"] + | undefined + } | undefined - } - | undefined /** Paymaster context to pass to `getPaymasterData` and `getPaymasterStubData` calls. */ paymasterContext?: PaymasterContext /** User Operation configuration. */ userOperation?: - | { - /** Prepares fee properties for the User Operation request. */ - estimateFeesPerGas?: - | ((parameters: { - account: SmartAccount | undefined - bundlerClient: Client - userOperation: UserOperationRequest - }) => Promise>) + | { + /** Prepares fee properties for the User Operation request. */ + estimateFeesPerGas?: + | ((parameters: { + account: SmartAccount | undefined + bundlerClient: Client + userOperation: UserOperationRequest + }) => Promise>) + | undefined + } | undefined - } - | undefined /** Owner of the account. */ signer: ValidSigner /** Index of the account. */ diff --git a/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts b/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts index 96c25abe3..ede3e1290 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts @@ -167,6 +167,7 @@ export const getPermissionAction = async ({ const session: Session = { chainId: BigInt(chainId), + permitERC4337Paymaster: true, sessionValidator: OWNABLE_VALIDATOR_ADDRESS, sessionValidatorInitData: encodeValidationData({ threshold: 1, From fa3bd8000fb2e797110268ab9492933637b5b526 Mon Sep 17 00:00:00 2001 From: VGabriel45 Date: Wed, 15 Jan 2025 12:26:54 +0200 Subject: [PATCH 4/4] fix: fix test and remove permitERC4337Paymaster from session obj --- .../clients/createSmartAccountClient.test.ts | 30 ++++++++++--------- .../decorators/preparePermission.ts | 1 - 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/sdk/clients/createSmartAccountClient.test.ts b/src/sdk/clients/createSmartAccountClient.test.ts index fb829aeed..2e9331696 100644 --- a/src/sdk/clients/createSmartAccountClient.test.ts +++ b/src/sdk/clients/createSmartAccountClient.test.ts @@ -204,19 +204,19 @@ describe("nexus.client", async () => { test("should have correct fields", async () => { const chainId = 1 const chain = getChain(chainId) - ;[ - "blockExplorers", - "contracts", - "fees", - "formatters", - "id", - "name", - "nativeCurrency", - "rpcUrls", - "serializers" - ].every((field) => { - expect(chain).toHaveProperty(field) - }) + ;[ + "blockExplorers", + "contracts", + "fees", + "formatters", + "id", + "name", + "nativeCurrency", + "rpcUrls", + "serializers" + ].every((field) => { + expect(chain).toHaveProperty(field) + }) }) test("should throw an error, chain id not found", async () => { @@ -323,7 +323,9 @@ describe("nexus.client", async () => { signer, chain: network.chain, transport: http(), - bundlerTransport: http(bundlerUrl) + bundlerTransport: http(bundlerUrl), + k1ValidatorAddress: TEST_ADDRESS_K1_VALIDATOR_ADDRESS, + factoryAddress: TEST_ADDRESS_K1_VALIDATOR_FACTORY_ADDRESS }) await topUp(testClient, nexusClient.account.address, parseEther("0.01")) diff --git a/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts b/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts index ede3e1290..96c25abe3 100644 --- a/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts +++ b/src/sdk/modules/smartSessionsValidator/decorators/preparePermission.ts @@ -167,7 +167,6 @@ export const getPermissionAction = async ({ const session: Session = { chainId: BigInt(chainId), - permitERC4337Paymaster: true, sessionValidator: OWNABLE_VALIDATOR_ADDRESS, sessionValidatorInitData: encodeValidationData({ threshold: 1,