import { getGasEstimates as e } from "../../API/getGasEstimates.mjs";
import { getAmountInWei as t } from "../web3/etherFunctions.mjs";
import { getValueFirstNDigit as n } from "../utils/amounts.utils.mjs";
import { logError as r } from "../../error-handling/logError.mjs";
//#region libs/shared/common/src/functions/pre-transaction/process-gas-estimates.ts
var i = async (i, a, o, s, c, l = [], u) => {
	let d, f;
	try {
		({priceOfTransactionInUSD: d, priceOfTransactionInToken: f} = await e(i, a.erc20TokenAddress, o, s, l.map(({ from: e, to: t, calldata: n, value: r }) => ({
			from: e,
			to: t,
			calldata: n,
			value: `${r}`
		})), c, u));
	} catch (e) {
		r("processGasEstimates error:", e);
	}
	let p = f ? t(a, n(f, a.decimals)) : void 0;
	return {
		priceOfTransactionInUSD: d,
		priceOfTransactionInToken: p
	};
};
//#endregion
export { i as processGasEstimates };
