var y=Object.create;var w=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var o in t)w(e,o,{get:t[o],enumerable:!0})},x=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of v(t))!E.call(e,a)&&a!==o&&w(e,a,{get:()=>t[a],enumerable:!(n=P(t,a))||n.enumerable});return e};var b=(e,t,o)=>(o=e!=null?y(I(e)):{},x(t||!e||!e.__esModule?w(o,"default",{value:e,enumerable:!0}):o,e)),A=e=>x(w({},"__esModule",{value:!0}),e);var s=(e,t,o)=>new Promise((n,a)=>{var h=r=>{try{p(o.next(r))}catch(l){a(l)}},d=r=>{try{p(o.throw(r))}catch(l){a(l)}},p=r=>r.done?n(r.value):Promise.resolve(r.value).then(h,d);p((o=o.apply(e,t)).next())});var N={};$(N,{disconnectDiscord:()=>X,disconnectTwitter:()=>Y,getDiscordOAuthUrl:()=>C,getNonce:()=>_,getTwitterOAuthUrl:()=>K,getUser:()=>k,sendEmailCodeVerification:()=>D,subscribe:()=>g});module.exports=A(N);var i=b(require("axios"),1);var u=require("react"),f=require("react/jsx-runtime"),T=(0,u.createContext)(void 0),m="production";var c=m==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var g=(e,t)=>s(void 0,null,function*(){try{return(yield i.default.post(`${c}/subscription`,{email:e},{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}}),k=(e,t)=>s(void 0,null,function*(){try{return(yield i.default.get(`${c}/users/${e}`,{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}}),K=(e,t,o,n,a,h,d,p)=>s(void 0,null,function*(){try{let r=yield i.default.post(`${c}/users/${t}/twitter/get-auth-url`,{signature:e,walletAddress:t,intentModuleId:n,intentCollectionId:parseInt(a),intentModuleTask:h,from:p?"MOBILE":"DESKTOP",chainId:d},{headers:{"X-API-KEY":o}});return p?window.location.href=r.data:window.open(r.data,"_blank","height=600,width=600"),null}catch(r){throw console.log(r),r}}),C=(e,t,o)=>s(void 0,null,function*(){try{let n=yield i.default.post(`${c}/users/${t}/discord/getAuthUrl`,{signature:e,walletAddress:t},{headers:{"X-API-KEY":o}});return window.open(n.data,"_blank","height=600,width=600"),null}catch(n){throw console.log(n),n}}),Y=(e,t,o)=>s(void 0,null,function*(){try{return(yield i.default.post(`${c}/users/${t}/twitter/disconnect`,{signature:e,walletAddress:t},{headers:{"X-API-KEY":o}})).data}catch(n){throw console.log(n),n}}),X=(e,t,o)=>s(void 0,null,function*(){try{return(yield i.default.post(`${c}/users/${t}/discord/disconnect`,{signature:e,walletAddress:t},{headers:{"X-API-KEY":o}})).data}catch(n){throw console.log(n),n}}),D=(e,t,o,n,a,h)=>s(void 0,null,function*(){try{return(yield i.default.post(`${c}/collection/contest/${a}/sendVerification`,{email:e,walletAddress:t,task:n,signature:h},{headers:{"X-API-KEY":o}})).data}catch(d){throw console.log(d),d}}),_=(e,t)=>s(void 0,null,function*(){try{return(yield i.default.post(`${c}/users/getNonce`,{walletAddress:e},{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}});0&&(module.exports={disconnectDiscord,disconnectTwitter,getDiscordOAuthUrl,getNonce,getTwitterOAuthUrl,getUser,sendEmailCodeVerification,subscribe});
