@xoxno/sdk-js 0.1.54-alpha → 0.1.56-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.
Files changed (64) hide show
  1. package/dist/236.bundle.js +1 -0
  2. package/dist/265.bundle.js +2 -0
  3. package/dist/265.bundle.js.LICENSE.txt +10 -0
  4. package/dist/collection/index.d.ts +13 -1
  5. package/dist/common/index.d.ts +1 -9
  6. package/dist/index.bundle.js +1 -0
  7. package/dist/index.d.ts +0 -2
  8. package/dist/interactions.bundle.js +1 -0
  9. package/dist/launchpad.bundle.js +1 -0
  10. package/dist/runtime.bundle.js +1 -0
  11. package/dist/types/collection.d.ts +3 -0
  12. package/dist/types/index.d.ts +3 -0
  13. package/dist/types/trading.d.ts +39 -19
  14. package/dist/types/user.d.ts +2 -33
  15. package/dist/utils/api.d.ts +1 -1
  16. package/package.json +11 -8
  17. package/dist/collection/index.js +0 -520
  18. package/dist/collection/index.js.map +0 -1
  19. package/dist/common/index.js +0 -78
  20. package/dist/common/index.js.map +0 -1
  21. package/dist/index.js +0 -26
  22. package/dist/index.js.map +0 -1
  23. package/dist/interactions/index.js +0 -678
  24. package/dist/interactions/index.js.map +0 -1
  25. package/dist/launchpad/index.js +0 -158
  26. package/dist/launchpad/index.js.map +0 -1
  27. package/dist/nft/index.js +0 -121
  28. package/dist/nft/index.js.map +0 -1
  29. package/dist/staking/index.js +0 -29
  30. package/dist/staking/index.js.map +0 -1
  31. package/dist/types/collection.js +0 -183
  32. package/dist/types/collection.js.map +0 -1
  33. package/dist/types/common.js +0 -3
  34. package/dist/types/common.js.map +0 -1
  35. package/dist/types/index.js +0 -21
  36. package/dist/types/index.js.map +0 -1
  37. package/dist/types/interactions.js +0 -11
  38. package/dist/types/interactions.js.map +0 -1
  39. package/dist/types/nft.js +0 -3
  40. package/dist/types/nft.js.map +0 -1
  41. package/dist/types/staking.js +0 -15
  42. package/dist/types/staking.js.map +0 -1
  43. package/dist/types/trading.js +0 -26
  44. package/dist/types/trading.js.map +0 -1
  45. package/dist/types/user.js +0 -13
  46. package/dist/types/user.js.map +0 -1
  47. package/dist/users/index.js +0 -220
  48. package/dist/users/index.js.map +0 -1
  49. package/dist/utils/SmartContractAbis.js +0 -103
  50. package/dist/utils/SmartContractAbis.js.map +0 -1
  51. package/dist/utils/SmartContractService.js +0 -13
  52. package/dist/utils/SmartContractService.js.map +0 -1
  53. package/dist/utils/api.js +0 -79
  54. package/dist/utils/api.js.map +0 -1
  55. package/dist/utils/const.js +0 -17
  56. package/dist/utils/const.js.map +0 -1
  57. package/dist/utils/getActivity.js +0 -53
  58. package/dist/utils/getActivity.js.map +0 -1
  59. package/dist/utils/helpers.js +0 -27
  60. package/dist/utils/helpers.js.map +0 -1
  61. package/dist/utils/regex.js +0 -12
  62. package/dist/utils/regex.js.map +0 -1
  63. package/dist/utils/scCalls.js +0 -39
  64. package/dist/utils/scCalls.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */
7
+
8
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
+
10
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -1,5 +1,5 @@
1
1
  import { NftData } from '../types';
