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
2 changes: 2 additions & 0 deletions src/modules/chains/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const chainConfigSchemaBase = z.object({
gasCacheDuration: z.number().default(30000), // TODO: Add schema
feeHistoryBlockTagOverride: z.string().optional(),
eip1559: z.boolean().default(false),
/** Optional minimum maxFeePerGas (wei) for legacy chains; RPC may reject below this (e.g. BSC). */
minMaxFeePerGas: bigIntLikeSchema.optional(),
paymasterFunding: etherSchema.default("0.025"),
paymasterFundingThreshold: etherSchema.default("0"),
paymasterInitCode: hexSchema.optional(),
Expand Down
13 changes: 10 additions & 3 deletions src/modules/gas-estimator/gas-estimator-v2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ export class GasEstimatorServiceV2 {
},
)();

// Chain config may set a minimum (e.g. BSC); apply floor so RPC does not reject
const minGas = chainSettings.minMaxFeePerGas
? BigInt(chainSettings.minMaxFeePerGas)
: 0n;
const effectiveGasPrice =
minGas > 0n && gasPrice < minGas ? minGas : gasPrice;

conditions = {
maxFeePerGas: gasPrice,
maxPriorityFeePerGas: gasPrice,
maxFeePerGas: effectiveGasPrice,
maxPriorityFeePerGas: effectiveGasPrice,
l1GasPrice: 0n,
baseFee: gasPrice,
baseFee: effectiveGasPrice,
};
} else {
// EIP-1559 chain - use fee history for prediction
Expand Down
Loading