From 081698a835868711260decc44a0a25f1b12b9393 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Thu, 24 Apr 2025 14:50:19 +0530 Subject: [PATCH 1/2] changed Bignumber to hex string as per current change in skandha --- backend/src/paymaster/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/paymaster/index.ts b/backend/src/paymaster/index.ts index 72b2e2f..f1fa9ac 100644 --- a/backend/src/paymaster/index.ts +++ b/backend/src/paymaster/index.ts @@ -125,7 +125,7 @@ export class Paymaster { const paymasterPostOpGasLimit = BigNumber.from("40000").toHexString(); if (estimate) { userOp.paymaster = paymasterAddress; - userOp.paymasterVerificationGasLimit = this.EP7_PVGL; + userOp.paymasterVerificationGasLimit = this.EP7_PVGL.toHexString(); userOp.paymasterPostOpGasLimit = paymasterPostOpGasLimit; const accountGasLimits = this.packUint(userOp.verificationGasLimit, userOp.callGasLimit) const gasFees = this.packUint(userOp.maxPriorityFeePerGas, userOp.maxFeePerGas); @@ -199,7 +199,7 @@ export class Paymaster { const paymasterPostOpGasLimit = BigNumber.from("40000").toHexString(); if (estimate) { userOp.paymaster = paymasterAddress; - userOp.paymasterVerificationGasLimit = this.EP8_PVGL; + userOp.paymasterVerificationGasLimit = this.EP8_PVGL.toHexString(); userOp.paymasterPostOpGasLimit = paymasterPostOpGasLimit; const accountGasLimits = this.packUint(userOp.verificationGasLimit, userOp.callGasLimit) const gasFees = this.packUint(userOp.maxPriorityFeePerGas, userOp.maxFeePerGas); From 4749f06d1c98408f07a89cdad9d8b5bc9d6a1df6 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Thu, 24 Apr 2025 15:39:23 +0530 Subject: [PATCH 2/2] type corrections --- backend/src/routes/paymaster-routes.ts | 11 +++++++---- backend/src/types/whitelist-dto.ts | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/src/routes/paymaster-routes.ts b/backend/src/routes/paymaster-routes.ts index 8e5d989..7c295af 100644 --- a/backend/src/routes/paymaster-routes.ts +++ b/backend/src/routes/paymaster-routes.ts @@ -267,6 +267,9 @@ const paymasterRoutes: FastifyPluginAsync = async (server, } result = await paymaster.signV07(userOp, str, str1, entryPoint, networkConfig.contracts.etherspotPaymasterAddress, bundlerUrl, signer, estimate, server.log); } else { + if (!networkConfig.contracts.etherspotPaymasterAddress) { + throw new Error('Please use useVP flag to use your deployed verifying paymaster as global paymaster is not defined'); + } result = await paymaster.signV08(userOp, str, str1, entryPoint, networkConfig.contracts.etherspotPaymasterAddress, bundlerUrl, signer, estimate, server.log); } break; @@ -590,13 +593,13 @@ const paymasterRoutes: FastifyPluginAsync = async (server, async function checkWhitelist(api_key: string, epVersion: EPVersions, senderAddress: string, policyId: number) { const globalWhitelistRecord = await server.whitelistRepository.findOneByApiKeyAndPolicyId(api_key); - if (!globalWhitelistRecord?.addresses.includes(senderAddress)) { + if (!globalWhitelistRecord?.addresses?.includes(senderAddress)) { const existingWhitelistRecord = await server.whitelistRepository.findOneByApiKeyAndPolicyId(api_key, policyId); - if (!existingWhitelistRecord?.addresses.includes(senderAddress)) { + if (!existingWhitelistRecord?.addresses?.includes(senderAddress)) { const existingEpWhitelistRecord = await server.whitelistRepository.findOneByApiKeyEPVersionAndPolicyId(api_key, epVersion, policyId); - if (!existingEpWhitelistRecord?.addresses.includes(senderAddress)) { + if (!existingEpWhitelistRecord?.addresses?.includes(senderAddress)) { const existingEpWhitelistRecord2 = await server.whitelistRepository.findOneByApiKeyEPVersionAndPolicyId(api_key, epVersion); - if (!existingEpWhitelistRecord2?.addresses.includes(senderAddress)) { + if (!existingEpWhitelistRecord2?.addresses?.includes(senderAddress)) { return false; } } diff --git a/backend/src/types/whitelist-dto.ts b/backend/src/types/whitelist-dto.ts index aa9d29f..19a038d 100644 --- a/backend/src/types/whitelist-dto.ts +++ b/backend/src/types/whitelist-dto.ts @@ -1,6 +1,8 @@ +import { EPVersions } from "./sponsorship-policy-dto"; + export interface WhitelistDto { apiKey: string; addresses: string[]; policyId?: number; - epVersion?: string; + epVersion?: EPVersions; } \ No newline at end of file