Skip to content

UserOperationFeeOptionsField

Merged type of BigNumberishRange with Multiplier type that can be used as UserOperationFeeOptions fields for the SmartAccountClient to use during the gas fee calculation middlewares when constructing the user operation to send.

For example, if the below example UserOperationFeeOptionsField is set as the fee option for the maxPriorityFeePerGas field of UserOperationFeeOptions, then the SmartAccountClient will apply 50% buffer to the estimated maxPriorityFeePerGas, then set the maxPriorityFeePerGas on the user operation as the larger value between the buffered maxPriorityFeePerGas fee and the min maxPriorityFeePerGas which is 100_000_000n here.

/*
 * {
 *   min?: BigNumberish
 *   max?: BigNumberish
 *   multiplier?: number
 * }
 */
type UserOperationFeeOptionsFieldSchema = BigNumberishRange & Multiplier;

Usage

import { type UserOperationFeeOptionsField } from "@alchemy/aa-core";
 
const userOperationFeeOptionsField: UserOperationFeeOptionsField = {
  min: 100_000_000n,
  multiplier: 1.5,
};