import "../../constants/protocol.constants.mjs";
import { ExternalActionId as e } from "../../types/external-action.types.mjs";
import { transactionErrorCodes as t } from "../../error-handling/error-codes.constants.mjs";
import { validateAndGetChainId as n } from "../../functions/utils/token-check.utils.mjs";
import { AccountActions as r } from "../AccountActions/AccountActions.mjs";
import { getFeeStructure as i } from "../../functions/pre-transaction/getFeeStructure.mjs";
import { SWAP_ROUTER_ADDRESSES as a } from "../../constants/addresses.constants.mjs";
import { convertEmporiumOpToCallInfo as o } from "../../functions/utils/convertEmporiumOpToCallInfo.mjs";
import { createSwapToEmporiumOps as s } from "../../functions/private-wallet/emporium.swap.helpers.mjs";
//#region libs/shared/common/src/data-structures/Hinkal/hinkalProxySwap.ts
var c = async (c, l, u, d, f, p, m, h, g, _ = !1, v, y) => {
	if (!h) throw Error("Fee token is required in hinkalProxySwap");
	let b = n(l), x = r.getAddressFromSubAccount(b, m);
	if (!x) throw Error("Public account address is not available");
	let S = l.map((e) => e.erc20TokenAddress), C = await c.getRandomRelay(b, !0);
	if (!C) throw Error(t.RELAYER_NOT_AVAILABLE);
	let w = await s(c, b, d, a[d][b], f, S[0], u[0], u[1], S[1], p, x, C, !0), T = g ?? await i(b, h, S, e.Emporium, w.map((e) => o(e, x, b)), 35n), E = l.map((e, t) => ({
		token: e,
		amount: u[t]
	}));
	return c.actionPrivateWallet(b, [], [], [], w, E, m, h, T, C, _, v, y, void 0);
};
//#endregion
export { c as hinkalProxySwap };
