var f=Object.create;var s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var K=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},u=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of S(r))!I.call(t,n)&&n!==e&&s(t,n,{get:()=>r[n],enumerable:!(o=v(r,n))||o.enumerable});return t};var Y=(t,r,e)=>(e=t!=null?f(k(t)):{},u(r||!t||!t.__esModule?s(e,"default",{value:t,enumerable:!0}):e,t)),X=t=>u(s({},"__esModule",{value:!0}),t);var q={};K(q,{default:()=>_});module.exports=X(q);var c=require("@solana/wallet-adapter-react"),D=require("@solana/web3.js"),P=require("react");var d=Y(require("axios"),1);var p=require("react"),B=require("react/jsx-runtime"),R=(0,p.createContext)(void 0),y="production";var m=y==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var g=async(t,r,e,o,n,i)=>{try{return(await d.default.post(`${m}/collection/sns/registerDomain`,{name:r,claimWallet:e,price:o,payUsing:n,space:i},{headers:{"X-API-KEY":t}})).data}catch(a){throw new Error(a)}},x=async(t,r,e)=>{try{return(await d.default.post(`${m}/collection/sns/claimDomain`,{name:r,transactionHash:e},{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}};var C=()=>{let t=(0,c.useWallet)(),{connection:r}=(0,c.useConnection)();return{registerSns:(0,P.useCallback)(async(o,n,i,a,E,$)=>{if(!(!t.connected||!t.publicKey||!r))try{let l=n,b=await g(o,a.name,E,l.toString(),i.value,$*1e3),A=await r.getLatestBlockhash(),h=D.Transaction.from(Buffer.from(b));h.recentBlockhash=A.blockhash;let w=await t.sendTransaction(h,r);console.log(w),await x(o,a.name,w)}catch(l){throw l}},[t,r])}},_=C;