2
- import { CollectionsNFTsResponse, GetCollectionsArgs, ICollectionAttributes, ICollectionProfile, GetNFTsArgs, SearchNFTsResponse, SuggestNFTsArgs, SuggestResults, CollectionVolume, FloorPriceHistory, IOwners, ISingleHolder, GetGlobalOffersArgs, GlobalOffersResult, ListingDistribution, GetCollectionMintInfo, GetCollectionStatsArgs, CollectionStatsResults } from '../types/collection';
2
+ import { CollectionsNFTsResponse, GetCollectionsArgs, ICollectionAttributes, ICollectionProfile, GetNFTsArgs, SearchNFTsResponse, SuggestNFTsArgs, SuggestResults, CollectionVolume, FloorPriceHistory, IOwners, ISingleHolder, GetGlobalOffersArgs, GlobalOffersResult, ListingDistribution, GetCollectionMintInfo, GetCollectionStatsArgs, CollectionStatsResults, CollectionRanksExport } from '../types/collection';
3
3
  import { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
4
4
  /**
5
5
  * CollectionModule provides a set of methods to interact with NFT collections.
@@ -226,6 +226,18 @@ export declare class CollectionModule {
226
226
  ticker: string;
227
227
  extra?: RequestInit | undefined;
228
228
  }) => Promise<GetCollectionMintInfo>;
229
+ /**
230
+ * @public
231
+ * @async
232
+ * @function getCollectionRanks
233
+ * @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
234
+ * @returns {Promise<CollectionRanksExport[]>} A promise that resolves to a struct with information
235
+ * Finally, it returns a promise that resolves a struct with information
236
+ */
237
+ getCollectionRanks: ({ ticker, extra, }: {
238
+ ticker: string;
239
+ extra?: RequestInit | undefined;
240
+ }) => Promise<CollectionRanksExport[]>;
229
241
  /**
230
242
  * @public
231
243
  * @async
@@ -1,4 +1,4 @@
1
- import { AssetCategory, FungibleAssets, FungibleAssetsMap } from '../types/collection';
1
+ import { AssetCategory, FungibleAssetsMap } from '../types/collection';
2
2
  import { AshSwapPaymentData, TokenUSDPrices } from '../types/common';
3
3
  export declare class CommonModule {
4
4
  private api;
@@ -24,12 +24,4 @@ export declare class CommonModule {
24
24
  * This function fetches all branded fungible assets and their info
25
25
  */
26
26
  getFungibleTokens: (categories?: AssetCategory[], identifiers?: string[]) => Promise<FungibleAssetsMap>;
27
- /**
28
- * @public
29
- * @async
30
- * @function getFungibleToken
31
- * @returns {Promise<FungibleAssets>} A promise that resolves the ESDT token info
32
- * This function fetches the branded fungible asset info
33
- */
34
- getFungibleToken: (identifier: string) => Promise<FungibleAssets>;
35
27
  }
