Skip to content

Commit d21aa76

Browse files
Fix error when rpc returns zero for eth_estimateGas (#676)
1 parent 7c95a09 commit d21aa76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/modules/ethereum/transactions/gasPrices/assignGasPrice.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ export function assignGasPrice<
2222
transaction: T,
2323
gasPrice: GasPriceObject
2424
): T & (ClassicGasPriceProps | EIP1559Props) {
25+
// Prefer non-zero number for "classic", but prefer zero over nullish:
2526
const classicGasPrices =
26-
gasPrice.classic || gasPrice.optimistic?.underlying.classic;
27+
gasPrice.classic ||
28+
gasPrice.optimistic?.underlying.classic ||
29+
(gasPrice.classic ?? gasPrice.optimistic?.underlying.classic);
30+
2731
const eip1559GasPrices =
2832
gasPrice.eip1559 || gasPrice.optimistic?.underlying.eip1559;
2933
if (eip1559GasPrices) {

0 commit comments

Comments
 (0)