@xoxno/sdk-js 0.1.56-alpha → 0.1.57-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.
@@ -1 +0,0 @@
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/sdk-js"]=t():e["@xoxno/sdk-js"]=t()}(this,(()=>(()=>{var e,t={3979:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanValue=t.BooleanType=void 0;const i=n(5626);class a extends i.PrimitiveType{constructor(){super("bool")}getClassName(){return a.ClassName}}t.BooleanType=a,a.ClassName="BooleanType";class s extends i.PrimitiveValue{constructor(e){super(new a),this.value=e}getClassName(){return s.ClassName}equals(e){return this.value===e.value}isTrue(){return!0===this.value}isFalse(){return!this.isTrue()}valueOf(){return this.value}}t.BooleanValue=s,s.ClassName="BooleanValue"},7586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Struct=t.StructType=void 0;const i=n(2581),a=n(5766),s=n(5626);class r extends s.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return r.ClassName}static fromJSON(e){let t=(e.fields||[]).map((e=>a.FieldDefinition.fromJSON(e)));return new r(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return a.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.StructType=r,r.ClassName="StructType";class o extends s.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map((e=>[e.name,e]))),this.checkTyping()}getClassName(){return o.ClassName}checkTyping(){let e=this.getType().getFieldsDefinitions();a.Fields.checkTyping(this.fields,e)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new i.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(const t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();return a.Fields.equals(t,n)}}t.Struct=o,o.ClassName="Struct"},3145:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierValue=t.TokenIdentifierType=void 0;const i=n(5626);class a extends i.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return a.ClassName}}t.TokenIdentifierType=a,a.ClassName="TokenIdentifierType";class s extends i.PrimitiveValue{constructor(e){super(new a),this.value=e}static egld(){return new s("EGLD")}static esdtTokenIdentifier(e){return new s(e)}getClassName(){return s.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}}t.TokenIdentifierValue=s,s.ClassName="TokenIdentifierValue"},1222:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TokenPayment=t.TokenTransfer=void 0;const a=i(n(1594)),s=n(2581),r="EGLD";a.default.set({ROUNDING_MODE:1});class o{constructor(e){const t=new a.default(e.amountAsBigInteger);if(!t.isInteger()||t.isNegative())throw new s.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=t,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){const t=new a.default(e).shiftedBy(18).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new o({tokenIdentifier:r,nonce:0,amountAsBigInteger:e,numDecimals:18})}static fungibleFromAmount(e,t,n){const i=new a.default(t).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,t,n=0){return new o({tokenIdentifier:e,nonce:0,amountAsBigInteger:t,numDecimals:n})}static nonFungible(e,t){return new o({tokenIdentifier:e,nonce:t,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,t,n){return new o({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,t,n,i){const s=new a.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,i)}static metaEsdtFromBigInteger(e,t,n,i=0){return new o({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==r}isFungible(){return 0==this.nonce}}t.TokenTransfer=o;t.TokenPayment=class extends o{constructor(e,t,n,i){super({tokenIdentifier:e,nonce:t,amountAsBigInteger:n,numDecimals:i})}}},7744:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SCInteraction:()=>O});const i="https://api.xoxno.com",a="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",s="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",r="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var o;!function(e){e.MAINNET="1",e.DEVNET="D"}(o||(o={}));class c{static instance;apiUrl;apiKey;chain;config;constructor(e=i,t="",n=o.MAINNET){this.apiUrl=e,this.apiKey=t,this.chain=n,this.config=n===o.MAINNET?{XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:a,DR_SC:s,KG_SC:r,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{XO_SC:"erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3",FM_SC:a,DR_SC:s,KG_SC:r,Staking_SC:"erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8",Manager_SC:"erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn",P2P_SC:"erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2"}}static init({apiUrl:e=i,apiKey:t="",chain:n=o.MAINNET}={}){return c.instance||(n==o.DEVNET&&(c.instance=new c("https://api-dev.xoxno.com",t,n)),c.instance=new c(e,t,n)),c.instance}fetchWithTimeout=async(e,t={},n=4e4)=>{const i={"Accept-Encoding":"gzip,deflate,br",Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===t.method?{"Content-Type":"application/json"}:{},...t.headers??{}},a=`${"string"==typeof e&&e.startsWith("/")?`${this.apiUrl}${e}`:e}${t.params?"?"+Object.keys(t.params).map((e=>`${e}=${encodeURIComponent(t.params[e])}`)).join("&"):""}`,s=new AbortController;setTimeout((()=>s.abort()),n);const r=await fetch(a,{...t,...t?.next&&t.next.revalidate?{}:{cache:"no-store"},signal:s.signal,...Object.keys(i).length?{headers:i}:{},method:t.method??"GET"});if(!r.ok)throw new Error((await r.json()).message.toString());return r.json()}}var l=n(2528),u=n(8403);class d{proxy;parser=new l.A;constructor(){const e=c.init().apiUrl;this.proxy=new u.ProxyNetworkProvider(e,{timeout:1e4})}async runQuery(e,t){try{const e=await this.proxy.queryContract(t.buildQuery());return this.parser.parseQueryResponse(e,t.getEndpoint())}catch(n){throw console.log(`Unexpected error when running query '${t.buildQuery().func}' to sc '${e.getAddress().bech32()}' `),console.error(n),n}}}var h=n(4966);class f{static manager;static exchange;static minter;static market;static staking;static p2p;static async getMarket(){if(!f.market){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/esdt-nft-marketplace.abi.json",{next:{tags:["getMarket"]}}),t=h.AbiRegistry.create(e);f.market=t}return f.market}static async getManager(){if(!f.manager){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/manage.json",{next:{tags:["getManager"]}}),t=h.AbiRegistry.create(e);f.manager=t}return f.manager}static async getMinter(){if(!f.minter){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/minter.json",{next:{tags:["getMinter"]}}),t=h.AbiRegistry.create(e);f.minter=t}return f.minter}static async getStaking(){if(!f.staking){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/staking-nfts.abi.json",{next:{tags:["getStaking"]}}),t=h.AbiRegistry.create(e);f.staking=t}return f.staking}static async getExchange(){if(!f.exchange){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/rs-exchange.abi.json",{next:{tags:["getExchange"]}}),t=h.AbiRegistry.create(e);f.exchange=t}return f.exchange}static async getP2P(){if(!f.p2p){const e=await c.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/p2p.abi.json",{next:{tags:["getP2P"],revalidate:500}}),t=h.AbiRegistry.create(e);f.p2p=t}return f.p2p}}var m=n(236),g=n(1998);var p,w=n(4473);!function(e){e[e.NftBid=0]="NftBid",e[e.Nft=1]="Nft",e[e.SftAll=2]="SftAll",e[e.SftOnePerPayment=3]="SftOnePerPayment"}(p||(p={}));var y=n(1222),q=n(1594),_=n.n(q),T=n(7586),v=n(3145),k=n(5766),x=n(3979);class O{xo;call;api;constructor(e){this.xo=e,this.call=new d,this.api=c.init()}static async init(){const e=c.init().config,t=await f.getMarket(),n=(i=t,a=e.XO_SC,new g.SmartContract({address:new m.Address(a),abi:i}));var i,a;return new O(n)}async getResult(e){return await this.call.runQuery(this.xo,e)}getMarketplaceFees=async()=>{const e=this.xo.methods.getMarketplaceCutPercentage(),t=await this.getResult(e);return parseInt(t.firstValue?.valueOf())};getAcceptedPaymentTokens=async()=>{const e=this.xo.methods.getAcceptedTokens(),t=await this.getResult(e);return t.firstValue?.valueOf()};getGlobalOfferIDs=async()=>{const e=this.xo.methods.getGlobalOffers(),t=await this.getResult(e);return t.firstValue?.valueOf().map((e=>parseInt(e)))};async getUserPoolBalance(e,t,n){const i=await this.getResult(this.xo.methods.userDeposit([e,t,n]));return i?.firstValue?new w.BigUIntValue(i.firstValue.valueOf().amount).valueOf().shiftedBy(-18).toNumber():0}isOfferActive(e,t){return e<=t}getGlobalOfferData=async e=>{const t=this.xo.methods.getGlobalOffer([e]),n=await this.getResult(t),i=n.firstValue?.valueOf();return i.offer_id=parseInt(i.offer_id.valueOf()),i.marketplace="XO",i.short_price=parseFloat(new w.BigUIntValue(i.price).valueOf().shiftedBy(-18).toString()),i.new_version=Boolean(i.new_version),i.new_version?i.isActive=!0:i.isActive=this.isOfferActive(i.short_price,await this.getUserPoolBalance(i.owner,i.payment_token,i.payment_nonce)),i.quantity=parseInt(i.quantity.valueOf()),i.payment_nonce=parseInt(i.payment_nonce.valueOf()),i.price=i.price.valueOf(),i.timestamp=parseInt(i.timestamp.valueOf()),i.owner=i.owner.valueOf().toString(),i.attributes&&(i.attributes=JSON.parse(Buffer.from(i.attributes.valueOf().toString(),"base64").toString("ascii"))),i};getAuctionInfo=async e=>{const t=this.xo.methods.getFullAuctionData([e]),n=await this.getResult(t),i=n.firstValue?.valueOf();return i?(i.auctioned_token_nonce=parseInt(i.auctioned_token_nonce.valueOf()),i.nr_auctioned_tokens=parseInt(i.nr_auctioned_tokens.valueOf()),i.auction_type=i.auction_type.name,i.payment_token_nonce=parseInt(i.payment_token_nonce.valueOf()),i.min_bid=i.min_bid.valueOf(),i.max_bid=i.max_bid.valueOf(),i.start_time=parseInt(i.start_time.valueOf()),i.deadline=parseInt(i.deadline.valueOf()),i.original_owner=i.original_owner.valueOf().toString(),i.current_winner=i.current_winner.valueOf().toString(),i.current_bid=i.current_bid.valueOf().toString(),i.marketplace_cut_percentage=i.marketplace_cut_percentage.valueOf(),i.creator_royalties_percentage=i.creator_royalties_percentage.valueOf(),i):null};async getListingsCount(){const e=await this.getResult(this.xo.methods.getListingsCount());return parseInt(e.firstValue?.valueOf())}async getOffersCount(){const e=await this.getResult(this.xo.methods.getOffersCount());return parseInt(e.firstValue?.valueOf())}async getGlobalOffersCount(){const e=await this.getResult(this.xo.methods.getGlobalOffersCount());return parseInt(e.firstValue?.valueOf())}async getCollectionsCount(){const e=await this.getResult(this.xo.methods.getCollectionsCount());return parseInt(e.firstValue?.valueOf())}async isCollectionListed(e){const t=await this.getResult(this.xo.methods.isCollectionListed([e]));return Boolean(t.firstValue?.valueOf())}async getCollectionNFTsOnSaleCount(e){const t=await this.getResult(this.xo.methods.getTokenItemsForSaleCount([e]));return parseInt(t.firstValue?.valueOf())}async getAuctionIDsForCollection(e){const t=await this.getResult(this.xo.methods.getAuctionsForTicker([e])),n=t.firstValue?.valueOf().map((e=>parseInt(e)));return n}withdrawAuctions(e,t,n){if("XO"===n){const n=this.xo.methods.withdraw(e);return t.nonce&&n.withNonce(t.nonce),n.withChainID(this.api.chain).withSender(new m.Address(t.address)).withGasLimit(Math.min(6e8,15e6+5e6*e.length))}throw new Error("Market not supported")}withdrawGlobalOffer(e,t){const n=this.xo.methods.withdrawGlobalOffer([e]);return t.nonce&&n.withNonce(t.nonce),n.withChainID(this.api.chain).withSender(new m.Address(t.address)).withGasLimit(15e6)}acceptGlobalOffer({signature:e,offer_id:t,auction_id_opt:n,nft:i,address:a,nonce:s}){const r=e?this.xo.methods.acceptGlobalOffer([t,n,e]):this.xo.methods.acceptGlobalOffer([t,n]);return r.withSender(new m.Address(a)),i&&r.withSingleESDTNFTTransfer(y.TokenTransfer.semiFungible(i.collection,i.nonce,i.amount??1)),s&&r.withNonce(s),r.withChainID(this.api.chain).withGasLimit(3e7)}sendGlobalOffer({payment_token:e,payment_nonce:t,price:n,collection:i,attributes:a,depositAmount:s,address:r,nonce:o}){const c=a?this.xo.methods.sendGlobalOffer([e,t,y.TokenTransfer.egldFromAmount(n).toString(),i,a]):this.xo.methods.sendGlobalOffer([e,t,y.TokenTransfer.egldFromAmount(n).toString(),i]);return o&&c.withNonce(o),c.withSender(new m.Address(r)),s&&c.withValue(y.TokenTransfer.egldFromAmount(s)),c.withChainID(this.api.chain).withGasLimit(3e7)}sendCustomOffer({payment_token:e,payment_nonce:t,price:n,deadline:i,nft:a,depositAmount:s,address:r,nonce:o}){const c=this.xo.methods.sendOffer([e,t,y.TokenTransfer.egldFromAmount(n).toString(),a.collection,a.nonce,a.amount??1,i]);return o&&c.withNonce(o),c.withSender(new m.Address(r)),s&&c.withValue(y.TokenTransfer.egldFromAmount(s)),c.withChainID(this.api.chain).withGasLimit(3e7)}withdrawCustomOffer(e,t){const n=this.xo.methods.withdrawOffer([e]);return t.nonce&&n.withNonce(t.nonce),n.withSender(new m.Address(t.address)),n.withChainID(this.api.chain).withGasLimit(15e6)}declineCustomOffer(e,t,n){const i=this.xo.methods.declineOffer([e]);return t.nonce&&i.withNonce(t.nonce),i.withSender(new m.Address(t.address)),n&&i.withSingleESDTNFTTransfer(y.TokenTransfer.semiFungible(n.collection,n.nonce,n.amount??1)),i.withChainID(this.api.chain).withGasLimit(2e7)}acceptCustomOffer(e,t,n){const i=this.xo.methods.acceptOffer([e]);return t.nonce&&i.withNonce(t.nonce),i.withSender(new m.Address(t.address)),n&&i.withSingleESDTNFTTransfer(y.TokenTransfer.semiFungible(n.collection,n.nonce,n.amount??1)),i.withChainID(this.api.chain).withGasLimit(3e7)}endAuction(e,t,n="XO"){if("XO"==n){const n=this.xo.methods.endAuction([e]);return t.nonce&&n.withNonce(t.nonce),n.withSender(new m.Address(t.address)),n.withChainID(this.api.chain).withGasLimit(15e6)}throw new Error("Market not supported")}bidOnAuctionId(e,t,n,i,a){const s=this.xo.methods.bid([e,t,n]);if(!i.amount)throw new Error("Payment amount is required");return a.nonce&&s.withNonce(a.nonce),s.withSender(new m.Address(a.address)),"EGLD"==i.collection&&i.amount?s.withValue(y.TokenTransfer.egldFromAmount(i.amount)):s.withSingleESDTTransfer(y.TokenTransfer.fungibleFromAmount(i.collection,i.amount,i.decimals??18)),s.withChainID(this.api.chain).withGasLimit(3e7)}bulkBuy(e,t,n){const i=this.xo.methods.bid(e);if(n.nonce&&i.withNonce(n.nonce),i.withSender(new m.Address(n.address)),!t.amount)throw new Error("Payment amount is required");return"EGLD"==t.collection&&t.amount?i.withValue(y.TokenTransfer.egldFromAmount(t.amount)):i.withSingleESDTTransfer(y.TokenTransfer.fungibleFromAmount(t.collection,t.amount,t.decimals??18)),i.withChainID(this.api.chain).withGasLimit(Math.min(6e8,2e7+5e6*e.length))}async buyAuctionById({auctionID:e,collection:t,nonce:n,paymentAmount:i,quantity:a=1,token:s="EGLD",withCheck:r=!0,isBigUintPayment:o=!1,address:c,nonce:l,isBid:u=!1,decimals:d=18,market:h="XO"}){if("XO"!==h)throw new Error("Market not supported");if(!e)throw new Error("AuctionID not provided");let f=null;if(!i||!s||!t||!n||r){if(f=await this.getAuctionInfo(e),null===f)throw new Error("Auction not found");if(f.auction_type===p.Nft||f.auction_type===p.SftOnePerPayment)throw new Error("Auction type is not NFT or SftOnePerPayment")}const g=f?.payment_token_type??s,w=!!f||o;let q=u?f?.max_bid??i:f?.min_bid??i;if(!q)throw new Error("Payment amount not provided");const T=this.xo.methods.buy([e,f?.auctioned_token_type??t,f?.auctioned_token_nonce??n,a??1]);if(l&&T.withNonce(l),T.withSender(new m.Address(c)),"EGLD"===s)T.withValue(w?y.TokenTransfer.egldFromBigInteger(new(_())(q).multipliedBy(a)):y.TokenTransfer.egldFromAmount(new(_())(q).multipliedBy(a)));else{if(!w){if(f=await this.getAuctionInfo(e),null===f)throw new Error("Auction not found");q=u?f.max_bid:f.min_bid}T.withSingleESDTTransfer(y.TokenTransfer.fungibleFromBigInteger(g,q,d))}return T.withChainID(this.api.chain).withGasLimit(2e7)}async changeListing(e,t){const n=new T.StructType("BulkUpdateListing",[new k.FieldDefinition("payment_token_type","",new v.TokenIdentifierType),new k.FieldDefinition("new_price","",new w.BigUIntType),new k.FieldDefinition("auction_id","",new w.U64Type),new k.FieldDefinition("deadline","",new w.U64Type)]),i=[];e.forEach((({paymentToken:e,price:t,auctionID:a,deadline:s})=>{i.push(new T.Struct(n,[new k.Field(new v.TokenIdentifierValue(e),"payment_token_type"),new k.Field(new w.BigUIntValue(t),"new_price"),new k.Field(new w.U64Value(a),"auction_id"),new k.Field(new w.U64Value(s),"deadline")]))}));const a=this.xo.methods.changeListing(i);return t.nonce&&a.withNonce(t.nonce),a.withSender(new m.Address(t.address)),a.withChainID(this.api.chain).withGasLimit(Math.min(6e8,8e6+2e6*e.length))}async listNFTs(e,t){const n=new T.StructType("BulkListing",[new k.FieldDefinition("min_bid","",new w.BigUIntType),new k.FieldDefinition("max_bid","",new w.BigUIntType),new k.FieldDefinition("deadline","",new w.U64Type),new k.FieldDefinition("accepted_payment_token","",new v.TokenIdentifierType),new k.FieldDefinition("bid","",new x.BooleanType),new k.FieldDefinition("opt_sft_max_one_per_payment","",new x.BooleanType),new k.FieldDefinition("opt_start_time","",new w.U64Type),new k.FieldDefinition("collection","",new v.TokenIdentifierType),new k.FieldDefinition("nonce","",new w.U64Type),new k.FieldDefinition("nft_amount","",new w.BigUIntType)]),i=[],a=[];e.forEach((e=>{const t=e.accepted_payment_token_decimals??18,s=new(_())(e.min_bid).shiftedBy(t),r=new(_())(e.max_bid??0).shiftedBy(t);a.push(y.TokenTransfer.semiFungible(e.collection,e.nonce,e.nft_amount)),i.push(new T.Struct(n,[new k.Field(new w.BigUIntValue(s),"min_bid"),new k.Field(new w.BigUIntValue(r),"max_bid"),new k.Field(new w.U64Value(new(_())(e.deadline??0)),"deadline"),new k.Field(new v.TokenIdentifierValue(e.accepted_payment_token??"EGLD"),"accepted_payment_token"),new k.Field(new x.BooleanValue(e.bid??!1),"bid"),new k.Field(new x.BooleanValue(e.isSFTPack??!1),"opt_sft_max_one_per_payment"),new k.Field(new w.U64Value(new(_())(e.opt_start_time?e.opt_start_time:0)),"opt_start_time"),new k.Field(new v.TokenIdentifierValue(e.collection),"collection"),new k.Field(new w.U64Value(e.nonce),"nonce"),new k.Field(new w.BigUIntValue(new(_())(e.nft_amount)),"nft_amount")]))}));const s=this.xo.methods.listings(i);return t.nonce&&s.withNonce(t.nonce),s.withSender(new m.Address(t.address)),s.withMultiESDTNFTTransfer(a),s.withChainID(this.api.chain).withGasLimit(Math.min(6e8,8e6+2e6*e.length))}}},5340:()=>{},9838:()=>{}},n={};function i(e){var a=n[e];if(void 0!==a)return a.exports;var s=n[e]={exports:{}};return t[e].call(s.exports,s,s.exports,i),s.exports}i.m=t,e=[],i.O=(t,n,a,s)=>{if(!n){var r=1/0;for(u=0;u<e.length;u++){for(var[n,a,s]=e[u],o=!0,c=0;c<n.length;c++)(!1&s||r>=s)&&Object.keys(i.O).every((e=>i.O[e](n[c])))?n.splice(c--,1):(o=!1,s<r&&(r=s));if(o){e.splice(u--,1);var l=a();void 0!==l&&(t=l)}}return t}s=s||0;for(var u=e.length;u>0&&e[u-1][2]>s;u--)e[u]=e[u-1];e[u]=[n,a,s]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={488:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var a,s,[r,o,c]=n,l=0;if(r.some((t=>0!==e[t]))){for(a in o)i.o(o,a)&&(i.m[a]=o[a]);if(c)var u=c(i)}for(t&&t(n);l<r.length;l++)s=r[l],i.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return i.O(u)},n=this.webpackChunk_xoxno_sdk_js=this.webpackChunk_xoxno_sdk_js||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var a=i.O(void 0,[236,265],(()=>i(7744)));return a=i.O(a)})()));
@@ -1 +0,0 @@
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/sdk-js"]=t():e["@xoxno/sdk-js"]=t()}(this,(()=>(()=>{var e,t={3979:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanValue=t.BooleanType=void 0;const s=n(5626);class a extends s.PrimitiveType{constructor(){super("bool")}getClassName(){return a.ClassName}}t.BooleanType=a,a.ClassName="BooleanType";class i extends s.PrimitiveValue{constructor(e){super(new a),this.value=e}getClassName(){return i.ClassName}equals(e){return this.value===e.value}isTrue(){return!0===this.value}isFalse(){return!this.isTrue()}valueOf(){return this.value}}t.BooleanValue=i,i.ClassName="BooleanValue"},7586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Struct=t.StructType=void 0;const s=n(2581),a=n(5766),i=n(5626);class r extends i.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return r.ClassName}static fromJSON(e){let t=(e.fields||[]).map((e=>a.FieldDefinition.fromJSON(e)));return new r(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find((t=>t.name==e))}getNamesOfDependencies(){return a.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}}t.StructType=r,r.ClassName="StructType";class o extends i.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map((e=>[e.name,e]))),this.checkTyping()}getClassName(){return o.ClassName}checkTyping(){let e=this.getType().getFieldsDefinitions();a.Fields.checkTyping(this.fields,e)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new s.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(const t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),n=e.getFields();return a.Fields.equals(t,n)}}t.Struct=o,o.ClassName="Struct"},3145:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenIdentifierValue=t.TokenIdentifierType=void 0;const s=n(5626);class a extends s.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return a.ClassName}}t.TokenIdentifierType=a,a.ClassName="TokenIdentifierType";class i extends s.PrimitiveValue{constructor(e){super(new a),this.value=e}static egld(){return new i("EGLD")}static esdtTokenIdentifier(e){return new i(e)}getClassName(){return i.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()==e.getLength()&&this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}}t.TokenIdentifierValue=i,i.ClassName="TokenIdentifierValue"},9491:(e,t,n)=>{"use strict";n.r(t),n.d(t,{LaunchpadModule:()=>d});var s=n(4966);const a="https://api.xoxno.com",i="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",r="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",o="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var c;!function(e){e.MAINNET="1",e.DEVNET="D"}(c||(c={}));class l{static instance;apiUrl;apiKey;chain;config;constructor(e=a,t="",n=c.MAINNET){this.apiUrl=e,this.apiKey=t,this.chain=n,this.config=n===c.MAINNET?{XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:i,DR_SC:r,KG_SC:o,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{XO_SC:"erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3",FM_SC:i,DR_SC:r,KG_SC:o,Staking_SC:"erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8",Manager_SC:"erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn",P2P_SC:"erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2"}}static init({apiUrl:e=a,apiKey:t="",chain:n=c.MAINNET}={}){return l.instance||(n==c.DEVNET&&(l.instance=new l("https://api-dev.xoxno.com",t,n)),l.instance=new l(e,t,n)),l.instance}fetchWithTimeout=async(e,t={},n=4e4)=>{const s={"Accept-Encoding":"gzip,deflate,br",Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===t.method?{"Content-Type":"application/json"}:{},...t.headers??{}},a=`${"string"==typeof e&&e.startsWith("/")?`${this.apiUrl}${e}`:e}${t.params?"?"+Object.keys(t.params).map((e=>`${e}=${encodeURIComponent(t.params[e])}`)).join("&"):""}`,i=new AbortController;setTimeout((()=>i.abort()),n);const r=await fetch(a,{...t,...t?.next&&t.next.revalidate?{}:{cache:"no-store"},signal:i.signal,...Object.keys(s).length?{headers:s}:{},method:t.method??"GET"});if(!r.ok)throw new Error((await r.json()).message.toString());return r.json()}}class u{static manager;static exchange;static minter;static market;static staking;static p2p;static async getMarket(){if(!u.market){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/esdt-nft-marketplace.abi.json",{next:{tags:["getMarket"]}}),t=s.AbiRegistry.create(e);u.market=t}return u.market}static async getManager(){if(!u.manager){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/manage.json",{next:{tags:["getManager"]}}),t=s.AbiRegistry.create(e);u.manager=t}return u.manager}static async getMinter(){if(!u.minter){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/minter.json",{next:{tags:["getMinter"]}}),t=s.AbiRegistry.create(e);u.minter=t}return u.minter}static async getStaking(){if(!u.staking){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/staking-nfts.abi.json",{next:{tags:["getStaking"]}}),t=s.AbiRegistry.create(e);u.staking=t}return u.staking}static async getExchange(){if(!u.exchange){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/rs-exchange.abi.json",{next:{tags:["getExchange"]}}),t=s.AbiRegistry.create(e);u.exchange=t}return u.exchange}static async getP2P(){if(!u.p2p){const e=await l.init().fetchWithTimeout("https://media.xoxno.com/smartcontractabi/p2p.abi.json",{next:{tags:["getP2P"],revalidate:500}}),t=s.AbiRegistry.create(e);u.p2p=t}return u.p2p}}var g=n(236),q=n(1998);var m=n(2528),h=n(8403);class p{proxy;parser=new m.A;constructor(){const e=l.init().apiUrl;this.proxy=new h.ProxyNetworkProvider(e,{timeout:1e4})}async runQuery(e,t){try{const e=await this.proxy.queryContract(t.buildQuery());return this.parser.parseQueryResponse(e,t.getEndpoint())}catch(n){throw console.log(`Unexpected error when running query '${t.buildQuery().func}' to sc '${e.getAddress().bech32()}' `),console.error(n),n}}}class d{minter;call;constructor(e){this.minter=e,this.call=new p}async getResult(e){return await this.call.runQuery(this.minter,e)}static async init(e){const t=await u.getMinter(),n=(s=t,a=e,new q.SmartContract({address:new g.Address(a),abi:s}));var s,a;return new d(n)}getAllUniqueTags=async()=>{const e=this.minter.methods.collections(),t=await this.getResult(e);return t.firstValue?.valueOf().map((e=>e.toString()))};getWalletGlobalBuyCount=async(e,t)=>{const n=this.minter.methods.buysPerWallet([e,t]),s=await this.getResult(n);return s.firstValue?.valueOf()};getWalletStageBuyCount=async(e,t,n)=>{const s=this.minter.methods.buysStagePerWallet([e,t,n]),a=await this.getResult(s);return a.firstValue?.valueOf()};getLocalOwner=async()=>{const e=this.minter.methods.localOwner(),t=await this.getResult(e);return t.firstValue?.valueOf()};getLaunchpadCutFee=async()=>{const e=this.minter.methods.cutPercentage(),t=await this.getResult(e);return t.firstValue?.valueOf()};getStageWhitelist=async(e,t)=>{const n=this.minter.methods.getWhitelistedWallets([e,t]),s=await this.getResult(n);return s.firstValue?.valueOf().map((e=>e.toString()))};getStages=async e=>{const t=this.minter.methods.mintStage([e]),n=await this.getResult(t);return n.firstValue?.valueOf().map((e=>{const t=e[1].valueOf();return t.name=t.name.toString(),t.tag=t.name.toString(),t.start_time=parseInt(t.start_time.toString()),t.end_time=parseInt(t.end_time.toString()),t.mint_limit=parseInt(t.mint_limit.toString()),t.mint_count=parseInt(t.mint_count.toString()),t.max_per_wallet=parseInt(t.max_per_wallet.toString()),t.prices=t.prices.map((e=>{const t=e.valueOf();return{...t,token_nonce:parseInt(t.token_nonce.toString()),amount:t.amount.toString()}})),t}))}}},5340:()=>{},9838:()=>{}},n={};function s(e){var a=n[e];if(void 0!==a)return a.exports;var i=n[e]={exports:{}};return t[e].call(i.exports,i,i.exports,s),i.exports}s.m=t,e=[],s.O=(t,n,a,i)=>{if(!n){var r=1/0;for(u=0;u<e.length;u++){for(var[n,a,i]=e[u],o=!0,c=0;c<n.length;c++)(!1&i||r>=i)&&Object.keys(s.O).every((e=>s.O[e](n[c])))?n.splice(c--,1):(o=!1,i<r&&(r=i));if(o){e.splice(u--,1);var l=a();void 0!==l&&(t=l)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,a,i]},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={437:0};s.O.j=t=>0===e[t];var t=(t,n)=>{var a,i,[r,o,c]=n,l=0;if(r.some((t=>0!==e[t]))){for(a in o)s.o(o,a)&&(s.m[a]=o[a]);if(c)var u=c(s)}for(t&&t(n);l<r.length;l++)i=r[l],s.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return s.O(u)},n=this.webpackChunk_xoxno_sdk_js=this.webpackChunk_xoxno_sdk_js||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var a=s.O(void 0,[236,265],(()=>s(9491)));return a=s.O(a)})()));
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return r[e].call(i.exports,i,i.exports,o),i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var a=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],l=!0,u=0;u<t.length;u++)(!1&i||a>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(l=!1,i<a&&(a=i));if(l){e.splice(f--,1);var s=n();void 0!==s&&(r=s)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={121:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[a,l,u]=t,s=0;if(a.some((r=>0!==e[r]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);if(u)var f=u(o)}for(r&&r(t);s<a.length;s++)i=a[s],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(f)},t=this.webpackChunk_xoxno_sdk_js=this.webpackChunk_xoxno_sdk_js||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();