const e=require(`../../constants/chains.constants.cjs`),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../error-handling/error-codes.constants.cjs`),r=require(`./etherFunctions.cjs`),i=require(`../../API/callOdosAPI.cjs`);require(`../../error-handling/index.cjs`),require(`../../constants/index.cjs`);var a=async(a,o,s,c,l=.7)=>{try{let{odosResponse:n,status:u}=await i.callOdosAPI(a,{chainId:a===31337?e.localhostNetwork:a,inputTokens:[{tokenAddress:o?.wrappedErc20TokenAddress??o.erc20TokenAddress,amount:r.getAmountInWei(o,c).toString()}],outputTokens:[{tokenAddress:s?.wrappedErc20TokenAddress??s.erc20TokenAddress,proportion:1}],userAddr:e.networkRegistry[a].contractData.odosExternalActionInstanceAddress||t.zeroAddress,slippageLimitPercent:l,disableRFQs:!0});if(u!==`success`)throw Error(`Odos API Fetch Error`);return{outSwapAmountValue:BigInt(n.outputTokens[0].amount),odosDataValue:n.transaction.data}}catch(e){throw console.log({error:e}),Error(n.transactionErrorCodes.NO_ODOS_PRICE)}};exports.getOdosPrice=a;