import { getValueFirstNDigit as e } from "../utils/amounts.utils.mjs";
import { getAmountInWei as t } from "../web3/etherFunctions.mjs";
import { logError as n } from "../../error-handling/logError.mjs";
import { getGasEstimates as r } from "../../API/getGasEstimates.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 r(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) {
		n("processGasEstimates error:", e);
	}
	let p = f ? t(a, e(f, a.decimals)) : void 0;
	return {
		priceOfTransactionInUSD: d,
		priceOfTransactionInToken: p
	};
};
//#endregion
export { i as processGasEstimates };
