diff --git a/paymaster/src/rpcMethods.ts b/paymaster/src/rpcMethods.ts index e981580..313daac 100644 --- a/paymaster/src/rpcMethods.ts +++ b/paymaster/src/rpcMethods.ts @@ -5,21 +5,19 @@ import { whitelistAll, whitelistedAddresses } from './config'; import dotenv from 'dotenv'; dotenv.config(); -export interface UserOperation { +export interface PackedUserOperation { sender: string nonce: BigNumberish initCode: BytesLike callData: BytesLike - callGasLimit: BigNumberish - verificationGasLimit: BigNumberish + accountGasLimits: BytesLike preVerificationGas: BigNumberish - maxFeePerGas: BigNumberish - maxPriorityFeePerGas: BigNumberish + gasFees: BytesLike paymasterAndData: BytesLike signature: BytesLike } -export async function sponsorTransaction(userOp: UserOperation): Promise { +export async function sponsorTransaction(userOp: PackedUserOperation): Promise { const paymasterAddress = process.env.PAYMASTER_ADDRESS as string; const provider = new ethers.JsonRpcProvider(process.env.RPC_URL as string); const signer = new ethers.Wallet(process.env.PRIVATE_KEY as string); diff --git a/paymaster/src/server.ts b/paymaster/src/server.ts index 835f555..33561b8 100644 --- a/paymaster/src/server.ts +++ b/paymaster/src/server.ts @@ -1,12 +1,12 @@ import express, { Express, Request, Response } from 'express'; import bodyParser from 'body-parser'; import cors from 'cors'; -import { sponsorTransaction, UserOperation } from './rpcMethods'; +import { sponsorTransaction, PackedUserOperation } from './rpcMethods'; type JsonRpcRequestBody = { id: number; method: string; - params: UserOperation; + params: PackedUserOperation; }; const app: Express = express(); diff --git a/paymaster/test/tests.ts b/paymaster/test/tests.ts index 97b68ac..a51a597 100644 --- a/paymaster/test/tests.ts +++ b/paymaster/test/tests.ts @@ -1,7 +1,7 @@ import { ethers } from 'ethers'; import dotenv from 'dotenv'; import axios from 'axios'; -import { UserOperation } from '../src/rpcMethods'; +import { PackedUserOperation } from '../src/rpcMethods'; import { simpleAccountAbi, simpleAccountFactoryAbi, paymasterAbi, entrypointAbi } from '../src/abis'; dotenv.config(); @@ -42,16 +42,20 @@ async function main() { const callData = simpleAccount.interface.encodeFunctionData("execute", [to, value, data]); // Construct UserOp - let userOp: UserOperation = { + let userOp: PackedUserOperation = { sender: simpleAccountAddress, nonce: Number(await paymaster.senderNonce(simpleAccountAddress)), initCode: initCode, callData: callData, - callGasLimit: ethers.toBeHex(3_000_000), // hardcode it for now at a high value, - verificationGasLimit: ethers.toBeHex(3_000_000), // hardcode it for now at a high value, + accountGasLimits: ethers.concat([ + ethers.toBeHex(3_000_000), // callGasLimit: hardcode it for now at a high value, + ethers.toBeHex(3_000_000) // verificationGasLimit: hardcode it for now at a high value, + ]), preVerificationGas: ethers.toBeHex(2_000_000), // hardcode it for now at a high value, - maxFeePerGas: ethers.toBeHex(2e9), - maxPriorityFeePerGas: ethers.toBeHex(1e9), + gasFees: ethers.concat([ + ethers.toBeHex(2e9), // maxFeePerGas + ethers.toBeHex(1e9) // maxPriorityFeePerGas + ]), paymasterAndData: ethers.concat([ paymasterAddress, '0x' + '00'.repeat(64),