From c13cf4e9fc98d8c039747b9d80ade90a72bca6ab Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sat, 24 Feb 2024 20:17:17 -0700 Subject: [PATCH 1/2] change providerToSmartAccountSigner positional args to keyword args --- .../ep-0.7/walletClientToCustomSigner.test.ts | 24 +++++-------------- .../utils/providerToSmartAccountSigner.ts | 9 ++++--- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/packages/permissionless-test/ep-0.7/walletClientToCustomSigner.test.ts b/packages/permissionless-test/ep-0.7/walletClientToCustomSigner.test.ts index b785f9b1..dff3c9c0 100644 --- a/packages/permissionless-test/ep-0.7/walletClientToCustomSigner.test.ts +++ b/packages/permissionless-test/ep-0.7/walletClientToCustomSigner.test.ts @@ -244,20 +244,14 @@ describe("Simple Account from walletClient", () => { const publicClient = await getPublicClient() const bundlerClient = getBundlerClient() + const pimlicoPaymaster = getPimlicoPaymasterClient() const smartAccountClient = await getSmartAccountClient({ account: await getSignerToSimpleSmartAccount({ signer: await getCustomSignerToSimpleSmartAccount() }), - sponsorUserOperation: async ({ - entryPoint: _entryPoint, - userOperation - }) => { - const pimlicoPaymaster = getPimlicoPaymasterClient() - return pimlicoPaymaster.sponsorUserOperation({ - userOperation, - entryPoint: getEntryPoint() - }) + middleware: { + sponsorUserOperation: pimlicoPaymaster.sponsorUserOperation } }) @@ -304,20 +298,14 @@ describe("Simple Account from walletClient", () => { const publicClient = await getPublicClient() const bundlerClient = getBundlerClient() + const pimlicoPaymaster = getPimlicoPaymasterClient() const smartAccountClient = await getSmartAccountClient({ account: await getSignerToSimpleSmartAccount({ signer: await getCustomSignerToSimpleSmartAccount() }), - sponsorUserOperation: async ({ - entryPoint: _entryPoint, - userOperation - }) => { - const pimlicoPaymaster = getPimlicoPaymasterClient() - return pimlicoPaymaster.sponsorUserOperation({ - userOperation, - entryPoint: getEntryPoint() - }) + middleware: { + sponsorUserOperation: pimlicoPaymaster.sponsorUserOperation } }) diff --git a/packages/permissionless/utils/providerToSmartAccountSigner.ts b/packages/permissionless/utils/providerToSmartAccountSigner.ts index 23b34c4d..efbaaa56 100644 --- a/packages/permissionless/utils/providerToSmartAccountSigner.ts +++ b/packages/permissionless/utils/providerToSmartAccountSigner.ts @@ -6,10 +6,13 @@ import { } from "viem" import { walletClientToSmartAccountSigner } from "./walletClientToSmartAccountSigner" -export const providerToSmartAccountSigner = async ( - provider: EIP1193Provider, +export const providerToSmartAccountSigner = async ({ + provider, + signerAddress +}: { + provider: EIP1193Provider signerAddress?: Hex -) => { +}) => { let account: Hex if (!signerAddress) { ;[account] = await provider.request({ method: "eth_requestAccounts" }) From f860a3a0678418b820a84e222f444f5bd21f1782 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Sat, 24 Feb 2024 20:19:21 -0700 Subject: [PATCH 2/2] add changeset --- .changeset/good-rocks-trade.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/good-rocks-trade.md diff --git a/.changeset/good-rocks-trade.md b/.changeset/good-rocks-trade.md new file mode 100644 index 00000000..e6f9089c --- /dev/null +++ b/.changeset/good-rocks-trade.md @@ -0,0 +1,5 @@ +--- +"permissionless": minor +--- + +providerToSmartAccountSigner accepts keyword args