Skip to content

Commit

Permalink
Merge pull request #338 from pimlicolabs/fix/prepareUserOperationForE…
Browse files Browse the repository at this point in the history
…rc20Paymaster

Fix/prepare user operation for erc20 paymaster
  • Loading branch information
plusminushalf authored Dec 1, 2024
2 parents 2df14e9 + edb8baf commit b8f1f98
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-pugs-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"permissionless": patch
---

Fixed use of getPaymasterData twice in prepareUserOperationForErc20Paymaster
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
} from "viem"
import {
type BundlerClient,
type GetPaymasterDataParameters,
type GetPaymasterDataReturnType,
type PrepareUserOperationParameters,
type PrepareUserOperationRequest,
type PrepareUserOperationReturnType,
Expand Down Expand Up @@ -196,6 +198,28 @@ export const prepareUserOperationForErc20Paymaster =
"prepareUserOperation"
)({
...parameters,
paymaster: {
getPaymasterData: (
args: GetPaymasterDataParameters
): Promise<GetPaymasterDataReturnType> => {
const paymaster =
parameters.paymaster ?? bundlerClient?.paymaster

if (typeof paymaster === "object") {
const { getPaymasterStubData } = paymaster

if (getPaymasterStubData) {
return getPaymasterStubData(args)
}
}

return getAction(
bundlerClient,
getPaymasterData_,
"getPaymasterData"
)(args)
}
},
calls: callsWithDummyApproval
} as unknown as PrepareUserOperationParameters)

Expand Down

0 comments on commit b8f1f98

Please sign in to comment.