const e=require(`../error-codes.constants.cjs`),t=require(`../../functions/web3/etherFunctions.cjs`),n=require(`../../functions/utils/amounts.utils.cjs`),r=require(`./FeeOverTransactionValueError.cjs`),i=require(`../types.cjs`);var a=(e,r)=>{let{totalFeeWEI:a,feeUnit:o}=e.data;if(!o)return e.message;let s=t.getAmountInToken(o,a),c=`transact`,l=`an equivalent of `;return r===i.ErrorCategory.WITHDRAW&&(c=`withdraw`,l=``),`Fees are over transaction value. Please ${c} at least ${l} ${n.fixDecimalsAmount(Number(s))} of ${o?.symbol} (subject to real-time price)`},o=(t,n)=>{throw t instanceof r.FeeOverTransactionValueError||t?.message===e.transactionErrorCodes.INSUFFICIENT_FUNDS_TO_TRANSACT?t:Error(n)};exports.getGenericFeeOverTransactionValueErrorMessage=a,exports.rethrowKnownGasErrorIfPossible=o;