Skip to content

Commit 468477b

Browse files
committed
fix: fix zero gas fee calculation
1 parent 05b4eb4 commit 468477b

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

packages/bridge-status-controller/src/bridge-status-controller.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,14 +1202,17 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
12021202
gas: tradeGasLimit.toString(),
12031203
}),
12041204
};
1205+
1206+
const gasFee = await this.#calculateGasFees(
1207+
transactionParams,
1208+
networkClientId,
1209+
hexChainId,
1210+
txFee,
1211+
);
1212+
12051213
const transactionParamsWithMaxGas: TransactionParams = {
12061214
...transactionParams,
1207-
...(await this.#calculateGasFees(
1208-
transactionParams,
1209-
networkClientId,
1210-
hexChainId,
1211-
txFee,
1212-
)),
1215+
...gasFee,
12131216
};
12141217

12151218
const { result } = await this.#addTransactionFn(
@@ -1239,17 +1242,11 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
12391242
): Promise<{
12401243
maxFeePerGas: Hex;
12411244
maxPriorityFeePerGas: Hex;
1242-
gas: Hex;
12431245
}> => {
1244-
const maxGasLimit = toHex(transactionParams.gas ?? 0);
1245-
1246-
// If txFee is provided (gasIncluded case), use the quote's gas fees
1247-
// Convert to hex since txFee values from the quote are decimal strings
12481246
if (txFee) {
12491247
return {
12501248
maxFeePerGas: toHex(txFee.maxFeePerGas ?? 0),
12511249
maxPriorityFeePerGas: toHex(txFee.maxPriorityFeePerGas ?? 0),
1252-
gas: maxGasLimit,
12531250
};
12541251
}
12551252

@@ -1261,16 +1258,13 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
12611258
chainId,
12621259
networkClientId,
12631260
});
1261+
12641262
const { maxFeePerGas, maxPriorityFeePerGas } = getTxGasEstimates({
12651263
networkGasFeeEstimates: gasFeeEstimates,
12661264
txGasFeeEstimates,
12671265
});
12681266

1269-
return {
1270-
maxFeePerGas,
1271-
maxPriorityFeePerGas,
1272-
gas: maxGasLimit,
1273-
};
1267+
return { maxFeePerGas, maxPriorityFeePerGas };
12741268
};
12751269

12761270
/**

0 commit comments

Comments
 (0)