import{o as e}from"./rolldown-runtime.js";import{n as t}from"./jsx-runtime.js";import{Vt as n}from"./useActiveWallet-CEs8euQ3.js";import{V as r}from"./context-Cdw68BC2.js";import{t as i}from"./useGetSolPrice-x7gfUIHJ.js";var a=e(t(),1);function o(e){let{tokenPrice:t,isTokenPriceLoading:o,tokenPriceError:s}=(e=>{let{showFiatPrices:t,getUsdTokenPrice:i,chains:o}=n(),[s,c]=(0,a.useState)(!0),[l,u]=(0,a.useState)(void 0),[d,f]=(0,a.useState)(void 0);return(0,a.useEffect)((()=>{e||=1;let n=r(o).find((t=>t.id===Number(e)));(async()=>{if(t){if(!n)return c(!1),void u(Error(`Unable to fetch token price on chain id ${e}`));try{c(!0);let e=await i(n);e?f(e):u(Error(`Unable to fetch token price on chain id ${n.id}`))}catch(e){u(e)}finally{c(!1)}}else c(!1)})()}),[e]),{tokenPrice:d,isTokenPriceLoading:s,tokenPriceError:l}})(e===`solana`?-1:e),{solPrice:c,isSolPriceLoading:l,solPriceError:u}=i({enabled:e===`solana`});return e===`solana`?{tokenPrice:c,isTokenPriceLoading:l,tokenPriceError:u}:{tokenPrice:t,isTokenPriceLoading:o,tokenPriceError:s}}export{o as t};