@@ -0,0 +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/sdk-js"]=e():t["@xoxno/sdk-js"]=e()}(this,(()=>(()=>{"use strict";var t,e={336:(t,e,i)=>{var a,o,r,n,s,l,c,d,g,h,u,f,p,T,y,m,w,S,q,k;i.r(e),i.d(e,{AssetCategory:()=>g,AuctionType:()=>m,Chain:()=>D,CollectionModule:()=>M,CollectionStatsOrderBy:()=>f,CollectionStatsSelectFields:()=>u,CollectionsFieldsToSelect:()=>c,CollectionsOrderBy:()=>s,CollectionsSummaryFilter:()=>h,CommonModule:()=>$,FieldsToSelect:()=>o,GlobalOfferFieldsToSelect:()=>d,GlobalOfferOrderBy:()=>l,IssuingType:()=>w,Marketplace:()=>a,NFTModule:()=>V,NftActivityType:()=>p,OfferType:()=>q,OrderByTradingActivity:()=>T,PoolType:()=>S,SearchOrderBy:()=>r,SelectFieldsTradingActivity:()=>y,StakingModule:()=>F,SuggestOrderBy:()=>n,Type:()=>k,UserModule:()=>N,XOXNOClient:()=>x}),function(t){t.XO="xoxno",t.FM="frameit",t.DR="deadrare",t.KG="krogan"}(a||(a={})),function(t){t.Rank="metadata.rarity.rank",t.Attributes="metadata.attributes",t.Description="metadata.description",t.Name="name",t.OnSale="onSale",t.SaleInfo="saleInfo",t.Royalties="royalties",t.Identifier="identifier",t.Collection="collection",t.OriginalURL="url",t.Nonce="nonce",t.ContentType="originalMedia.contentType",t.WasProcessed="wasProcessed",t.AvifURL="avifUrl",t.WebpURL="webpUrl",t.Type="type"}(o||(o={})),function(t){t.PriceHighToLow="saleInfo.minBidShort desc",t.PriceLowToHigh="saleInfo.minBidShort asc",t.MaxPriceHighToLow="saleInfo.maxBidShort desc",t.MaxPriceLowToHigh="saleInfo.maxBidShort asc",t.BidPriceHighToLow="saleInfo.currentBidShort desc",t.BidPriceLowToHigh="saleInfo.currentBidShort asc",t.RarityHighToLow="metadata.rarity.rank desc",t.RarityLowToHigh="metadata.rarity.rank asc",t.NonceHighToLow="nonce desc",t.NonceLowToHigh="nonce asc",t.RecentListed="saleInfo.timestamp desc",t.OldestListed="saleInfo.timestamp asc",t.EndingLate="saleInfo.deadline desc",t.EndingSoon="saleInfo.deadline asc"}(r||(r={})),function(t){t.TotalVolumeHighToLow="statistics/tradeData/totalEgldVolume desc",t.FollowersHighToLow="statistics/other/followCount desc",t.IsVerifiedTrueToFalse="isVerified desc",t.HasImageTrueToFalse="profile desc",t.HasBannerTrueToFalse="banner desc"}(n||(n={})),function(t){t.WeekVolumeHighToLow="statistics.tradeData.weekEgldVolume desc",t.WeekVolumeLowToHigh="statistics.tradeData.weekEgldVolume asc",t.DailyVolumeHighToLow="statistics.tradeData.dayEgldVolume desc",t.DailyVolumeLowToHigh="statistics.tradeData.dayEgldVolume asc",t.TotalVolumeHighToLow="statistics.tradeData.totalEgldVolume desc",t.TotalVolumeLowToHigh="statistics.tradeData.totalEgldVolume asc",t.AvgVolumePriceHighToLow="statistics.tradeData.averageEgldPrice desc",t.AvgVolumePriceLowToHigh="statistics.tradeData.averageEgldPrice asc",t.ATHHighToLow="statistics.tradeData.athEgldPrice desc",t.ATHLowToHigh="statistics.tradeData.athEgldPrice asc",t.TotalTradesHighToLow="statistics.tradeData.totalTrades desc",t.TotalTradesLowToHigh="statistics.tradeData.totalTrades asc",t.SupplyHighToLow="statistics.other.nftCount desc",t.SupplyLowToHigh="statistics.other.nftCount asc",t.FollowersHighToLow="statistics.other.followCount desc",t.FollowersLowToHigh="statistics.other.followCount asc"}(s||(s={})),function(t){t.PriceHighToLow="priceShort desc",t.PriceLowToHigh="priceShort asc",t.OfferIdHighToLow="offerIddesc",t.OfferIdLowToHigh="offerId asc",t.RecentListed="timestamp desc",t.OldestListed="timestamp asc"}(l||(l={})),function(t){t.Profile="profile",t.Description="description",t.Creator="creator",t.Owner="owner",t.Socials="socials",t.Type="type",t.HasStaking="hasStaking",t.Name="name",t.Banner="banner",t.IsVerified="isVerified",t.IsMintable="isMintable",t.Statistics="statistics",t.Collection="collection"}(c||(c={})),function(t){t.Attributes="attributes",t.Collection="collection",t.Marketplace="marketplace",t.PaymentToken="paymentToken",t.LongPrice="price",t.ShortPrice="priceShort"}(d||(d={})),function(t){t.ALL="all",t.Trade="trade",t.P2P="p2p",t.Staking="staking",t.Minting="minting"}(g||(g={})),function(t){t.TotalVolume="TotalVolume",t.TotalTrades="TotalTrades",t.DailyVolume="DailyVolume",t.Last2DaysVolume="Last2DaysVolume",t.DailyTrades="DailyTrades",t.Last2DaysTrades="Last2DaysTrades",t.WeekTrades="WeekTrades",t.LastWeekTrades="LastWeekTrades",t.WeekVolume="WeekVolume",t.LastWeekVolume="LastWeekVolume",t.WeeklyTradesMargin="WeeklyTradesMargin",t.DailyTradesMargin="DailyTradesMargin",t.WeeklyVolumeMargin="WeeklyVolumeMargin",t.DailyVolumeEgldMargin="DailyVolumeEgldMargin",t.CollectionAthTrade="CollectionAthTrade"}(h||(h={})),function(t){t.TradingStats="tradingStats"}(u||(u={})),function(t){t.ListedCountDesc="tradingStats.listedCount DESC",t.ListedCountAsc="tradingStats.listedCount ASC",t.FloorPriceDesc="tradingStats.floorPrice DESC",t.FloorPriceAsc="tradingStats.floorPrice ASC",t.TotalVolumeDesc="tradingStats.totalVolume DESC",t.TotalVolumeAsc="tradingStats.totalVolume ASC",t.TotalTradesDesc="tradingStats.totalTrades DESC",t.TotalTradesAsc="tradingStats.totalTrades ASC",t.AllTimeHighDesc="tradingStats.allTimeHigh.price DESC",t.AllTimeHighAsc="tradingStats.allTimeHigh.price ASC",t.DayVolumeDesc="tradingStats.day.volume DESC",t.DayVolumeAsc="tradingStats.day.volume ASC",t.DayVolumeMarginDesc="tradingStats.day.volumeMargin DESC",t.DayVolumeMarginAsc="tradingStats.day.volumeMargin ASC",t.DayTradesDesc="tradingStats.day.trades DESC",t.DayTradesAsc="tradingStats.day.trades ASC",t.DayTradesMarginDesc="tradingStats.day.tradesMargin DESC",t.DayTradesMarginAsc="tradingStats.day.tradesMargin ASC",t.WeekVolumeDesc="tradingStats.week.volume DESC",t.WeekVolumeAsc="tradingStats.week.volume ASC",t.WeekVolumeMarginDesc="tradingStats.week.volumeMargin DESC",t.WeekVolumeMarginAsc="tradingStats.week.volumeMargin ASC",t.WeekTradesDesc="tradingStats.week.trades DESC",t.WeekTradesAsc="tradingStats.week.trades ASC",t.WeekTradesMarginDesc="tradingStats.week.tradesMargin DESC",t.WeekTradesMarginAsc="tradingStats.week.tradesMargin ASC",t.MonthVolumeDesc="tradingStats.month.volume DESC",t.MonthVolumeAsc="tradingStats.month.volume ASC",t.MonthVolumeMarginDesc="tradingStats.month.volumeMargin DESC",t.MonthVolumeMarginAsc="tradingStats.month.volumeMargin ASC",t.MonthTradesDesc="tradingStats.month.trades DESC",t.MonthTradesAsc="tradingStats.month.trades ASC",t.MonthTradesMarginDesc="tradingStats.month.tradesMargin DESC",t.MonthTradesMarginAsc="tradingStats.month.tradesMargin ASC",t.YearVolumeDesc="tradingStats.year.volume DESC",t.YearVolumeAsc="tradingStats.year.volume ASC",t.YearVolumeMarginDesc="tradingStats.year.volumeMargin DESC",t.YearVolumeMarginAsc="tradingStats.year.volumeMargin ASC",t.YearTradesDesc="tradingStats.year.trades DESC",t.YearTradesAsc="tradingStats.year.trades ASC",t.YearTradesMarginDesc="tradingStats.year.tradesMargin DESC",t.YearTradesMarginAsc="tradingStats.year.tradesMargin ASC"}(f||(f={})),function(t){t.NFT_CREATE="nftCreate",t.NFT_BURN="nftBurn",t.NFT_UPDATE="nftUpdate",t.NFT_TRANSFER="nftTransfer",t.LISTING_CREATE="listingCreate",t.LISTING_WITHDRAW="listingWithdraw",t.LISTING_UPDATE="listingUpdate",t.AUCTION_BID="auctionBid",t.AUCTION_OUT_BID="auctionOutBid",t.OFFER_CREATE="offerCreate",t.OFFER_WITHDRAW="offerWithdraw",t.OFFER_REJECT="offerReject",t.GLOBAL_OFFER_CREATE="globalOfferCreate",t.GLOBAL_OFFER_WITHDRAW="globalOfferWithdraw",t.TRADE="trade",t.BULK_TRADE="bulkTrade",t.AUCTION_TRADE="auctionTrade",t.OTHER_TRADE="otherTrade",t.OFFER_TRADE="offerTrade",t.GLOBAL_OFFER_TRADE="globalOfferTrade",t.STAKE="stake",t.UN_STAKE="unStake"}(p||(p={})),function(t){t.PriceHighToLow="egldValue desc",t.PriceLowToHigh="egldValue asc",t.RankHighToLow="rank asc",t.RankLowToHigh="rank desc",t.RecentPlaced="timestamp desc",t.OldestPlaced="timestamp asc"}(T||(T={})),function(t){t[t.attributes=0]="attributes",t[t.collection=1]="collection",t[t.offer_id=2]="offer_id",t[t.owner=3]="owner",t[t.short_price=4]="short_price",t[t.price=5]="price",t[t.id=6]="id",t[t.dataType=7]="dataType",t[t.marketplace=8]="marketplace",t[t.payment_token=9]="payment_token"}(y||(y={})),function(t){t[t.NftBid=0]="NftBid",t[t.Nft=1]="Nft",t[t.SftAll=2]="SftAll",t[t.SftOnePerPayment=3]="SftOnePerPayment"}(m||(m={})),function(t){t.Dynamic="Dynamic",t.Fixed="Fixed"}(w||(w={})),function(t){t.Duo="Duo",t.Single="Single",t.Perk="Perk"}(S||(S={})),function(t){t.Received="received",t.Sent="sent"}(q||(q={})),function(t){t.NonFungibleESDT="NonFungibleESDT"}(k||(k={}));const v="https://api.xoxno.com",C="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",A="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",E="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var D;!function(t){t.MAINNET="1",t.DEVNET="D"}(D||(D={}));class x{static instance;apiUrl;apiKey;chain;config;constructor(t=v,e="",i=D.MAINNET){this.apiUrl=t,this.apiKey=e,this.chain=i,this.config=i===D.MAINNET?{XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:C,DR_SC:A,KG_SC:E,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{XO_SC:"erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3",FM_SC:C,DR_SC:A,KG_SC:E,Staking_SC:"erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8",Manager_SC:"erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn",P2P_SC:"erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2"}}static init({apiUrl:t=v,apiKey:e="",chain:i=D.MAINNET}={}){return x.instance||(i==D.DEVNET&&(x.instance=new x("https://api-dev.xoxno.com",e,i)),x.instance=new x(t,e,i)),x.instance}fetchWithTimeout=async(t,e={},i=4e4)=>{const a={"Accept-Encoding":"gzip,deflate,br",Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===e.method?{"Content-Type":"application/json"}:{},...e.headers??{}},o=`${"string"==typeof t&&t.startsWith("/")?`${this.apiUrl}${t}`:t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,r=new AbortController;setTimeout((()=>r.abort()),i);const n=await fetch(o,{...e,...e?.next&&e.next.revalidate?{}:{cache:"no-store"},signal:r.signal,...Object.keys(a).length?{headers:a}:{},method:e.method??"GET"});if(!n.ok)throw new Error((await n.json()).message.toString());return n.json()}}const O=async(t,e)=>{if(t.top&&t.top>35)throw new Error("Top cannot be greater than 35");const i={filters:{activityData:null==t.from&&null==t.to?{collection:t.collections,identifier:t.identifiers||void 0}:void 0,from:t.from,to:t.to,activityAddress:t.wallets||void 0,source:t.source||void 0,activityType:t.activityType||void 0},strictSelect:t.strictSelect,orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},a=Buffer.from(JSON.stringify(i)).toString("base64"),o=await e.fetchWithTimeout(`/activity/${a}/query`,{next:{tags:["getActivity"],revalidate:180}});return{...o,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===o.resources.length}},I=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),b=t=>/^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,5}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(t);class M{api;constructor(){this.api=x.init()}getCollectionProfile=async t=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/profile`,{next:{tags:["getCollectionProfile"],revalidate:30}})};getDailyTrending=async()=>await this.api.fetchWithTimeout("/nfts/getDailyTrending",{next:{tags:["getDailyTrending"],revalidate:180}});getCollectionFloorPrice=async(t,e="EGLD")=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);const i=await this.api.fetchWithTimeout(`/collection/${t}/floor-price`,{next:{tags:["getCollectionFloorPrice"]},params:{token:e}});return i?.price?i.price:0};getCollectionAttributes=async t=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/attributes`,{next:{tags:["getCollectionAttributes"],revalidate:180}})};getNFTs=async t=>{if(t?.collections?.forEach((t=>{if(!I(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>35)throw new Error("Top cannot be greater than 35");const e=[];t.priceRange&&e.push({...t.priceRange,field:t.onlyAuctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"}),t.rankRange&&e.push({...t.rankRange,field:"metadata.rarity.rank"});const i={filters:{dataType:t.dataType??["nft"],activeAuction:t.onlyAuctions||t.activeAuctions,collection:t.collections??[],onSale:t.onlyOnSale,saleInfo:{seller:t.listedBy||[],marketplace:t.listedOnlyOn||void 0,paymentToken:t.listedInToken||[],auctionType:t.onlyOnSale?t.onlyAuctions?["NftBid","SftAll"]:["Nft","SftOnePerPayment"]:void 0},owner:t.ownedBy||[],verifiedOnly:t.onlyVerified||!1,metadata:{attributes:t.attributes||void 0},range:e,cp_staked:t.isStaked||void 0},applyNftExtraDetails:t.applyNftExtraDetails||!0,orderBy:t.orderBy||[],select:t.onlySelectFields||[],includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0},a=Buffer.from(JSON.stringify(i)).toString("base64");return{...await this.api.fetchWithTimeout(`/nft/${a}/query`,{next:{tags:["getCollectionNFTs"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};suggestResults=async t=>{if(t.top&&t.top>35)throw new Error("Top cannot be greater than 35");if(!t.name)throw new Error("Name is required");const e={name:t.name,orderBy:t.orderBy||[n.TotalVolumeHighToLow,n.FollowersHighToLow,n.IsVerifiedTrueToFalse,n.HasImageTrueToFalse],top:t.top||35,skip:t.skip||0},i=Buffer.from(JSON.stringify(e)).toString("base64");return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/search/${i}`,{next:{tags:["suggestResults"],revalidate:180}})};collectionListings=async t=>await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/listingDistribution/${t}`,{next:{tags:["collectionListings"],revalidate:180}});getTradingActivity=async t=>await O(t,this.api);getCollections=async t=>{if(t?.top&&t.top>25)throw new Error("Top cannot be greater than 25");const e={skip:t?.skip||0,top:t?.top||25,select:t?.onlySelectFields||[],filters:{dataType:"collectionProfile",isMintable:t?.onlyMintable||void 0,...t?.collections&&t.collections.length>0&&{collection:t.collections}},orderBy:[t?.orderBy||"statistics.tradeData.weekEgldVolume desc"]},i=Buffer.from(JSON.stringify(e)).toString("base64"),a=await this.api.fetchWithTimeout(`/collection/${i}/query`,{next:{tags:["getCollections"],revalidate:180}});return{results:a,resultsCount:a.length,empty:0===a.length,getNextPagePayload:{...t,skip:(t?.skip||0)+(t?.top||25)},hasMoreResults:a.length>=(t?.top||25)}};getGlobalOffers=async t=>{if(t?.top&&t.top>25)throw new Error("Top cannot be greater than 25");const e={skip:t?.skip||0,top:t?.top||25,select:t?.onlySelectFields||[],filters:{collection:t?.collections||[],withAttributes:t?.withAttributes??!1,isActive:t?.onlyActive??!0,offerId:t?.offerIds,owner:t?.ownedBy,marketplace:t?.listedOnlyOn,range:t?.priceRange?{...t.priceRange,type:"priceShort"}:void 0,attributes:t?.attributes},orderBy:[t?.orderBy||l.PriceHighToLow]},i=Buffer.from(JSON.stringify(e)).toString("base64"),a=await this.api.fetchWithTimeout(`/collection/${i}/global-offer/query`,{next:{tags:["getGlobalOffers"],revalidate:12}});return{...a,getNextPagePayload:{...t,skip:(t?.top||25)+a.lastSkip}}};getCollectionVolume=async(t,e,i,a)=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getCollectionVolume/${t}?after=${e}&before=${i}&bin=${a}`,{next:{tags:["getCollectionVolume"],revalidate:180}})};getMarketplaceVolume=async(t,e,i)=>await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getMarketplaceVolume?after=${t}&before=${e}&bin=${i}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});getCollectionFloor=async(t,e,i,a)=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getCollectionFloor/${t}?after=${e}&before=${i}&bin=${a}`,{next:{tags:["getCollectionFloor"],revalidate:180}})};getCollectionOwners=async t=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/holders`,{next:{tags:["getCollectionOwners"],revalidate:500}})};getExportOwners=async t=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/holders?exportHolders=true`,{next:{tags:["getExportOwners"]}})};getCollectionsStatistics=async t=>{if(t?.top&&t.top>25)throw new Error("Top cannot be greater than 25");const e=Buffer.from(JSON.stringify(t)).toString("base64");return{...await this.api.fetchWithTimeout(`/collection/${e}/stats/query`,{next:{tags:["collectionStatistics"],revalidate:12}}),getNextPagePayload:{...t,skip:t.skip+t.top}}};getCollectionMintInfo=async({ticker:t,extra:e})=>await this.api.fetchWithTimeout(`/collection/${t}/drop-info`,{next:{tags:["getCollectionMintInfo"],revalidate:12},...e});getCollectionRanks=async({ticker:t,extra:e})=>await this.api.fetchWithTimeout(`/collection/${t}/ranks`,{next:{tags:["getCollectionRanks"],revalidate:60},...e});getDropInfo=async({collectionTag:t,creatorTag:e,extra:i})=>await this.api.fetchWithTimeout(`/collection/${e}/${t}/drop-info`,{next:{tags:["getDropInfo"],revalidate:12},...i})}var W=i(236);const L=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),e},P=t=>{try{return new W.Address(t),t.includes("erd1")}catch(t){return!1}};class V{api;constructor(){this.api=x.init()}getNFTByIdentifier=async t=>{if(!b(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}`)};getNFTsOffers=async(t,e=0,i=25)=>{if(!b(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}/offers?skip=${e}&top=${i}`,{next:{tags:["getNFTsOffers"],revalidate:12}})};getNFTByCollectionAndNonce=async(t,e)=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);const i=await this.api.fetchWithTimeout(`/${((t,e)=>[t,L(e)].join("-"))(t,e)}`);return i};getNFTByCollectionAndNonceHex=async(t,e)=>{if(!I(t))throw new Error("Invalid collection ticker: "+t);e.length%2!=0&&(e="0"+e);return await this.api.fetchWithTimeout(`/${[t,e].join("-")}`)};getTradingActivity=async t=>await O(t,this.api)}class N{api;collection;constructor(){this.api=x.init(),this.collection=new M}getUserProfile=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/profile`)};getBulkAccounts=async t=>await this.api.fetchWithTimeout("https://proxy-api.xoxno.com/address/bulk",{method:"POST",body:JSON.stringify(t)});getUserAccount=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/accounts/${t}`)};getUserSummaryInventory=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/inventory-summary`)};getUserNFTs=async t=>await this.collection.getNFTs(t);getUserOffers=async t=>{if(!P(t.address))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/user/${t.address}/offers?type=${t.type}&skip=${t.skip}&top=${t.top}`)};getTradingActivity=async t=>await O(t,this.api);getUserStakingTickerInfoGrouped=async(t,e)=>{if(!P(t))throw new Error("Invalid address");if(!I(e))throw new Error("Invalid ticker");return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getUserStakingInfo/${t}?groupByTicker=true&ticker=${e}`)};getUserCreatorProfile=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/profile`)};getCreatorListings=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/listing`)};getUserStakingSummary=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/summary`)};getUserStakingAailable=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/available-pools`)};getUserCreatorInfo=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/details`)};getUserCollectionStaking=async(t,e)=>{if(!P(t))throw new Error("Invalid address");if(!I(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/user/${t}/staking/collection/${e}`)};getUserPoolStaking=async(t,e)=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}`)};getAvailableNFTsForStakingPool=async(t,e)=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}/nfts`)};getOwnedPoolsByAddress=async t=>{if(!P(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-pools`)}}class F{api;constructor(){this.api=x.init()}getPoolDetails=async t=>await this.api.fetchWithTimeout(`/pool/${t}/profile`)}class ${api;constructor(){this.api=x.init()}getTokensUsdPrice=async()=>await this.api.fetchWithTimeout("/tokens/usd-price");getAshSwapAmount=async({originalToken:t,originalTokenValue:e,paymentToken:i})=>await this.api.fetchWithTimeout("/ash/min-token-quantity",{params:{originalToken:t,originalTokenValue:e,paymentToken:i}});getFungibleTokens=async(t=[g.ALL],e)=>await this.api.fetchWithTimeout("/tokens",{params:{identifiers:e?e.join(","):void 0,category:t?t.join(","):void 0},next:{tags:["getFungibleTokens"],revalidate:500}})}}},i={};function a(t){var o=i[t];if(void 0!==o)return o.exports;var r=i[t]={exports:{}};return e[t].call(r.exports,r,r.exports,a),r.exports}a.m=e,t=[],a.O=(e,i,o,r)=>{if(!i){var n=1/0;for(d=0;d<t.length;d++){for(var[i,o,r]=t[d],s=!0,l=0;l<i.length;l++)(!1&r||n>=r)&&Object.keys(a.O).every((t=>a.O[t](i[l])))?i.splice(l--,1):(s=!1,r<n&&(n=r));if(s){t.splice(d--,1);var c=o();void 0!==c&&(e=c)}}return e}r=r||0;for(var d=t.length;d>0&&t[d-1][2]>r;d--)t[d]=t[d-1];t[d]=[i,o,r]},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={57:0};a.O.j=e=>0===t[e];var e=(e,i)=>{var o,r,[n,s,l]=i,c=0;if(n.some((e=>0!==t[e]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(l)var d=l(a)}for(e&&e(i);c<n.length;c++)r=n[c],a.o(t,r)&&t[r]&&t[r][0](),t[r]=0;return a.O(d)},i=this.webpackChunk_xoxno_sdk_js=this.webpackChunk_xoxno_sdk_js||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})();var o=a.O(void 0,[236],(()=>a(336)));return o=a.O(o)})()));
package/dist/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from './types';
2
2
  export * from './collection';
