From 82d49244d9daae4bafbded16bf0adcf5be380476 Mon Sep 17 00:00:00 2001 From: Phillip Ho Date: Mon, 9 Dec 2024 21:59:58 +0800 Subject: [PATCH] rename --- src/utils/math.ts | 2 +- src/worker/tasks/sendTransactionWorker.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/math.ts b/src/utils/math.ts index e2eafb93..5ec56723 100644 --- a/src/utils/math.ts +++ b/src/utils/math.ts @@ -8,7 +8,7 @@ export const getPercentile = (arr: number[], percentile: number): number => { return arr[index]; }; -export const bigMath = { +export const BigIntMath = { min: (a: bigint, b: bigint) => (a < b ? a : b), max: (a: bigint, b: bigint) => (a > b ? a : b), }; diff --git a/src/worker/tasks/sendTransactionWorker.ts b/src/worker/tasks/sendTransactionWorker.ts index 62211223..9dff3c4b 100644 --- a/src/worker/tasks/sendTransactionWorker.ts +++ b/src/worker/tasks/sendTransactionWorker.ts @@ -39,7 +39,7 @@ import { isReplacementGasFeeTooLow, wrapError, } from "../../utils/error"; -import { bigMath } from "../../utils/math"; +import { BigIntMath } from "../../utils/math"; import { getChecksumAddress } from "../../utils/primitiveTypes"; import { recordMetrics } from "../../utils/prometheus"; import { redis } from "../../utils/redis/redis"; @@ -575,7 +575,7 @@ export function _updateGasFees( return populatedTransaction; } - const multiplier = bigMath.min(10n, BigInt(resendCount) * 2n); + const multiplier = BigIntMath.min(10n, BigInt(resendCount) * 2n); const updated = { ...populatedTransaction }; // Update gas fees (unless they were explicitly overridden). @@ -584,7 +584,7 @@ export function _updateGasFees( if (updated.gasPrice && !overrides?.gasPrice) { const newGasPrice = updated.gasPrice * multiplier; - updated.gasPrice = bigMath.min(newGasPrice, MAX_GAS_PRICE_WEI); + updated.gasPrice = BigIntMath.min(newGasPrice, MAX_GAS_PRICE_WEI); } if (updated.maxPriorityFeePerGas && !overrides?.maxPriorityFeePerGas) { updated.maxPriorityFeePerGas *= multiplier; @@ -592,7 +592,7 @@ export function _updateGasFees( if (updated.maxFeePerGas && !overrides?.maxFeePerGas) { const newMaxFeePerGas = updated.maxFeePerGas * 2n + (updated.maxPriorityFeePerGas ?? 0n); - updated.maxFeePerGas = bigMath.min(newMaxFeePerGas, MAX_GAS_PRICE_WEI); + updated.maxFeePerGas = BigIntMath.min(newMaxFeePerGas, MAX_GAS_PRICE_WEI); } return updated;