Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix paymaster override for multisig plugin #676

Merged
merged 9 commits into from
Jun 4, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ export async function _runMiddlewareStack<
return {
...uo,
...("paymasterAndData" in overrides!
? { paymasterAndData: "0x" }
? { paymasterAndData: overrides.paymasterAndData }
: "paymasterData" in overrides! &&
"paymaster" in overrides &&
overrides.paymasterData !== "0x"
? {
paymasterData: overrides.paymasterData,
paymaster: overrides.paymaster,
}
: // At this point, nothing has run so no fields are set
// for 0.7 when not using a paymaster, all fields should be undefined
undefined),
moldy530 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ export type UserOperationPaymasterOverrides<
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
> = TEntryPointVersion extends "0.6.0"
? {
// paymasterAndData overrides only allows '0x' for bypassing paymaster middleware
paymasterAndData: EmptyHex;
// paymasterAndData overrides allow either '0x' or the data to overwrite for bypassing paymaster middleware
paymasterAndData: Hex;
}
: TEntryPointVersion extends "0.7.0"
? {
// paymasterData overrides only allows '0x' for bypassing the paymaster middleware
// paymasterData overrides allow either '0x' or the data to overwrite for bypassing paymaster middleware
// if set to '0x', all paymaster related fields are omitted from the user op request
paymasterData: EmptyHex;
paymasterData: Hex;
moldy530 marked this conversation as resolved.
Show resolved Hide resolved
paymasterVerificationGasLimit:
| NoUndefined<
UserOperationStruct<"0.7.0">["paymasterVerificationGasLimit"]
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/utils/userop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ export const bypassPaymasterAndData = <
overrides: UserOperationOverrides<TEntryPointVersion> | undefined
): boolean =>
!!overrides &&
(("paymasterAndData" in overrides && overrides.paymasterAndData === "0x") ||
("paymasterData" in overrides && overrides.paymasterData === "0x"));
("paymasterAndData" in overrides || "paymasterData" in overrides);

/**
* Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string
Expand Down
Loading