Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/paymaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions backend/src/routes/paymaster-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = 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;
Expand Down Expand Up @@ -590,13 +593,13 @@ const paymasterRoutes: FastifyPluginAsync<PaymasterRoutesOpts> = 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;
}
}
Expand Down
4 changes: 3 additions & 1 deletion backend/src/types/whitelist-dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { EPVersions } from "./sponsorship-policy-dto";

export interface WhitelistDto {
apiKey: string;
addresses: string[];
policyId?: number;
epVersion?: string;
epVersion?: EPVersions;
}