"use strict";var e=require("react"),r=require("@privy-io/js-sdk-core"),i=require("./context-rs-ygOK2.js"),o=require("./internal-context-CdsQ3LEl.js"),t=require("./useGetSolPrice-BOxa4idj.js");let n=t=>{let{showFiatPrices:n,getUsdTokenPrice:c,chains:a}=o.usePrivyInternal(),[s,l]=e.useState(!0),[P,u]=e.useState(void 0),[d,k]=e.useState(void 0);return e.useEffect((()=>{t||=i.CHAIN_ID_MAINNET;let e=r.addToDefaultChains(a).find((e=>e.id===Number(t)));(async()=>{if(n){if(!e)return l(!1),void u(Error(`Unable to fetch token price on chain id ${t}`));try{l(!0);let r=await c(e);r?k(r):u(Error(`Unable to fetch token price on chain id ${e.id}`))}catch(e){u(e)}finally{l(!1)}}else l(!1)})()}),[t]),{tokenPrice:d,isTokenPriceLoading:s,tokenPriceError:P}};exports.useGetTokenPrice=function(e){let{tokenPrice:r,isTokenPriceLoading:i,tokenPriceError:o}=n("solana"===e?-1:e),{solPrice:c,isSolPriceLoading:a,solPriceError:s}=t.useGetSolPrice({enabled:"solana"===e});return"solana"===e?{tokenPrice:c,isTokenPriceLoading:a,tokenPriceError:s}:{tokenPrice:r,isTokenPriceLoading:i,tokenPriceError:o}};
//# sourceMappingURL=useGetTokenPrice-kLl5cylh.js.map
