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 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" })