import { transactionErrorCodes as e } from "../error-codes.constants.mjs";
import { getAmountInToken as t } from "../../functions/web3/etherFunctions.mjs";
import { fixDecimalsAmount as n } from "../../functions/utils/amounts.utils.mjs";
import { FeeOverTransactionValueError as r } from "./FeeOverTransactionValueError.mjs";
import { ErrorCategory as i } from "../types.mjs";
//#region libs/shared/common/src/error-handling/customErrors/customErrors.helpers.ts
var a = (e, r) => {
	let { totalFeeWEI: a, feeUnit: o } = e.data;
	if (!o) return e.message;
	let s = t(o, a), c = "transact", l = "an equivalent of ";
	return r === i.WITHDRAW && (c = "withdraw", l = ""), `Fees are over transaction value. Please ${c} at least ${l} ${n(Number(s))} of ${o?.symbol} (subject to real-time price)`;
}, o = (t, n) => {
	throw t instanceof r || t?.message === e.INSUFFICIENT_FUNDS_TO_TRANSACT ? t : Error(n);
};
//#endregion
export { a as getGenericFeeOverTransactionValueErrorMessage, o as rethrowKnownGasErrorIfPossible };
