Skip to content

Commit

Permalink
added flag to skip calldata approval patch (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises authored Mar 4, 2024
1 parent d2e8ee1 commit 75698c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/account/src/BiconomySmartAccountV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,12 @@ export class BiconomySmartAccountV2 extends BaseSmartContractAccount {
Logger.log("there is a feeQuote: ", feeQuote);
if (!spender) throw new Error(ERROR_MESSAGES.SPENDER_REQUIRED);
if (!feeQuote) throw new Error(ERROR_MESSAGES.FAILED_FEE_QUOTE_FETCH);
if (paymasterServiceData.skipPatchCallData && paymasterServiceData.skipPatchCallData === true) {
return this.getPaymasterAndData(userOp, {
...paymasterServiceData,
feeTokenAddress: feeQuote.tokenAddress,
});
}
const partialUserOp = await this.buildTokenPaymasterUserOp(userOp, {
...paymasterServiceData,
spender,
Expand Down
4 changes: 4 additions & 0 deletions packages/account/src/utils/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export type BiconomyTokenPaymasterRequest = {
spender: Hex;
/** maxApproval: If set to true, the paymaster will approve the maximum amount of tokens required for the transaction. Not recommended */
maxApproval?: boolean;
/* skip option to patch callData if approval is already given to the paymaster */
skipPatchCallData?: boolean;
};

export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &
Expand Down Expand Up @@ -218,6 +220,8 @@ export type PaymasterUserOperationDto = SponsorUserOperationDto &
spender?: Hex;
/** Not recommended */
maxApproval?: boolean;
/* skip option to patch callData if approval is already given to the paymaster */
skipPatchCallData?: boolean;
};

export type InitializeV2Data = {
Expand Down
2 changes: 2 additions & 0 deletions packages/paymaster/src/utils/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export type BiconomyTokenPaymasterRequest = {
spender: Hex;
/** Not recommended */
maxApproval?: boolean;
/* skip option to patch callData if approval is already given to the paymaster */
skipPatchCallData?: boolean;
};

export type FeeQuotesOrDataResponse = {
Expand Down

0 comments on commit 75698c8

Please sign in to comment.