Skip to content

Commit

Permalink
Don't send 0n as gas param
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Dec 8, 2024
1 parent 0dcd56b commit b1f51cd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/lib/rpc-actions/aggressivelyWriteContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ export async function aggressivelyWriteContract<
msg: 'Got gas params',
data: { chain, address: args.address, gasParams },
});
if (gasParams.maxFeePerGas === 0n) {
gasParams.maxFeePerGas = 1n;
}
if (gasParams.maxPriorityFeePerGas === 0n) {
if (gasParams.maxFeePerGas) {
gasParams.maxPriorityFeePerGas = gasParams.maxFeePerGas;
} else {
gasParams.maxPriorityFeePerGas = 1n;
}
}
if (gasParams.gasPrice === 0n) {
gasParams.gasPrice = 1n;
}

const allPendingTransactions: Hex[] = [];

Expand Down Expand Up @@ -218,19 +231,19 @@ export async function aggressivelyWriteContract<
const previousGasParams = cloneDeep(gasParams);
if (gasParams.gasPrice) {
gasParams.gasPrice = bigintMultiplyFloat(
gasParams.gasPrice,
gasParams.gasPrice || 1n,
rpcConfig.transaction.retryGasMultiplier.gasPrice
);
}
if (gasParams.maxPriorityFeePerGas) {
gasParams.maxPriorityFeePerGas = bigintMultiplyFloat(
gasParams.maxPriorityFeePerGas,
gasParams.maxPriorityFeePerGas || 1n,
rpcConfig.transaction.retryGasMultiplier.maxPriorityFeePerGas
);
}
if (gasParams.maxFeePerGas) {
gasParams.maxFeePerGas = bigintMultiplyFloat(
gasParams.maxFeePerGas,
gasParams.maxFeePerGas || 1n,
rpcConfig.transaction.retryGasMultiplier.maxFeePerGas
);
}
Expand Down

0 comments on commit b1f51cd

Please sign in to comment.