var w=Object.create;var s=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},l=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!v.call(t,r)&&r!==o&&s(t,r,{get:()=>e[r],enumerable:!(c=I(e,r))||c.enumerable});return t};var C=(t,e,o)=>(o=t!=null?w(g(t)):{},l(e||!t||!t.__esModule?s(o,"default",{value:t,enumerable:!0}):o,t)),$=t=>l(s({},"__esModule",{value:!0}),t);var K={};A(K,{default:()=>k});module.exports=$(K);var a=require("react");var i=require("react"),E=require("react/jsx-runtime"),M=(0,i.createContext)(void 0),p="production";var h=p==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var m=C(require("axios"),1),u=async(t,e)=>{try{return(await m.default.get(`${h}/collection/${e}`,{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}};var b=(t,e)=>{let[o,c]=(0,a.useState)({}),[r,y]=(0,a.useState)(null),[f,d]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{async function x(){try{d(!0);let n=await u(e,t);c({collectionId:t,contractAddress:n?.contract?.contractAddress,chainId:n?.contract?.chainId,mintPrice:n.stats.price.value,mintPriceUnit:n.stats.price.unit,mintFunction:n.contract.mintFunction,abi:n.contract.abi,profile:n.profile,contract:n?.contract,stats:n?.stats,...n}),y(n?.contract?.candyMachineId)}catch{console.log(`Failed to fetch collection details from collection ID: ${t}`)}finally{d(!1)}}t&&x()},[t,e]),{collectionState:o,isLoading:f,candyMachineId:r}},k=b;
