The user operation to calculate prefund for
Gas limit for account verification
Gas limit for the main execution call
Gas for pre-verification operations
Optional gas limit for paymaster verification
Optional gas limit for paymaster post-operation execution
Maximum total fee per gas unit
The required prefund amount in wei as a bigint
// Without paymaster
const prefund = getRequiredPrefundV7({
verificationGasLimit: 50000n,
callGasLimit: 100000n,
preVerificationGas: 21000n,
maxFeePerGas: 1000000000n
});
// With paymaster
const prefundWithPaymaster = getRequiredPrefundV7({
verificationGasLimit: 50000n,
callGasLimit: 100000n,
preVerificationGas: 21000n,
paymasterVerificationGasLimit: 40000n,
paymasterPostOpGasLimit: 20000n,
maxFeePerGas: 1000000000n
});
Calculates the required prefund amount for a user operation based on its gas parameters. The prefund amount is used to ensure the account has sufficient funds to cover the operation's gas costs. For v0.7.0, this includes separate verification gas limits for both the account and paymaster.