@xoxno/sdk-js 0.0.3-alpha → 0.0.5-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xoxno.min.js +1 -1
- package/package.json +3 -3
- package/src/interactions/index.ts +4 -11
- package/src/launchpad/index.ts +3 -6
- package/src/types/{collection.d.ts → collection.ts} +4 -4
- package/src/types/{interactions.d.ts → interactions.ts} +1 -1
- package/src/types/{nft.d.ts → nft.ts} +1 -1
- package/src/types/{trading.d.ts → trading.ts} +3 -3
- package/src/utils/SmartContractService.ts +6 -13
- package/src/utils/api.ts +1 -1
- package/src/utils/scCalls.ts +5 -6
- package/tsconfig.json +1 -0
package/dist/xoxno.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.XOXNO=e():t.XOXNO=e()}(self,(()=>(()=>{"use strict";var t={d:(e,o)=>{for(var i in o)t.o(o,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:o[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XOXNO:()=>r});class o{static instance;apiUrl;apiKey;constructor(t,e){this.apiUrl=t,this.apiKey=e}static init(t,e){return o.instance||(o.instance=new o(t,e)),o.instance}static getClient(){if(!o.instance)throw new Error("APIClient has not been initialized");return o.instance}fetchWithTimeout=async(t,e={},o=4e4)=>{const i=new AbortController,{signal:n}=i,r=Math.round((new Date).getTime()/1e3),a=setTimeout((()=>{i.abort()}),o);let s;const c={"Accept-Encoding":"gzip,deflate,br","xo-time":`Sent-At:${r}`,Referer:"https://xoxno.dev","User-Agent":"XOXNO/1.0/SDK",..."POST"===e.method?{"Content-Type":"application/json"}:{},...e.headers??{}};try{if(s=await fetch(`${this.apiUrl}${t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,{signal:n,...e,...Object.keys(c).length?{headers:c}:{},method:e.method??"GET"}),!s.ok){const t=await(s?.text());throw new Error(t)}return clearTimeout(a),await s.json()}catch(o){throw new Error("Something went wrong inside fetchWithTimeout "+t+" "+JSON.stringify(e)+" "+o)}}}const i=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t);class n{api;constructor(){this.api=o.getClient()}getCollectionProfile=async t=>{if(!i(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/getCollectionProfile/${t}`)};getCollectionFloorPrice=async(t,e="EGLD")=>{if(!i(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/getFloorPrice/${t}/${e}`)};getCollectionAttributes=async t=>{if(!i(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/getCollectionAttributes/${t}`)};searchNFTs=async t=>{if(!i(t.collection))throw new Error("Invalid collection ticker: "+t.collection);if(t.top&&t.top>35)throw new Error("Top cannot be greater than 35");const e={filters:{onSale:t.onlyOnSale||!1,marketplace:t.listedOnlyOn||void 0,auctionTypes:t.onlyOnSale?t.onlyAuctions?["NftBid","SftAll"]:["Nft","SftOnePerPayment"]:void 0,tokens:t.listedInToken||void 0,attributes:t.attributes||void 0,range:t.priceRange?{...t.priceRange,type:t.onlyAuctions?"saleInfoNft/current_bid_short":"saleInfoNft/min_bid_short"}:void 0,rankRange:t.rankRange||void 0,levelRange:t.cantinaLevelRange||void 0},name:t.searchName||"",orderBy:t.orderBy||void 0,collection:t.collection,top:t.top||35,skip:t.skip||0},o=Buffer.from(JSON.stringify(e)).toString("base64"),n=await this.api.fetchWithTimeout(`/searchNFTs/${o}`);return{...n,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},hasMoreResults:n.resultsCount>(t.skip??0)+(t.top??35)}};getTradingActivity=async t=>await(async(t,e)=>{if(t.top&&t.top>35)throw new Error("Top cannot be greater than 35");const o={filters:{collection:t.collections,identifier:t.identifier||void 0,address:t.owners||void 0,tokens:t.placedInToken||void 0,marketplace:t.marketplaces||void 0,action:t.actions||void 0,range:t.priceRange,rankRange:t.rankRange,timestampRange:t.timestampRange,attributes:t.attributes},orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},i=Buffer.from(JSON.stringify(o)).toString("base64"),n=await e.fetchWithTimeout(`/getTradingActivity/${i}`);return{...n,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===n.resources.length}})(t,this.api)}class r{collection;constructor(t="https://proxy-api.xoxno.com",e=""){o.init(t,e),this.collection=new n}}return e})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.XOXNO=t():e.XOXNO=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e,t){return function(){return e.apply(t,arguments)}}e.r(t),e.d(t,{XOXNO:()=>We});const{toString:r}=Object.prototype,{getPrototypeOf:o}=Object,i=(s=Object.create(null),e=>{const t=r.call(e);return s[t]||(s[t]=t.slice(8,-1).toLowerCase())});var s;const a=e=>(e=e.toLowerCase(),t=>i(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined"),f=a("ArrayBuffer"),d=c("string"),p=c("function"),h=c("number"),m=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==i(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},y=a("Date"),b=a("File"),w=a("Blob"),q=a("FileList"),E=a("URLSearchParams");function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function S(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,v=e=>!u(e)&&e!==R,T=(A="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>A&&e instanceof A);var A;const N=a("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),x=a("RegExp"),j=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};O(n,((n,o)=>{!1!==t(n,o,e)&&(r[o]=n)})),Object.defineProperties(e,r)},P="abcdefghijklmnopqrstuvwxyz",k="0123456789",_={DIGIT:k,ALPHA:P,ALPHA_DIGIT:P+P.toUpperCase()+k},B={isArray:l,isArrayBuffer:f,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&p(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||r.call(e)===t||p(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f(e.buffer),t},isString:d,isNumber:h,isBoolean:e=>!0===e||!1===e,isObject:m,isPlainObject:g,isUndefined:u,isDate:y,isFile:b,isBlob:w,isRegExp:x,isFunction:p,isStream:e=>m(e)&&p(e.pipe),isURLSearchParams:E,isTypedArray:T,isFileList:q,forEach:O,merge:function e(){const{caseless:t}=v(this)&&this||{},n={},r=(r,o)=>{const i=t&&S(n,o)||o;g(n[i])&&g(r)?n[i]=e(n[i],r):g(r)?n[i]=e({},r):l(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],r);return n},extend:(e,t,r,{allOwnKeys:o}={})=>(O(t,((t,o)=>{r&&p(t)?e[o]=n(t,r):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let i,s,a;const c={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)a=i[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&o(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!h(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:N,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:j,freezeMethods:e=>{j(e,((t,n)=>{if(p(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];p(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:S,global:R,isContextDefined:v,ALPHABET:_,generateString:(e=16,t=_.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&p(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(m(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return O(e,((e,t)=>{const i=n(e,r+1);!u(i)&&(o[t]=i)})),t[r]=void 0,o}}return e};return n(e,0)}};function U(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}B.inherits(U,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const F=U.prototype,D={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{D[e]={value:e}})),Object.defineProperties(U,D),Object.defineProperty(F,"isAxiosError",{value:!0}),U.from=(e,t,n,r,o,i)=>{const s=Object.create(F);return B.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),U.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const L=U;function I(e){return B.isPlainObject(e)||B.isArray(e)}function M(e){return B.endsWith(e,"[]")?e.slice(0,-2):e}function z(e,t,n){return e?e.concat(t).map((function(e,t){return e=M(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const J=B.toFlatObject(B,{},null,(function(e){return/^is[A-Z]/.test(e)})),W=function(e,t,n){if(!B.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=B.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!B.isUndefined(t[e])}))).metaTokens,o=n.visitor||l,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(B.isDate(e))return e.toISOString();if(!a&&B.isBlob(e))throw new L("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(e)||B.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(B.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(B.isArray(e)&&function(e){return B.isArray(e)&&!e.some(I)}(e)||(B.isFileList(e)||B.endsWith(n,"[]"))&&(a=B.toArray(e)))return n=M(n),a.forEach((function(e,r){!B.isUndefined(e)&&null!==e&&t.append(!0===s?z([n],r,i):null===s?n:n+"[]",c(e))})),!1;return!!I(e)||(t.append(z(o,n,i),c(e)),!1)}const u=[],f=Object.assign(J,{defaultVisitor:l,convertValue:c,isVisitable:I});if(!B.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!B.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),B.forEach(n,(function(n,i){!0===(!(B.isUndefined(n)||null===n)&&o.call(t,n,B.isString(i)?i.trim():i,r,f))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t};function H(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function $(e,t){this._pairs=[],e&&W(e,this,t)}const K=$.prototype;K.append=function(e,t){this._pairs.push([e,t])},K.toString=function(e){const t=e?function(t){return e.call(this,t,H)}:H;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const V=$;function X(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function G(e,t,n){if(!t)return e;const r=n&&n.encode||X,o=n&&n.serialize;let i;if(i=o?o(t,n):B.isURLSearchParams(t)?t.toString():new V(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const Q=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){B.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]},ee=function(e){function t(e,n,r,o){let i=e[o++];const s=Number.isFinite(+i),a=o>=e.length;return i=!i&&B.isArray(r)?r.length:i,a?(B.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&B.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&B.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s)}if(B.isFormData(e)&&B.isFunction(e.entries)){const n={};return B.forEachEntry(e,((e,r)=>{t(function(e){return B.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null},te={"Content-Type":void 0},ne={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=B.isObject(e);if(o&&B.isHTMLForm(e)&&(e=new FormData(e)),B.isFormData(e))return r&&r?JSON.stringify(ee(e)):e;if(B.isArrayBuffer(e)||B.isBuffer(e)||B.isStream(e)||B.isFile(e)||B.isBlob(e))return e;if(B.isArrayBufferView(e))return e.buffer;if(B.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new Y.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Y.isNode&&B.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=B.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(B.isString(e))try{return(0,JSON.parse)(e),B.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ne.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&B.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw L.from(e,L.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Y.classes.FormData,Blob:Y.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};B.forEach(["delete","get","head"],(function(e){ne.headers[e]={}})),B.forEach(["post","put","patch"],(function(e){ne.headers[e]=B.merge(te)}));const re=ne,oe=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ie=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ae(e){return!1===e||null==e?e:B.isArray(e)?e.map(ae):String(e)}function ce(e,t,n,r,o){return B.isFunction(r)?r.call(this,t,n):(o&&(t=n),B.isString(t)?B.isString(r)?-1!==t.indexOf(r):B.isRegExp(r)?r.test(t):void 0:void 0)}class le{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=se(t);if(!o)throw new Error("header name must be a non-empty string");const i=B.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ae(e))}const i=(e,t)=>B.forEach(e,((e,n)=>o(e,n,t)));return B.isPlainObject(e)||e instanceof this.constructor?i(e,t):B.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&oe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&o(t,e,n),this}get(e,t){if(e=se(e)){const n=B.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(B.isFunction(t))return t.call(this,e,n);if(B.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const n=B.findKey(this,e);return!(!n||void 0===this[n]||t&&!ce(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=se(e)){const o=B.findKey(n,e);!o||t&&!ce(0,n[o],o,t)||(delete n[o],r=!0)}}return B.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ce(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return B.forEach(this,((r,o)=>{const i=B.findKey(n,o);if(i)return t[i]=ae(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();s!==o&&delete t[o],t[s]=ae(r),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return B.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&B.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[ie]=this[ie]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=se(e);t[r]||(function(e,t){const n=B.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return B.isArray(e)?e.forEach(r):r(e),this}}le.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.freezeMethods(le.prototype),B.freezeMethods(le);const ue=le;function fe(e,t){const n=this||re,r=t||n,o=ue.from(r.headers);let i=r.data;return B.forEach(e,(function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)})),o.normalize(),i}function de(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){L.call(this,null==e?"canceled":e,L.ERR_CANCELED,t,n),this.name="CanceledError"}B.inherits(pe,L,{__CANCEL__:!0});const he=pe,me=Y.isStandardBrowserEnv?{write:function(e,t,n,r,o,i){const s=[];s.push(e+"="+encodeURIComponent(t)),B.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),B.isString(r)&&s.push("path="+r),B.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function ge(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const ye=Y.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=B.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function be(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[s];o||(o=c),n[i]=a,r[i]=c;let u=s,f=0;for(;u!==i;)f+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const d=l&&c-l;return d?Math.round(1e3*f/d):void 0}}(50,250);return o=>{const i=o.loaded,s=o.lengthComputable?o.total:void 0,a=i-n,c=r(a);n=i;const l={loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:o};l[t?"download":"upload"]=!0,e(l)}}const we={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const o=ue.from(e.headers).normalize(),i=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}B.isFormData(r)&&(Y.isStandardBrowserEnv||Y.isStandardBrowserWebWorkerEnv)&&o.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+n))}const l=ge(e.baseURL,e.url);function u(){if(!c)return;const r=ue.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new L("Request failed with status code "+n.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),a()}),(function(e){n(e),a()}),{data:i&&"text"!==i&&"json"!==i?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),G(l,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=u:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=function(){c&&(n(new L("Request aborted",L.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new L("Network Error",L.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new L(t,r.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,e,c)),c=null},Y.isStandardBrowserEnv){const t=(e.withCredentials||ye(l))&&e.xsrfCookieName&&me.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===r&&o.setContentType(null),"setRequestHeader"in c&&B.forEach(o.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),B.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),i&&"json"!==i&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",be(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",be(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{c&&(n(!t||t.type?new he(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);f&&-1===Y.protocols.indexOf(f)?n(new L("Unsupported protocol "+f+":",L.ERR_BAD_REQUEST,e)):c.send(r||null)}))}};B.forEach(we,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));function qe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new he(null,e)}function Ee(e){return qe(e),e.headers=ue.from(e.headers),e.data=fe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),(e=>{e=B.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;o<t&&(n=e[o],!(r=B.isString(n)?we[n.toLowerCase()]:n));o++);if(!r){if(!1===r)throw new L(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(B.hasOwnProp(we,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!B.isFunction(r))throw new TypeError("adapter is not a function");return r})(e.adapter||re.adapter)(e).then((function(t){return qe(e),t.data=fe.call(e,e.transformResponse,t),t.headers=ue.from(t.headers),t}),(function(t){return de(t)||(qe(e),t&&t.response&&(t.response.data=fe.call(e,e.transformResponse,t.response),t.response.headers=ue.from(t.response.headers))),Promise.reject(t)}))}const Oe=e=>e instanceof ue?e.toJSON():e;function Se(e,t){t=t||{};const n={};function r(e,t,n){return B.isPlainObject(e)&&B.isPlainObject(t)?B.merge.call({caseless:n},e,t):B.isPlainObject(t)?B.merge({},t):B.isArray(t)?t.slice():t}function o(e,t,n){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!B.isUndefined(t))return r(void 0,t)}function s(e,t){return B.isUndefined(t)?B.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>o(Oe(e),Oe(t),!0)};return B.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=c[r]||o,s=i(e[r],t[r],r);B.isUndefined(s)&&i!==a||(n[r]=s)})),n}const Re={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Re[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const ve={};Re.transitional=function(e,t,n){function r(e,t){return"[Axios v1.3.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new L(r(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!ve[o]&&(ve[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};const Te={assertOptions:function(e,t,n){if("object"!=typeof e)throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new L("option "+i+" must be "+n,L.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}},validators:Re},Ae=Te.validators;class Ne{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Se(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;let i;void 0!==n&&Te.assertOptions(n,{silentJSONParsing:Ae.transitional(Ae.boolean),forcedJSONParsing:Ae.transitional(Ae.boolean),clarifyTimeoutError:Ae.transitional(Ae.boolean)},!1),void 0!==r&&Te.assertOptions(r,{encode:Ae.function,serialize:Ae.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=o&&B.merge(o.common,o[t.method]),i&&B.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=ue.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,f=0;if(!a){const e=[Ee.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);f<u;)l=l.then(e[f++],e[f++]);return l}u=s.length;let d=t;for(f=0;f<u;){const e=s[f++],t=s[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Ee.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,u=c.length;f<u;)l=l.then(c[f++],c[f++]);return l}getUri(e){return G(ge((e=Se(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}B.forEach(["delete","get","head","options"],(function(e){Ne.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),B.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,o){return this.request(Se(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Ne.prototype[e]=t(),Ne.prototype[e+"Form"]=t(!0)}));const Ce=Ne;class xe{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new he(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new xe((function(t){e=t})),cancel:e}}}const je=xe,Pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pe).forEach((([e,t])=>{Pe[t]=e}));const ke=Pe,_e=function e(t){const r=new Ce(t),o=n(Ce.prototype.request,r);return B.extend(o,Ce.prototype,r,{allOwnKeys:!0}),B.extend(o,r,null,{allOwnKeys:!0}),o.create=function(n){return e(Se(t,n))},o}(re);_e.Axios=Ce,_e.CanceledError=he,_e.CancelToken=je,_e.isCancel=de,_e.VERSION="1.3.4",_e.toFormData=W,_e.AxiosError=L,_e.Cancel=_e.CanceledError,_e.all=function(e){return Promise.all(e)},_e.spread=function(e){return function(t){return e.apply(null,t)}},_e.isAxiosError=function(e){return B.isObject(e)&&!0===e.isAxiosError},_e.mergeConfig=Se,_e.AxiosHeaders=ue,_e.formToJSON=e=>ee(B.isHTMLForm(e)?new FormData(e):e),_e.HttpStatusCode=ke,_e.default=_e;const Be=_e,Ue="https://api.xoxno.com",Fe="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",De="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",Le="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var Ie;!function(e){e.MAINNET="1",e.DEVNET="D"}(Ie||(Ie={}));class Me{static instance;apiUrl;apiKey;chain;config;constructor(e,t,n){this.apiUrl=e,this.apiKey=t,this.chain=n,this.config=n===Ie.MAINNET?{XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:Fe,DR_SC:De,KG_SC:Le,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{XO_SC:"erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3",FM_SC:Fe,DR_SC:De,KG_SC:Le,Staking_SC:"erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8",Manager_SC:"erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn",P2P_SC:"erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2"}}static init(e=Ue,t="",n=Ie.MAINNET){return Me.instance||(Me.instance=new Me(e,t,n)),Me.instance}static getClient(){if(!Me.instance)throw new Error("APIClient has not been initialized");return Me.instance}fetchWithTimeout=async(e,t={},n=4e4)=>{const r={"Accept-Encoding":"gzip,deflate,br","xo-time":`Sent-At:${Math.round((new Date).getTime()/1e3)}`,Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===t.method?{"Content-Type":"application/json"}:{},...t.headers??{}};try{const{data:o}=await Be(`${this.apiUrl}${e}${t.params?"?"+Object.keys(t.params).map((e=>`${e}=${encodeURIComponent(t.params[e])}`)).join("&"):""}`,{timeout:n,...t,...Object.keys(r).length?{headers:r}:{},method:t.method??"GET"});return o}catch(n){throw new Error("Something went wrong inside fetchWithTimeout "+e+" "+JSON.stringify(t)+" "+n)}}}const ze=e=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(e);class Je{api;constructor(){this.api=Me.getClient()}getCollectionProfile=async e=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getCollectionProfile/${e}`)};getCollectionFloorPrice=async(e,t="EGLD")=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getFloorPrice/${e}/${t}`)};getCollectionAttributes=async e=>{if(!ze(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/getCollectionAttributes/${e}`)};searchNFTs=async e=>{if(!ze(e.collection))throw new Error("Invalid collection ticker: "+e.collection);if(e.top&&e.top>35)throw new Error("Top cannot be greater than 35");const t={filters:{onSale:e.onlyOnSale||!1,marketplace:e.listedOnlyOn||void 0,auctionTypes:e.onlyOnSale?e.onlyAuctions?["NftBid","SftAll"]:["Nft","SftOnePerPayment"]:void 0,tokens:e.listedInToken||void 0,attributes:e.attributes||void 0,range:e.priceRange?{...e.priceRange,type:e.onlyAuctions?"saleInfoNft/current_bid_short":"saleInfoNft/min_bid_short"}:void 0,rankRange:e.rankRange||void 0,levelRange:e.cantinaLevelRange||void 0},name:e.searchName||"",orderBy:e.orderBy||void 0,collection:e.collection,select:e.onlySelectFields||void 0,top:e.top||35,skip:e.skip||0},n=Buffer.from(JSON.stringify(t)).toString("base64"),r=await this.api.fetchWithTimeout(`/searchNFTs/${n}`);return{...r,getNextPagePayload:{...e,skip:(e.skip??0)+(e.top??35)},hasMoreResults:r.resultsCount>(e.skip??0)+(e.top??35)}};getTradingActivity=async e=>await(async(e,t)=>{if(e.top&&e.top>35)throw new Error("Top cannot be greater than 35");const n={filters:{collection:e.collections,identifier:e.identifiers||void 0,address:e.owners||void 0,tokens:e.placedInToken||void 0,marketplace:e.marketplaces||void 0,action:e.actions||void 0,range:e.priceRange,rankRange:e.rankRange,timestampRange:e.timestampRange,attributes:e.attributes},orderBy:e.orderBy,select:e.select,top:e.top||35,skip:e.skip||0},r=Buffer.from(JSON.stringify(n)).toString("base64"),o=await t.fetchWithTimeout(`/getTradingActivity/${r}`);return{...o,getNextPagePayload:{...e,skip:(e.skip??0)+(e.top??35)},empty:0===o.resources.length}})(e,this.api);getCollections=async e=>{if(e?.top&&e.top>25)throw new Error("Top cannot be greater than 25");const t={skip:e?.skip||0,top:e?.top||25,select:e?.onlySelectFields||[],filters:{dataType:"collectionProfile",isMintable:e?.onlyMintable||void 0,...e?.collections&&e.collections.length>0&&{collection:e.collections}},orderBy:[e?.orderBy||"statistics.tradeData.weekEgldVolume desc"]},n=Buffer.from(JSON.stringify(t)).toString("base64"),r=await this.api.fetchWithTimeout(`/collections/${n}`);return{results:r,resultsCount:r.length,empty:0===r.length,getNextPagePayload:{...e,skip:(e?.skip||0)+(e?.top||25)},hasMoreResults:r.length<(e?.top||25)}}}class We{collection;constructor(e=Ue,t=""){Me.init(e,t),this.collection=new Je}}return t})()));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xoxno/sdk-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-alpha",
|
|
4
4
|
"description": "The SDK to interact with the XOXNO Protocol!",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./dist/xoxno.min.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
8
8
|
"build": "webpack",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"webpack-cli": "^5.0.1"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@multiversx/sdk-core": "^
|
|
70
|
+
"@multiversx/sdk-core": "^12",
|
|
71
71
|
"@multiversx/sdk-network-providers": "^1.3.0",
|
|
72
72
|
"axios": "^1.3.4"
|
|
73
73
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BigUIntValue,
|
|
3
|
-
Interaction,
|
|
4
|
-
SmartContract,
|
|
5
|
-
} from '@multiversx/sdk-core/out';
|
|
6
|
-
import { Address } from '@multiversx/sdk-core/out/address';
|
|
1
|
+
import type { Interaction } from '@multiversx/sdk-core/out/smartcontracts/interaction';
|
|
7
2
|
import { GlobalOffer } from '../types/collection';
|
|
8
3
|
import { APIClient } from '../utils/api';
|
|
9
4
|
import { ContractQueryRunner } from '../utils/scCalls';
|
|
10
5
|
import { SmartContractAbis } from '../utils/SmartContractAbis';
|
|
11
6
|
import { getSmartContract } from '../utils/SmartContractService';
|
|
7
|
+
import type { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
8
|
+
import { BigUIntValue } from '@multiversx/sdk-core/out/smartcontracts/typesystem/numerical';
|
|
12
9
|
|
|
13
10
|
export class SCInteraction {
|
|
14
11
|
private xo: SmartContract;
|
|
@@ -21,11 +18,7 @@ export class SCInteraction {
|
|
|
21
18
|
static async create() {
|
|
22
19
|
const config = APIClient.getClient().config;
|
|
23
20
|
const marketAbiXOXNO = await SmartContractAbis.getMarket();
|
|
24
|
-
const xo_abi = getSmartContract(
|
|
25
|
-
marketAbiXOXNO,
|
|
26
|
-
new Address(config.XO_SC),
|
|
27
|
-
'XOXNOProtocol'
|
|
28
|
-
);
|
|
21
|
+
const xo_abi = getSmartContract(marketAbiXOXNO, config.XO_SC);
|
|
29
22
|
|
|
30
23
|
return new SCInteraction(xo_abi);
|
|
31
24
|
}
|
package/src/launchpad/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Interaction } from '@multiversx/sdk-core/out/smartcontracts/interaction';
|
|
2
2
|
import { SmartContractAbis } from '../utils/SmartContractAbis';
|
|
3
3
|
import { getSmartContract } from '../utils/SmartContractService';
|
|
4
4
|
import { ContractQueryRunner } from '../utils/scCalls';
|
|
5
|
+
import type { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* LaunchpadModule provides methods to interact with the minter smart contract.
|
|
@@ -37,11 +38,7 @@ export class LaunchpadModule {
|
|
|
37
38
|
*/
|
|
38
39
|
static async init(minterSC: string) {
|
|
39
40
|
const minterAbiXOXNO = await SmartContractAbis.getMinter();
|
|
40
|
-
const minter_abi = getSmartContract(
|
|
41
|
-
minterAbiXOXNO,
|
|
42
|
-
new Address(minterSC),
|
|
43
|
-
'Minter'
|
|
44
|
-
);
|
|
41
|
+
const minter_abi = getSmartContract(minterAbiXOXNO, minterSC);
|
|
45
42
|
return new LaunchpadModule(minter_abi);
|
|
46
43
|
}
|
|
47
44
|
|
|
@@ -125,7 +125,7 @@ export interface GlobalOffer {
|
|
|
125
125
|
timestamp: number;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export
|
|
128
|
+
export enum FieldsToSelect {
|
|
129
129
|
Rank = 'metadata/rarity/rank',
|
|
130
130
|
Attributes = 'metadata/attributes',
|
|
131
131
|
Description = 'metadata/description',
|
|
@@ -144,7 +144,7 @@ export const enum FieldsToSelect {
|
|
|
144
144
|
Type = 'type',
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export
|
|
147
|
+
export enum SearchOrderBy {
|
|
148
148
|
PriceHighToLow = 'saleInfoNft/min_bid_short desc',
|
|
149
149
|
PriceLowToHigh = 'saleInfoNft/min_bid_short asc',
|
|
150
150
|
RarityHighToLow = 'metadata/rarity/rank desc',
|
|
@@ -155,7 +155,7 @@ export const enum SearchOrderBy {
|
|
|
155
155
|
OldestListed = 'saleInfoNft/timestamp asc',
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
export
|
|
158
|
+
export enum CollectionsOrderBy {
|
|
159
159
|
WeekVolumeHighToLow = 'statistics.tradeData.weekEgldVolume desc',
|
|
160
160
|
WeekVolumeLowToHigh = 'statistics.tradeData.weekEgldVolume asc',
|
|
161
161
|
DailyVolumeHighToLow = 'statistics.tradeData.dayEgldVolume desc',
|
|
@@ -174,7 +174,7 @@ export const enum CollectionsOrderBy {
|
|
|
174
174
|
FollowersLowToHigh = 'statistics.other.followCount asc',
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
export
|
|
177
|
+
export enum CollectionsFieldsToSelect {
|
|
178
178
|
Profile = 'profile',
|
|
179
179
|
Description = 'description',
|
|
180
180
|
Creator = 'creator',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Marketplace, MetadataAttribute } from './collection';
|
|
1
|
+
import { Marketplace, MetadataAttribute, TradingActivity } from './collection';
|
|
2
2
|
|
|
3
3
|
export interface TradingActivityQueryFilter {
|
|
4
4
|
filters: {
|
|
@@ -67,14 +67,14 @@ export interface TradincActivityArgs {
|
|
|
67
67
|
attributes?: MetadataAttribute[];
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export
|
|
70
|
+
export enum OrderByTradingActivity {
|
|
71
71
|
PriceHighToLow = 'short_price desc',
|
|
72
72
|
PriceLowToHigh = 'short_price asc',
|
|
73
73
|
RecentPlaced = 'timestamp desc',
|
|
74
74
|
OldestPlaced = 'timestamp asc',
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export
|
|
77
|
+
export enum SelectFieldsTradingActivity {
|
|
78
78
|
'attributes',
|
|
79
79
|
'collection',
|
|
80
80
|
'offer_id',
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SmartContract,
|
|
5
|
-
SmartContractAbi,
|
|
6
|
-
} from '@multiversx/sdk-core/out';
|
|
1
|
+
import { Address } from '@multiversx/sdk-core/out/address';
|
|
2
|
+
import { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
3
|
+
import type { AbiRegistry } from '@multiversx/sdk-core/out/smartcontracts/typesystem/abiRegistry';
|
|
7
4
|
|
|
8
|
-
export const getSmartContract = (
|
|
9
|
-
abiRegistry: AbiRegistry,
|
|
10
|
-
address: Address,
|
|
11
|
-
implementedInterface: string
|
|
12
|
-
) => {
|
|
5
|
+
export const getSmartContract = (abiRegistry: AbiRegistry, address: string) => {
|
|
13
6
|
return new SmartContract({
|
|
14
|
-
address: address,
|
|
15
|
-
abi:
|
|
7
|
+
address: new Address(address),
|
|
8
|
+
abi: abiRegistry,
|
|
16
9
|
});
|
|
17
10
|
};
|
package/src/utils/api.ts
CHANGED
package/src/utils/scCalls.ts
CHANGED
|
@@ -3,13 +3,12 @@ import {
|
|
|
3
3
|
ProxyNetworkProvider,
|
|
4
4
|
} from '@multiversx/sdk-network-providers';
|
|
5
5
|
import { INetworkProvider } from '@multiversx/sdk-network-providers/out/interface';
|
|
6
|
-
|
|
7
|
-
ResultsParser,
|
|
8
|
-
SmartContract,
|
|
9
|
-
Interaction,
|
|
10
|
-
TypedOutcomeBundle,
|
|
11
|
-
} from '@multiversx/sdk-core';
|
|
6
|
+
|
|
12
7
|
import { APIClient } from './api';
|
|
8
|
+
import { ResultsParser } from '@multiversx/sdk-core/out/smartcontracts/resultsParser';
|
|
9
|
+
import type { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract';
|
|
10
|
+
import type { Interaction } from '@multiversx/sdk-core/out/smartcontracts/interaction';
|
|
11
|
+
import type { TypedOutcomeBundle } from '@multiversx/sdk-core/out/smartcontracts/interface';
|
|
13
12
|
|
|
14
13
|
export class ContractQueryRunner {
|
|
15
14
|
private readonly proxy: INetworkProvider;
|