3
- export * from './launchpad';
4
- export * from './interactions';
5
3
  export * from './nft';
6
4
  export * from './users';
7
5
  export * from './staking';
@@ -0,0 +1 @@
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)})()));
@@ -0,0 +1 @@
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)})()));
@@ -0,0 +1 @@
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))})()})();
@@ -585,6 +585,9 @@ export type GlobalOfferOwner = {
585
585
  userName: string;
586
586
  profile: string;
587
587
  };
588
+ export type CollectionRanksExport = Partial<Pick<NftData, 'identifier' | 'name'>> & {
589
+ rank: number;
590
+ };
588
591
  export type GetCollectionMintInfo = {
589
592
  collection: string;
590
593
  contractAddress: string;
@@ -2,3 +2,6 @@ export * from './collection';
2
2
  export * from './nft';
3
3
  export * from './trading';
4
4
  export * from './interactions';
5
+ export * from './staking';
6
+ export * from './user';
7
+ export * from './common';
@@ -1,26 +1,42 @@
1
1
  import { Marketplace, MetadataAttribute, TradingActivity } from './collection';
2
+ export declare enum NftActivityType {
3
+ NFT_CREATE = "nftCreate",
4
+ NFT_BURN = "nftBurn",
5
+ NFT_UPDATE = "nftUpdate",
6
+ NFT_TRANSFER = "nftTransfer",
7
+ LISTING_CREATE = "listingCreate",
8
+ LISTING_WITHDRAW = "listingWithdraw",
9
+ LISTING_UPDATE = "listingUpdate",
10
+ AUCTION_BID = "auctionBid",
11
+ AUCTION_OUT_BID = "auctionOutBid",
12
+ OFFER_CREATE = "offerCreate",
13
+ OFFER_WITHDRAW = "offerWithdraw",
14
+ OFFER_REJECT = "offerReject",
15
+ GLOBAL_OFFER_CREATE = "globalOfferCreate",
16
+ GLOBAL_OFFER_WITHDRAW = "globalOfferWithdraw",
17
+ TRADE = "trade",
18
+ BULK_TRADE = "bulkTrade",
19
+ AUCTION_TRADE = "auctionTrade",
20
+ OTHER_TRADE = "otherTrade",// fiat or binance buy
21
+ OFFER_TRADE = "offerTrade",
22
+ GLOBAL_OFFER_TRADE = "globalOfferTrade",
23
+ STAKE = "stake",
24
+ UN_STAKE = "unStake"
25
+ }
2
26
  export interface TradingActivityQueryFilter {
3
27
  filters: {
4
- collection?: string[];
5
- identifier?: string[];
6
- address?: string[];
7
- tokens?: string[];
8
- marketplace?: Marketplace[];
9
- action?: string[];
10
- range?: {
11
- min: number;
12
- max: number;
13
- };
14
- rankRange?: {
15
- min: number;
16
- max: number;
17
- };
18
- timestampRange?: {
19
- min: number;
20
- max: number;
28
+ txHash?: string[];
29
+ activityAddress?: string[];
30
+ source?: Marketplace[];
31
+ activityType?: NftActivityType[];
32
+ from?: string[];
33
+ to?: string[];
34
+ activityData?: {
35
+ collection?: string[];
36
+ identifier?: string[];
21
37
  };
22
- attributes?: MetadataAttribute[];
23
38
  };
39
+ strictSelect?: boolean;
24
40
  top: number;
25
41
  skip: number;
26
42
  select?: SelectFieldsTradingActivity[];
@@ -33,8 +49,11 @@ export interface TradincActivityArgs {
33
49
  identifiers?: string[];
34
50
  /** The wallets for which to fetch the trading activity */
35
51
  wallets?: string[];
52
+ from?: string[];
53
+ to?: string[];
36
54
  /** The marketplaces to fetch the trading activity from */
37
- marketplaces?: Marketplace[];
55
+ source?: Marketplace[];
56
+ activityType?: NftActivityType[];
38
57
  /** The tokens to fetch the trading activity from */
39
58
  placedInToken?: string[];
40
59
  /** The price range to fetch the trading activity from */
@@ -60,6 +79,7 @@ export interface TradincActivityArgs {
60
79
  actions?: string[];
61
80
  /** The fields to select from the trading activity */
62
81
  select?: SelectFieldsTradingActivity[];
82
+ strictSelect?: boolean;
63
83
  /** The fields to order the trading activity by */
64
84
  orderBy?: OrderByTradingActivity[];
65
85
  /** The attributes to fetch the trading activity from */
@@ -1,5 +1,6 @@
1
- import { MetadataAttribute } from './collection';
1
+ import { ISocials } from './collection';
2
2
  import { NftData, Owner } from './nft';
3
+ import { UnClaimedReward } from './staking';
3
4
  export interface BulkAccount {
4
5
  address: string;
5
6
  nonce: number;
@@ -38,15 +39,6 @@ export interface UserDeposit {
38
39
  paymentToken: string;
39
40
  paymentTokenNonce: number;
40
41
  }
41
- export interface ISocials {
42
- twitter?: string;
43
- instagram?: string;
44
- website?: string;
45
- telegram?: string;
46
- discord?: string;
47
- facebook?: string;
48
- youtube?: string;
49
- }
50
42
  export interface UserInventory {
51
43
  collection: string;
52
44
  inventoryCount: number;
@@ -69,24 +61,6 @@ export interface ArgsUserOffers {
69
61
  skip: number;
70
62
  top: number;
71
63
  }
72
- export interface GlobalOffer {
73
- dataType: string;
74
- offer_id: number;
75
- collection: string;
76
- quantity: number;
77
- payment_token: string;
78
- payment_nonce: number;
79
- price: string;
80
- short_price: number;
81
- owner: string;
82
- marketplace: string;
83
- timestamp: number;
84
- attributes: MetadataAttribute[];
85
- id: string;
86
- uniqueKey: string;
87
- _ts: number;
88
- isActive: boolean;
89
- }
90
64
  export declare enum OfferType {
91
65
  Received = "received",
92
66
  Sent = "sent"
@@ -136,11 +110,6 @@ export type TickerElement = {
136
110
  ticker: string;
137
111
  name: string;
138
112
  };
139
- export type UnClaimedReward = {
140
- reward_token: string;
141
- reward_token_nonce: string;
142
- amount: number;
143
- };
144
113
  export type UserAccountInfo = {
145
114
  address: string;
146
115
  nonce: number;
@@ -1,4 +1,4 @@
1
- import { IChainID } from '@multiversx/sdk-core/out/interface';
1
+ import type { IChainID } from '@multiversx/sdk-core/out/interface';
2
2
  export declare enum Chain {
3
3
  MAINNET = "1",
4
4
  DEVNET = "D"
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@xoxno/sdk-js",
3
- "version": "0.1.54-alpha",
3
+ "version": "0.1.56-alpha",
4
4
  "description": "The SDK to interact with the XOXNO Protocol!",
5
- "main": "./dist/index.js",
5
+ "main": "./dist/index.bundle.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "sideEffects": false,
8
8
  "scripts": {
9
9
  "test": "jest",
10
- "build": "tsc -p tsconfig.json",
10
+ "build": "webpack --config webpack.config.js",
11
11
  "lint": "eslint 'src/**/*.ts' --fix",
12
12
  "format": "prettier --write 'src/**/*.ts'",
13
13
  "commit": "git-cz",
@@ -49,9 +49,9 @@
49
49
  "@semantic-release/changelog": "^6.0.3",
50
50
  "@semantic-release/git": "^10.0.1",
51
51
  "@types/jest": "^29.5.12",
52
- "@types/node": "^20.11.23",
53
- "@typescript-eslint/eslint-plugin": "^7.1.0",
54
- "@typescript-eslint/parser": "^7.1.0",
52
+ "@types/node": "^20.11.24",
53
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
54
+ "@typescript-eslint/parser": "^7.1.1",
55
55
  "commitizen": "^4.3.0",
56
56
  "cz-conventional-changelog": "^3.3.0",
57
57
  "eslint": "^8.57.0",
@@ -61,10 +61,13 @@
61
61
  "jest": "^29.7.0",
62
62
  "prettier": "^3.2.5",
63
63
  "semantic-release": "^23.0.2",
64
+ "terser-webpack-plugin": "^5.3.10",
64
65
  "ts-jest": "^29.1.2",
65
66
  "ts-loader": "^9.5.1",
66
- "typedoc": "^0.25.9",
67
- "typescript": "^5.3.3"
67
+ "typedoc": "^0.25.10",
68
+ "typescript": "^5.3.3",
69
+ "webpack": "^5.90.3",
70
+ "webpack-cli": "^5.1.4"
68
71
  },
69
72
  "dependencies": {
70
73
  "@multiversx/sdk-core": "^12.19.0",