import { defaultFeeToken as e } from "../../constants/fees.constants.mjs";
import { getERC20Token as t } from "../utils/erc20tokenFunctions.mjs";
import { caseInsensitiveEqual as n } from "../utils/caseInsensitive.utils.mjs";
import { Logger as r } from "../../error-handling/logger.mjs";
import { processGasEstimates as i } from "./process-gas-estimates.mjs";
//#region libs/shared/common/src/functions/pre-transaction/getFeeStructure.ts
var a = async (a, o, s, c, l = [], u = 0n, d) => {
	let f = t(o ?? e, a);
	if (!f) throw Error("failed to find feeToken");
	let { priceOfTransactionInToken: p } = await i(a, f, c, s.some((e) => n(e, o)) ? s.length + 1 : s.length, void 0, l, d);
	if (p === void 0) throw Error("failed to process gas estimates");
	let m = {
		feeToken: f.erc20TokenAddress,
		flatFee: p,
		variableRate: u
	};
	return r.log(m), m;
};
//#endregion
export { a as getFeeStructure };
