const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../API/callLifiAPI.cjs`),r=require(`../../error-handling/error-codes.constants.cjs`),i=require(`./etherFunctions.cjs`),a=require(`../../constants/lifi.constants.cjs`),o=require(`../utils/tron.utils.cjs`);var s=async(s,c,l,u,d,f)=>{try{let r=i.getAmountInWei(s,l),p=e.isTronLike(c.chainId),{lifiResponse:m}=await n.callLifiAPI({fromChain:a.getLifiChainId(s.chainId),toChain:a.getLifiChainId(c.chainId),fromToken:s.erc20TokenAddress,toToken:p?o.toTronBase58IfHex(c.erc20TokenAddress):c.erc20TokenAddress,fromAddress:d,fromAmount:r.toString(),order:`FASTEST`,slippage:u,...f&&{toAddress:p?o.toTronBase58IfHex(f):f}});if(e.isSolanaLike(s.chainId))return{lifiDataValue:m.transactionRequest.data,outSwapAmountValue:BigInt(m.estimate.toAmount),extraNativeTokenFee:0n};let h=BigInt(m.transactionRequest.value||`0`);return{lifiDataValue:m.transactionRequest.data,outSwapAmountValue:BigInt(m.estimate.toAmount),extraNativeTokenFee:s.erc20TokenAddress===t.zeroAddress?h-r:h}}catch{throw Error(r.transactionErrorCodes.NO_LIFI_PRICE)}};exports.getLifiPrice=s;