@xoxno/sdk-js 0.1.118-alpha → 0.1.119-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.
|
@@ -62,7 +62,7 @@ export declare class CollectionModule {
|
|
|
62
62
|
* Searches for NFTs based on the provided arguments.
|
|
63
63
|
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
|
|
64
64
|
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
|
|
65
|
-
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than
|
|
65
|
+
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
|
|
66
66
|
*/
|
|
67
67
|
getNFTs: (args: GetNFTsArgs) => Promise<SearchNFTsResponse>;
|
|
68
68
|
/**
|
|
@@ -74,7 +74,7 @@ export declare class CollectionModule {
|
|
|
74
74
|
*
|
|
75
75
|
* This function fetches suggested collections results based on the provided arguments. It takes an object with the following properties:
|
|
76
76
|
* - name (string): The name to search for (required).
|
|
77
|
-
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than
|
|
77
|
+
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 100).
|
|
78
78
|
* - skip (number, optional): The number of results to skip (default is 0).
|
|
79
79
|
*
|
|
80
80
|
* Finally, it returns a promise that resolves to the fetched collections results.
|
|
@@ -93,21 +93,21 @@ export declare class CollectionModule {
|
|
|
93
93
|
*
|
|
94
94
|
* @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
|
|
95
95
|
* @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
|
|
96
|
-
* @throws {Error} Throws an error if the 'top' argument is greater than
|
|
96
|
+
* @throws {Error} Throws an error if the 'top' argument is greater than 100.
|
|
97
97
|
*/
|
|
98
98
|
getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
|
|
99
99
|
/**
|
|
100
100
|
* Fetch collections profiles based on the provided arguments.
|
|
101
101
|
* @param {GetCollectionsArgs} args - The GetCollectionsArgs object containing the search parameters.
|
|
102
102
|
* @returns {Promise<CollectionsNFTsResponse>} A Promise that resolves to the CollectionsNFTsResponse object.
|
|
103
|
-
* @throws An error if the 'top' value is greater than
|
|
103
|
+
* @throws An error if the 'top' value is greater than 100.
|
|
104
104
|
*/
|
|
105
105
|
getCollections: (args?: GetCollectionsArgs) => Promise<CollectionsNFTsResponse>;
|
|
106
106
|
/**
|
|
107
107
|
* Fetch global offers based on the provided arguments.
|
|
108
108
|
* @param {GetGlobalOffersArgs} args - The GetCollectionsArgs object containing the search parameters.
|
|
109
109
|
* @returns {Promise<GlobalOffersResult>} A Promise that resolves to the GlobalOffersResult object.
|
|
110
|
-
* @throws An error if the 'top' value is greater than
|
|
110
|
+
* @throws An error if the 'top' value is greater than 100.
|
|
111
111
|
*/
|
|
112
112
|
getGlobalOffers: (args?: GetGlobalOffersArgs) => Promise<GlobalOffersResult>;
|
|
113
113
|
/**
|
|
@@ -258,7 +258,7 @@ export declare class CollectionModule {
|
|
|
258
258
|
* Get drops based on the provided arguments.
|
|
259
259
|
* @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
|
|
260
260
|
* @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
|
|
261
|
-
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than
|
|
261
|
+
* @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 100.
|
|
262
262
|
*/
|
|
263
263
|
getDrops: (args: GETDropsArgs) => Promise<GetDropsResponse>;
|
|
264
264
|
/** Gets collection staking info
|
package/dist/common/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class CommonModule {
|
|
|
51
51
|
* This function fetches suggested NFT results based on the provided arguments. It takes an object with the following properties:
|
|
52
52
|
* - name (string): The name to search for (required).
|
|
53
53
|
* - orderBy (SuggestOrderBy[], optional): An array of ordering preferences for the results.
|
|
54
|
-
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than
|
|
54
|
+
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 100).
|
|
55
55
|
* - skip (number, optional): The number of results to skip (default is 0).
|
|
56
56
|
*
|
|
57
57
|
* The function first validates the input arguments and constructs a payload body with the provided parameters.
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e,a,i,r,o,n,s,c,l,d,g,h,u,p,f,y,m,T,w,S,k,q,v={d:(t,e)=>{for(var a in e)v.o(e,a)&&!v.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},E={};v.d(E,{$C:()=>d,Yo:()=>m,LU:()=>l,sW:()=>W,X$:()=>L,JA:()=>u,he:()=>h,cO:()=>s,t7:()=>o,iQ:()=>g,MD:()=>R,Gq:()=>i,h4:()=>e,wT:()=>c,JM:()=>n,Vx:()=>T,O8:()=>t,s0:()=>$,o:()=>p,p4:()=>k,AQ:()=>f,J1:()=>w,g6:()=>a,cB:()=>y,Gt:()=>F,iE:()=>S,I_:()=>r,ZU:()=>q,Us:()=>b,GW:()=>x}),function(t){t.XO="xoxno",t.FM="frameit",t.DR="deadrare",t.KG="krogan"}(t||(t={})),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"}(e||(e={})),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"}(a||(a={})),function(t){t.EndingLate="startTime desc",t.EndingSoon="startTime asc"}(i||(i={})),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"}(r||(r={})),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"}(o||(o={})),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"}(n||(n={})),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"}(s||(s={})),function(t){t.Attributes="attributes",t.Collection="collection",t.Marketplace="marketplace",t.PaymentToken="paymentToken",t.LongPrice="price",t.ShortPrice="priceShort"}(c||(c={})),function(t){t.FixedPrice="FixedPrice",t.Auctions="Auctions",t.All="All",t.AllListed="AllListed"}(l||(l={})),function(t){t.ALL="all",t.Trade="trade",t.P2P="p2p",t.Staking="staking",t.Minting="minting"}(d||(d={})),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"}(g||(g={})),function(t){t.TradingStats="tradingStats"}(h||(h={})),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"}(u||(u={})),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="activityData.egldValue desc",t.PriceLowToHigh="activityData.egldValue asc",t.RecentPlaced="timestamp desc",t.OldestPlaced="timestamp asc"}(f||(f={})),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"}(T||(T={})),function(t){t.Duo="Duo",t.Single="Single",t.Perk="Perk"}(w||(w={})),function(t){t.Staked="staked",t.Unbounding="unStaked",t.Available="available"}(S||(S={})),function(t){t.Received="received",t.Placed="placed"}(k||(k={})),function(t){t.NonFungibleESDT="NonFungibleESDT"}(q||(q={}));const C="https://api.xoxno.com",A="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",D="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",I="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var W;!function(t){t.MAINNET="1",t.DEVNET="D"}(W||(W={}));class x{static instance;apiUrl;apiKey;chain;config;constructor(t=C,e="",a){this.apiUrl=t,this.apiKey=e,this.chain=a,this.config=a==W.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:A,DR_SC:D,KG_SC:I,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:A,DR_SC:D,KG_SC:I,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}static init({apiUrl:t=C,apiKey:e="",chain:a=W.MAINNET}={}){if(null==x.instance||null==x.instance){if(a==W.DEVNET)return x.instance=new x(t??"https://devnet-api.xoxno.com",e,a),x.instance;x.instance=new x(t,e,a)}return x.instance}static getInstance(){if(null==x.instance||null==x.instance)throw new Error("XOXNOClient is not initialized");return x.instance}fetchWithTimeout=async(t,e={},a=4e4)=>{const i={"Accept-Encoding":"gzip,deflate,br",Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===e.method?{"Content-Type":"application/json"}:{},...e.headers??{}},r=`${"string"==typeof t&&t.startsWith("/")?`${this.apiUrl}${t}`:t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,o=new AbortController;setTimeout((()=>o.abort()),a);const n=await fetch(r,{...e,...e?.next&&e.next.revalidate?{}:{cache:"no-store"},signal:o.signal,...Object.keys(i).length?{headers:i}:{},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>100)throw new Error("Top cannot be greater than 35");const a=[];t.priceRange&&a.push({...t.priceRange,field:"activityData.egldValue"}),t.timestampRange&&a.push({...t.timestampRange,field:"timestamp"});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,range:a},strictSelect:t.strictSelect,includeCount:t.includeCount||!1,orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},r=await e.fetchWithTimeout("/activity/query",{params:{filter:JSON.stringify(i)},next:{tags:["getActivity"],revalidate:180}});return{...r,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===r.resources.length}},P=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),M=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 L{api;constructor(){this.api=x.getInstance()}getCollectionProfile=async t=>{if(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t);const a=await this.api.fetchWithTimeout(`/collection/${t}/floor-price`,{next:{tags:["getCollectionFloorPrice"]},params:{token:e}});return a?.price?a.price:0};getCollectionAttributes=async t=>{if(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e=[];t.priceRange&&e.push({...t.priceRange,field:t.auctionType==l.Auctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"}),t.rankRange&&e.push({...t.rankRange,field:"metadata.rarity.rank"});const a={filters:{dataType:t.dataType??["nft"],activeAuction:t.activeAuctions,collection:t.collections??[],onSale:t.onlyOnSale,saleInfo:{seller:t.listedBy||[],marketplace:t.listedOnlyOn||void 0,paymentToken:t.listedInToken||[],auctionType:t.auctionType==l.Auctions?["NftBid","SftAll"]:t.auctionType==l.FixedPrice?["Nft","SftOnePerPayment"]:t.auctionType==l.AllListed?["NftBid","SftAll","Nft","SftOnePerPayment"]:void 0},owner:t.ownedBy||[],verifiedOnly:t.onlyVerified||!1,metadata:{attributes:t.attributes||void 0},range:e,nonce:t.nonces||void 0,cp_staked:t.isStaked??void 0},applyNftExtraDetails:t.applyNftExtraDetails,orderBy:t.orderBy||[],select:t.onlySelectFields||[],strictSelect:t.strictSelect||!1,includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/nft/query",{params:{filter:JSON.stringify(a)},next:{tags:["getCollectionNFTs"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};suggestCollections=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/collection/search",{params:{filter:JSON.stringify(e)},next:{tags:["/collection/search"],revalidate:180}})};collectionListingsAnalytics=async t=>await this.api.fetchWithTimeout(`/collection/${t}/listings`,{next:{tags:["collection/${ticker}/listings"],revalidate:500}});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"]},a=await this.api.fetchWithTimeout("/collection/query",{params:{filter:JSON.stringify(e)},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||n.PriceHighToLow]},a=await this.api.fetchWithTimeout("/collection/global-offer/query",{params:{filter:JSON.stringify(e)},next:{tags:["getGlobalOffers"],revalidate:12}});return{...a,getNextPagePayload:{...t,skip:(t?.top||25)+a.lastSkip}}};getCollectionVolume=async(t,e,a,i)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume?startTime=${e}&endTime=${a}&bin=${i}`,{next:{tags:["getCollectionVolume"],revalidate:180}})};getMarketplaceVolume=async(t,e,a)=>await this.api.fetchWithTimeout(`/analytics/volume?startTime=${t}&endTime=${e}&bin=${a}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});getCollectionOwners=async t=>{if(!P(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(!P(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");return{...await this.api.fetchWithTimeout("/collection/stats/query",{params:{filter:JSON.stringify(t)},next:{tags:["collectionStatistics"],revalidate:12}}),getNextPagePayload:{...t,skip:t.skip+t.top}}};getCollectionStats=async t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/stats`,{next:{tags:["collectionStatistics"],revalidate:12}})};getAwaitEmpty=async t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)}));getCollectionMintInfo=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/drop-info`,{next:{tags:[`/collection/${t}/drop-info`],revalidate:12},...e})};getCollectionRanks=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/ranks`,{next:{tags:[`/collection/${t}/ranks`],revalidate:60},...e})};getDropInfo=async({collectionTag:t,creatorTag:e,extra:a})=>await this.api.fetchWithTimeout(`/collection/${e}/${t}/drop-info`,{next:{tags:[`/collection/${e}/${t}/drop-info`],revalidate:12},...a});getCollectionGraphData=async(t,e,a,i)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume`,{params:{startTime:e,endTime:a,bin:i},next:{tags:[`/collection/${t}/analytics/volume`],revalidate:60}})};getPinnedCollections=async()=>await this.api.fetchWithTimeout("/collection/pinned",{next:{tags:["/collection/pinned"],revalidate:60}});getDrops=async t=>{if(t?.collections?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.timeRange&&e.push({...t.timeRange,field:"startTime"});const a={filters:{collection:t.collections??[],verifiedOnly:t.onlyVerified||!1,mintToken:t.listedInToken||void 0,range:e},orderBy:t.orderBy||[],select:t.onlySelectFields||[],includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/collection/drops/query",{params:{filter:JSON.stringify(a)},next:{tags:["/collection/drops/query"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};getCollectionStakingSummary=async({collection:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/staking/summary`,{...e})};getCollectionsFloor=async t=>{t?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)}));return await this.api.fetchWithTimeout("/collection/floor-price",{params:{collection:t.join(",")}})}}const N=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),e},V=t=>{try{return t.includes("erd1")}catch(t){return!1}};class ${api;constructor(){this.api=x.getInstance()}getNFTByIdentifier=async t=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}`)};getNFTsOffers=async(t,e=0,a=25)=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}/offers?skip=${e}&top=${a}`,{next:{tags:["getNFTsOffers"],revalidate:12}})};getNFTByCollectionAndNonce=async(t,e)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);const a=await this.api.fetchWithTimeout(`/${((t,e)=>[t,N(e)].join("-"))(t,e)}`);return a};getNFTByCollectionAndNonceHex=async(t,e)=>{if(!P(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 b{api;collection;constructor(){this.api=x.getInstance(),this.collection=new L}getUserProfile=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/profile`)};getBulkAccounts=async t=>await this.api.fetchWithTimeout("/user/network-account",{method:"POST",body:JSON.stringify(t)});getUserAccount=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/network-account`)};getUserTokenInventory=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/token-inventory`)};getUserSummaryInventory=async t=>{if(!V(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(!V(t.address))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t.address}/offers`,{params:{type:t.type,skip:t.skip,top:t.top}})};suggestUsers=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/user/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getTradingActivity=async t=>await O(t,this.api);getUserCreatorProfile=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/profile`)};getCreatorListings=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/listing`)};getUserStakingSummary=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/summary`)};getUserStakingAailable=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/available-pools`)};getUserCreatorInfo=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/details`)};getUserCollectionStaking=async(t,e)=>{if(!V(t))throw new Error("Invalid address");if(!P(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/user/${t}/staking/collection/${e}`)};getUserPoolStaking=async(t,e,a)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}/nfts?status=${a}`)};getOwnedPoolsByAddress=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-pools`)};getUserAnalyticsSummary=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/analytics/volume`)};getUserFavoriteNFTs=async(t,e,a)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/nfts`,{params:{top:e,skip:a}})};getUserFavoriteCollectionTickers=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/collections`)};getIsCreatorRegistered=async t=>await this.api.fetchWithTimeout(`/user/${t}/creator/is-registered`);getUsersStats=async({top:t,skip:e,orderBy:a})=>{if(t&&t>35)throw new Error("Top cannot be greater than 35");return await this.api.fetchWithTimeout("/user/stats",{params:{top:t,skip:e,orderBy:a??"totalVolume"},next:{tags:["/user/stats"],revalidate:180}})};getStakingCreatorInfo=async t=>await this.api.fetchWithTimeout(`/user/${t}/staking/creator`,{next:{tags:[`/user/${t}/staking/creator`],revalidate:30}});getUsersDrop=async({top:t,skip:e,address:a})=>{if(t&&t>35)throw new Error("Top cannot be greater than 35");if(a&&!V(a))throw new Error("Invalid address");return await this.api.fetchWithTimeout("/user/xoxno-drop",{params:{top:t,skip:e,...a?{address:a}:{}},next:{tags:["/user/xoxno-drop"],revalidate:30}})};getUserOwnerCollections=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-collections`)};getRoyaltiesSharesCreator=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/royalties`)};getMintSharesCreator=async(t,e)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/collection/${e}`)}}class F{api;constructor(){this.api=x.getInstance()}getPoolDetails=async t=>await this.api.fetchWithTimeout(`/pool/${t}/profile`)}class R{api;constructor(){this.api=x.getInstance()}getTokensUsdPrice=async()=>await this.api.fetchWithTimeout("/tokens/usd-price");getAshSwapAmount=async({originalToken:t,originalTokenValue:e,paymentToken:a})=>await this.api.fetchWithTimeout("/ash/min-token-quantity",{params:{originalToken:t,originalTokenValue:e,paymentToken:a}});getFungibleTokens=async(t=[d.ALL],e)=>{let a={};e&&(a={identifier:e.join(",")}),t&&(a={...a,category:t.join(",")});return await this.api.fetchWithTimeout("/tokens",{params:a})};getGlobalGraphData=async(t,e,a)=>await this.api.fetchWithTimeout("/analytics/volume",{params:{startTime:t,endTime:e,bin:a},next:{tags:["/analytics/volume"],revalidate:60}});getAnalyticsOverview=async()=>await this.api.fetchWithTimeout("/analytics/overview",{next:{tags:["/analytics/overview"],revalidate:60}});suggestResults=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getExploreStaking=async()=>await this.api.fetchWithTimeout("/collection/staking/explore",{next:{tags:["/collection/staking/explore"],revalidate:60}})}var B=E.$C,U=E.Yo,H=E.LU,_=E.sW,j=E.X$,G=E.JA,J=E.he,z=E.cO,X=E.t7,K=E.iQ,Y=E.MD,Z=E.Gq,Q=E.h4,tt=E.wT,et=E.JM,at=E.Vx,it=E.O8,rt=E.s0,ot=E.o,nt=E.p4,st=E.AQ,ct=E.J1,lt=E.g6,dt=E.cB,gt=E.Gt,ht=E.iE,ut=E.I_,pt=E.ZU,ft=E.Us,yt=E.GW;export{B as AssetCategory,U as AuctionType,H as AuctionTypes,_ as Chain,j as CollectionModule,G as CollectionStatsOrderBy,J as CollectionStatsSelectFields,z as CollectionsFieldsToSelect,X as CollectionsOrderBy,K as CollectionsSummaryFilter,Y as CommonModule,Z as DropsOderBy,Q as FieldsToSelect,tt as GlobalOfferFieldsToSelect,et as GlobalOfferOrderBy,at as IssuingType,it as Marketplace,rt as NFTModule,ot as NftActivityType,nt as OfferType,st as OrderByTradingActivity,ct as PoolType,lt as SearchOrderBy,dt as SelectFieldsTradingActivity,gt as StakingModule,ht as StakingStatus,ut as SuggestOrderBy,pt as Type,ft as UserModule,yt as XOXNOClient};
|
|
1
|
+
var t,e,a,i,r,o,n,s,c,l,d,g,h,u,p,f,y,m,T,w,S,k,q,v={d:(t,e)=>{for(var a in e)v.o(e,a)&&!v.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},E={};v.d(E,{$C:()=>d,Yo:()=>m,LU:()=>l,sW:()=>W,X$:()=>L,JA:()=>u,he:()=>h,cO:()=>s,t7:()=>o,iQ:()=>g,MD:()=>R,Gq:()=>i,h4:()=>e,wT:()=>c,JM:()=>n,Vx:()=>T,O8:()=>t,s0:()=>$,o:()=>p,p4:()=>k,AQ:()=>f,J1:()=>w,g6:()=>a,cB:()=>y,Gt:()=>F,iE:()=>S,I_:()=>r,ZU:()=>q,Us:()=>b,GW:()=>x}),function(t){t.XO="xoxno",t.FM="frameit",t.DR="deadrare",t.KG="krogan"}(t||(t={})),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"}(e||(e={})),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"}(a||(a={})),function(t){t.EndingLate="startTime desc",t.EndingSoon="startTime asc"}(i||(i={})),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"}(r||(r={})),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"}(o||(o={})),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"}(n||(n={})),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"}(s||(s={})),function(t){t.Attributes="attributes",t.Collection="collection",t.Marketplace="marketplace",t.PaymentToken="paymentToken",t.LongPrice="price",t.ShortPrice="priceShort"}(c||(c={})),function(t){t.FixedPrice="FixedPrice",t.Auctions="Auctions",t.All="All",t.AllListed="AllListed"}(l||(l={})),function(t){t.ALL="all",t.Trade="trade",t.P2P="p2p",t.Staking="staking",t.Minting="minting"}(d||(d={})),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"}(g||(g={})),function(t){t.TradingStats="tradingStats"}(h||(h={})),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"}(u||(u={})),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="activityData.egldValue desc",t.PriceLowToHigh="activityData.egldValue asc",t.RecentPlaced="timestamp desc",t.OldestPlaced="timestamp asc"}(f||(f={})),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"}(T||(T={})),function(t){t.Duo="Duo",t.Single="Single",t.Perk="Perk"}(w||(w={})),function(t){t.Staked="staked",t.Unbounding="unStaked",t.Available="available"}(S||(S={})),function(t){t.Received="received",t.Placed="placed"}(k||(k={})),function(t){t.NonFungibleESDT="NonFungibleESDT"}(q||(q={}));const C="https://api.xoxno.com",A="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",D="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",I="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var W;!function(t){t.MAINNET="1",t.DEVNET="D"}(W||(W={}));class x{static instance;apiUrl;apiKey;chain;config;constructor(t=C,e="",a){this.apiUrl=t,this.apiKey=e,this.chain=a,this.config=a==W.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:A,DR_SC:D,KG_SC:I,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:A,DR_SC:D,KG_SC:I,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}static init({apiUrl:t=C,apiKey:e="",chain:a=W.MAINNET}={}){if(null==x.instance||null==x.instance){if(a==W.DEVNET)return x.instance=new x(t??"https://devnet-api.xoxno.com",e,a),x.instance;x.instance=new x(t,e,a)}return x.instance}static getInstance(){if(null==x.instance||null==x.instance)throw new Error("XOXNOClient is not initialized");return x.instance}fetchWithTimeout=async(t,e={},a=4e4)=>{const i={"Accept-Encoding":"gzip,deflate,br",Referer:"https://xoxno.sdk","User-Agent":"XOXNO/1.0/SDK",..."POST"===e.method?{"Content-Type":"application/json"}:{},...e.headers??{}},r=`${"string"==typeof t&&t.startsWith("/")?`${this.apiUrl}${t}`:t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,o=new AbortController;setTimeout((()=>o.abort()),a);const n=await fetch(r,{...e,...e?.next&&e.next.revalidate?{}:{cache:"no-store"},signal:o.signal,...Object.keys(i).length?{headers:i}:{},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>100)throw new Error("Top cannot be greater than 100");const a=[];t.priceRange&&a.push({...t.priceRange,field:"activityData.egldValue"}),t.timestampRange&&a.push({...t.timestampRange,field:"timestamp"});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,range:a},strictSelect:t.strictSelect,includeCount:t.includeCount||!1,orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},r=await e.fetchWithTimeout("/activity/query",{params:{filter:JSON.stringify(i)},next:{tags:["getActivity"],revalidate:180}});return{...r,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===r.resources.length}},P=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),M=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 L{api;constructor(){this.api=x.getInstance()}getCollectionProfile=async t=>{if(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t);const a=await this.api.fetchWithTimeout(`/collection/${t}/floor-price`,{next:{tags:["getCollectionFloorPrice"]},params:{token:e}});return a?.price?a.price:0};getCollectionAttributes=async t=>{if(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.priceRange&&e.push({...t.priceRange,field:t.auctionType==l.Auctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"}),t.rankRange&&e.push({...t.rankRange,field:"metadata.rarity.rank"});const a={filters:{dataType:t.dataType??["nft"],activeAuction:t.activeAuctions,collection:t.collections??[],onSale:t.onlyOnSale,saleInfo:{seller:t.listedBy||[],marketplace:t.listedOnlyOn||void 0,paymentToken:t.listedInToken||[],auctionType:t.auctionType==l.Auctions?["NftBid","SftAll"]:t.auctionType==l.FixedPrice?["Nft","SftOnePerPayment"]:t.auctionType==l.AllListed?["NftBid","SftAll","Nft","SftOnePerPayment"]:void 0},owner:t.ownedBy||[],verifiedOnly:t.onlyVerified||!1,metadata:{attributes:t.attributes||void 0},range:e,nonce:t.nonces||void 0,cp_staked:t.isStaked??void 0},applyNftExtraDetails:t.applyNftExtraDetails,orderBy:t.orderBy||[],select:t.onlySelectFields||[],strictSelect:t.strictSelect||!1,includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/nft/query",{params:{filter:JSON.stringify(a)},next:{tags:["getCollectionNFTs"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};suggestCollections=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/collection/search",{params:{filter:JSON.stringify(e)},next:{tags:["/collection/search"],revalidate:180}})};collectionListingsAnalytics=async t=>await this.api.fetchWithTimeout(`/collection/${t}/listings`,{next:{tags:["collection/${ticker}/listings"],revalidate:500}});getTradingActivity=async t=>await O(t,this.api);getCollections=async t=>{if(t?.top&&t.top>100)throw new Error("Top cannot be greater than 100");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"]},a=await this.api.fetchWithTimeout("/collection/query",{params:{filter:JSON.stringify(e)},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>100)throw new Error("Top cannot be greater than 100");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||n.PriceHighToLow]},a=await this.api.fetchWithTimeout("/collection/global-offer/query",{params:{filter:JSON.stringify(e)},next:{tags:["getGlobalOffers"],revalidate:12}});return{...a,getNextPagePayload:{...t,skip:(t?.top||25)+a.lastSkip}}};getCollectionVolume=async(t,e,a,i)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume?startTime=${e}&endTime=${a}&bin=${i}`,{next:{tags:["getCollectionVolume"],revalidate:180}})};getMarketplaceVolume=async(t,e,a)=>await this.api.fetchWithTimeout(`/analytics/volume?startTime=${t}&endTime=${e}&bin=${a}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});getCollectionOwners=async t=>{if(!P(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(!P(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>100)throw new Error("Top cannot be greater than 100");return{...await this.api.fetchWithTimeout("/collection/stats/query",{params:{filter:JSON.stringify(t)},next:{tags:["collectionStatistics"],revalidate:12}}),getNextPagePayload:{...t,skip:t.skip+t.top}}};getCollectionStats=async t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/stats`,{next:{tags:["collectionStatistics"],revalidate:12}})};getAwaitEmpty=async t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)}));getCollectionMintInfo=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/drop-info`,{next:{tags:[`/collection/${t}/drop-info`],revalidate:12},...e})};getCollectionRanks=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/ranks`,{next:{tags:[`/collection/${t}/ranks`],revalidate:60},...e})};getDropInfo=async({collectionTag:t,creatorTag:e,extra:a})=>await this.api.fetchWithTimeout(`/collection/${e}/${t}/drop-info`,{next:{tags:[`/collection/${e}/${t}/drop-info`],revalidate:12},...a});getCollectionGraphData=async(t,e,a,i)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume`,{params:{startTime:e,endTime:a,bin:i},next:{tags:[`/collection/${t}/analytics/volume`],revalidate:60}})};getPinnedCollections=async()=>await this.api.fetchWithTimeout("/collection/pinned",{next:{tags:["/collection/pinned"],revalidate:60}});getDrops=async t=>{if(t?.collections?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.timeRange&&e.push({...t.timeRange,field:"startTime"});const a={filters:{collection:t.collections??[],verifiedOnly:t.onlyVerified||!1,mintToken:t.listedInToken||void 0,range:e},orderBy:t.orderBy||[],select:t.onlySelectFields||[],includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/collection/drops/query",{params:{filter:JSON.stringify(a)},next:{tags:["/collection/drops/query"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};getCollectionStakingSummary=async({collection:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/staking/summary`,{...e})};getCollectionsFloor=async t=>{t?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)}));return await this.api.fetchWithTimeout("/collection/floor-price",{params:{collection:t.join(",")}})}}const N=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),e},V=t=>{try{return t.includes("erd1")}catch(t){return!1}};class ${api;constructor(){this.api=x.getInstance()}getNFTByIdentifier=async t=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}`)};getNFTsOffers=async(t,e=0,a=25)=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}/offers?skip=${e}&top=${a}`,{next:{tags:["getNFTsOffers"],revalidate:12}})};getNFTByCollectionAndNonce=async(t,e)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);const a=await this.api.fetchWithTimeout(`/${((t,e)=>[t,N(e)].join("-"))(t,e)}`);return a};getNFTByCollectionAndNonceHex=async(t,e)=>{if(!P(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 b{api;collection;constructor(){this.api=x.getInstance(),this.collection=new L}getUserProfile=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/profile`)};getBulkAccounts=async t=>await this.api.fetchWithTimeout("/user/network-account",{method:"POST",body:JSON.stringify(t)});getUserAccount=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/network-account`)};getUserTokenInventory=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/token-inventory`)};getUserSummaryInventory=async t=>{if(!V(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(!V(t.address))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t.address}/offers`,{params:{type:t.type,skip:t.skip,top:t.top}})};suggestUsers=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/user/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getTradingActivity=async t=>await O(t,this.api);getUserCreatorProfile=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/profile`)};getCreatorListings=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/listing`)};getUserStakingSummary=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/summary`)};getUserStakingAailable=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/available-pools`)};getUserCreatorInfo=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/details`)};getUserCollectionStaking=async(t,e)=>{if(!V(t))throw new Error("Invalid address");if(!P(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/user/${t}/staking/collection/${e}`)};getUserPoolStaking=async(t,e,a)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}/nfts?status=${a}`)};getOwnedPoolsByAddress=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-pools`)};getUserAnalyticsSummary=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/analytics/volume`)};getUserFavoriteNFTs=async(t,e,a)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/nfts`,{params:{top:e,skip:a}})};getUserFavoriteCollectionTickers=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/collections`)};getIsCreatorRegistered=async t=>await this.api.fetchWithTimeout(`/user/${t}/creator/is-registered`);getUsersStats=async({top:t,skip:e,orderBy:a})=>{if(t&&t>35)throw new Error("Top cannot be greater than 100");return await this.api.fetchWithTimeout("/user/stats",{params:{top:t,skip:e,orderBy:a??"totalVolume"},next:{tags:["/user/stats"],revalidate:180}})};getStakingCreatorInfo=async t=>await this.api.fetchWithTimeout(`/user/${t}/staking/creator`,{next:{tags:[`/user/${t}/staking/creator`],revalidate:30}});getUsersDrop=async({top:t,skip:e,address:a})=>{if(t&&t>35)throw new Error("Top cannot be greater than 100");if(a&&!V(a))throw new Error("Invalid address");return await this.api.fetchWithTimeout("/user/xoxno-drop",{params:{top:t,skip:e,...a?{address:a}:{}},next:{tags:["/user/xoxno-drop"],revalidate:30}})};getUserOwnerCollections=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-collections`)};getRoyaltiesSharesCreator=async t=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/royalties`)};getMintSharesCreator=async(t,e)=>{if(!V(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/collection/${e}`)}}class F{api;constructor(){this.api=x.getInstance()}getPoolDetails=async t=>await this.api.fetchWithTimeout(`/pool/${t}/profile`)}class R{api;constructor(){this.api=x.getInstance()}getTokensUsdPrice=async()=>await this.api.fetchWithTimeout("/tokens/usd-price");getAshSwapAmount=async({originalToken:t,originalTokenValue:e,paymentToken:a})=>await this.api.fetchWithTimeout("/ash/min-token-quantity",{params:{originalToken:t,originalTokenValue:e,paymentToken:a}});getFungibleTokens=async(t=[d.ALL],e)=>{let a={};e&&(a={identifier:e.join(",")}),t&&(a={...a,category:t.join(",")});return await this.api.fetchWithTimeout("/tokens",{params:a})};getGlobalGraphData=async(t,e,a)=>await this.api.fetchWithTimeout("/analytics/volume",{params:{startTime:t,endTime:e,bin:a},next:{tags:["/analytics/volume"],revalidate:60}});getAnalyticsOverview=async()=>await this.api.fetchWithTimeout("/analytics/overview",{next:{tags:["/analytics/overview"],revalidate:60}});suggestResults=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getExploreStaking=async()=>await this.api.fetchWithTimeout("/collection/staking/explore",{next:{tags:["/collection/staking/explore"],revalidate:60}})}var B=E.$C,U=E.Yo,H=E.LU,_=E.sW,j=E.X$,G=E.JA,J=E.he,z=E.cO,X=E.t7,K=E.iQ,Y=E.MD,Z=E.Gq,Q=E.h4,tt=E.wT,et=E.JM,at=E.Vx,it=E.O8,rt=E.s0,ot=E.o,nt=E.p4,st=E.AQ,ct=E.J1,lt=E.g6,dt=E.cB,gt=E.Gt,ht=E.iE,ut=E.I_,pt=E.ZU,ft=E.Us,yt=E.GW;export{B as AssetCategory,U as AuctionType,H as AuctionTypes,_ as Chain,j as CollectionModule,G as CollectionStatsOrderBy,J as CollectionStatsSelectFields,z as CollectionsFieldsToSelect,X as CollectionsOrderBy,K as CollectionsSummaryFilter,Y as CommonModule,Z as DropsOderBy,Q as FieldsToSelect,tt as GlobalOfferFieldsToSelect,et as GlobalOfferOrderBy,at as IssuingType,it as Marketplace,rt as NFTModule,ot as NftActivityType,nt as OfferType,st as OrderByTradingActivity,ct as PoolType,lt as SearchOrderBy,dt as SelectFieldsTradingActivity,gt as StakingModule,ht as StakingStatus,ut as SuggestOrderBy,pt as Type,ft as UserModule,yt as XOXNOClient};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["@xoxno/sdk-js"]=e():t["@xoxno/sdk-js"]=e()}(this,(()=>(()=>{"use strict";var t,e,i,a,r,o,n,s,l,c,d,g,h,u,p,f,y,m,T,w,S,k,q,v={d:(t,e)=>{for(var i in e)v.o(e,i)&&!v.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},E={};v.r(E),v.d(E,{AssetCategory:()=>d,AuctionType:()=>m,AuctionTypes:()=>c,Chain:()=>I,CollectionModule:()=>b,CollectionStatsOrderBy:()=>u,CollectionStatsSelectFields:()=>h,CollectionsFieldsToSelect:()=>s,CollectionsOrderBy:()=>o,CollectionsSummaryFilter:()=>g,CommonModule:()=>R,DropsOderBy:()=>a,FieldsToSelect:()=>e,GlobalOfferFieldsToSelect:()=>l,GlobalOfferOrderBy:()=>n,IssuingType:()=>T,Marketplace:()=>t,NFTModule:()=>V,NftActivityType:()=>p,OfferType:()=>k,OrderByTradingActivity:()=>f,PoolType:()=>w,SearchOrderBy:()=>i,SelectFieldsTradingActivity:()=>y,StakingModule:()=>F,StakingStatus:()=>S,SuggestOrderBy:()=>r,Type:()=>q,UserModule:()=>$,XOXNOClient:()=>W}),function(t){t.XO="xoxno",t.FM="frameit",t.DR="deadrare",t.KG="krogan"}(t||(t={})),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"}(e||(e={})),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"}(i||(i={})),function(t){t.EndingLate="startTime desc",t.EndingSoon="startTime asc"}(a||(a={})),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"}(r||(r={})),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"}(o||(o={})),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"}(n||(n={})),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"}(s||(s={})),function(t){t.Attributes="attributes",t.Collection="collection",t.Marketplace="marketplace",t.PaymentToken="paymentToken",t.LongPrice="price",t.ShortPrice="priceShort"}(l||(l={})),function(t){t.FixedPrice="FixedPrice",t.Auctions="Auctions",t.All="All",t.AllListed="AllListed"}(c||(c={})),function(t){t.ALL="all",t.Trade="trade",t.P2P="p2p",t.Staking="staking",t.Minting="minting"}(d||(d={})),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"}(g||(g={})),function(t){t.TradingStats="tradingStats"}(h||(h={})),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"}(u||(u={})),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="activityData.egldValue desc",t.PriceLowToHigh="activityData.egldValue asc",t.RecentPlaced="timestamp desc",t.OldestPlaced="timestamp asc"}(f||(f={})),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"}(T||(T={})),function(t){t.Duo="Duo",t.Single="Single",t.Perk="Perk"}(w||(w={})),function(t){t.Staked="staked",t.Unbounding="unStaked",t.Available="available"}(S||(S={})),function(t){t.Received="received",t.Placed="placed"}(k||(k={})),function(t){t.NonFungibleESDT="NonFungibleESDT"}(q||(q={}));const C="https://api.xoxno.com",A="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",D="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",x="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var I;!function(t){t.MAINNET="1",t.DEVNET="D"}(I||(I={}));class W{static instance;apiUrl;apiKey;chain;config;constructor(t=C,e="",i){this.apiUrl=t,this.apiKey=e,this.chain=i,this.config=i==I.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:A,DR_SC:D,KG_SC:x,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:A,DR_SC:D,KG_SC:x,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}static init({apiUrl:t=C,apiKey:e="",chain:i=I.MAINNET}={}){if(null==W.instance||null==W.instance){if(i==I.DEVNET)return W.instance=new W(t??"https://devnet-api.xoxno.com",e,i),W.instance;W.instance=new W(t,e,i)}return W.instance}static getInstance(){if(null==W.instance||null==W.instance)throw new Error("XOXNOClient is not initialized");return W.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??{}},r=`${"string"==typeof t&&t.startsWith("/")?`${this.apiUrl}${t}`:t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,o=new AbortController;setTimeout((()=>o.abort()),i);const n=await fetch(r,{...e,...e?.next&&e.next.revalidate?{}:{cache:"no-store"},signal:o.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>100)throw new Error("Top cannot be greater than 35");const i=[];t.priceRange&&i.push({...t.priceRange,field:"activityData.egldValue"}),t.timestampRange&&i.push({...t.timestampRange,field:"timestamp"});const a={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,range:i},strictSelect:t.strictSelect,includeCount:t.includeCount||!1,orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},r=await e.fetchWithTimeout("/activity/query",{params:{filter:JSON.stringify(a)},next:{tags:["getActivity"],revalidate:180}});return{...r,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===r.resources.length}},P=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),M=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 b{api;constructor(){this.api=W.getInstance()}getCollectionProfile=async t=>{if(!P(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(!P(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(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e=[];t.priceRange&&e.push({...t.priceRange,field:t.auctionType==c.Auctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"}),t.rankRange&&e.push({...t.rankRange,field:"metadata.rarity.rank"});const i={filters:{dataType:t.dataType??["nft"],activeAuction:t.activeAuctions,collection:t.collections??[],onSale:t.onlyOnSale,saleInfo:{seller:t.listedBy||[],marketplace:t.listedOnlyOn||void 0,paymentToken:t.listedInToken||[],auctionType:t.auctionType==c.Auctions?["NftBid","SftAll"]:t.auctionType==c.FixedPrice?["Nft","SftOnePerPayment"]:t.auctionType==c.AllListed?["NftBid","SftAll","Nft","SftOnePerPayment"]:void 0},owner:t.ownedBy||[],verifiedOnly:t.onlyVerified||!1,metadata:{attributes:t.attributes||void 0},range:e,nonce:t.nonces||void 0,cp_staked:t.isStaked??void 0},applyNftExtraDetails:t.applyNftExtraDetails,orderBy:t.orderBy||[],select:t.onlySelectFields||[],strictSelect:t.strictSelect||!1,includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/nft/query",{params:{filter:JSON.stringify(i)},next:{tags:["getCollectionNFTs"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};suggestCollections=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/collection/search",{params:{filter:JSON.stringify(e)},next:{tags:["/collection/search"],revalidate:180}})};collectionListingsAnalytics=async t=>await this.api.fetchWithTimeout(`/collection/${t}/listings`,{next:{tags:["collection/${ticker}/listings"],revalidate:500}});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=await this.api.fetchWithTimeout("/collection/query",{params:{filter:JSON.stringify(e)},next:{tags:["getCollections"],revalidate:180}});return{results:i,resultsCount:i.length,empty:0===i.length,getNextPagePayload:{...t,skip:(t?.skip||0)+(t?.top||25)},hasMoreResults:i.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||n.PriceHighToLow]},i=await this.api.fetchWithTimeout("/collection/global-offer/query",{params:{filter:JSON.stringify(e)},next:{tags:["getGlobalOffers"],revalidate:12}});return{...i,getNextPagePayload:{...t,skip:(t?.top||25)+i.lastSkip}}};getCollectionVolume=async(t,e,i,a)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume?startTime=${e}&endTime=${i}&bin=${a}`,{next:{tags:["getCollectionVolume"],revalidate:180}})};getMarketplaceVolume=async(t,e,i)=>await this.api.fetchWithTimeout(`/analytics/volume?startTime=${t}&endTime=${e}&bin=${i}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});getCollectionOwners=async t=>{if(!P(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(!P(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");return{...await this.api.fetchWithTimeout("/collection/stats/query",{params:{filter:JSON.stringify(t)},next:{tags:["collectionStatistics"],revalidate:12}}),getNextPagePayload:{...t,skip:t.skip+t.top}}};getCollectionStats=async t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/stats`,{next:{tags:["collectionStatistics"],revalidate:12}})};getAwaitEmpty=async t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)}));getCollectionMintInfo=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/drop-info`,{next:{tags:[`/collection/${t}/drop-info`],revalidate:12},...e})};getCollectionRanks=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/ranks`,{next:{tags:[`/collection/${t}/ranks`],revalidate:60},...e})};getDropInfo=async({collectionTag:t,creatorTag:e,extra:i})=>await this.api.fetchWithTimeout(`/collection/${e}/${t}/drop-info`,{next:{tags:[`/collection/${e}/${t}/drop-info`],revalidate:12},...i});getCollectionGraphData=async(t,e,i,a)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume`,{params:{startTime:e,endTime:i,bin:a},next:{tags:[`/collection/${t}/analytics/volume`],revalidate:60}})};getPinnedCollections=async()=>await this.api.fetchWithTimeout("/collection/pinned",{next:{tags:["/collection/pinned"],revalidate:60}});getDrops=async t=>{if(t?.collections?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.timeRange&&e.push({...t.timeRange,field:"startTime"});const i={filters:{collection:t.collections??[],verifiedOnly:t.onlyVerified||!1,mintToken:t.listedInToken||void 0,range:e},orderBy:t.orderBy||[],select:t.onlySelectFields||[],includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/collection/drops/query",{params:{filter:JSON.stringify(i)},next:{tags:["/collection/drops/query"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};getCollectionStakingSummary=async({collection:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/staking/summary`,{...e})};getCollectionsFloor=async t=>{t?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)}));return await this.api.fetchWithTimeout("/collection/floor-price",{params:{collection:t.join(",")}})}}const L=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),e},N=t=>{try{return t.includes("erd1")}catch(t){return!1}};class V{api;constructor(){this.api=W.getInstance()}getNFTByIdentifier=async t=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}`)};getNFTsOffers=async(t,e=0,i=25)=>{if(!M(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(!P(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(!P(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 ${api;collection;constructor(){this.api=W.getInstance(),this.collection=new b}getUserProfile=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/profile`)};getBulkAccounts=async t=>await this.api.fetchWithTimeout("/user/network-account",{method:"POST",body:JSON.stringify(t)});getUserAccount=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/network-account`)};getUserTokenInventory=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/token-inventory`)};getUserSummaryInventory=async t=>{if(!N(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(!N(t.address))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t.address}/offers`,{params:{type:t.type,skip:t.skip,top:t.top}})};suggestUsers=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/user/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getTradingActivity=async t=>await O(t,this.api);getUserCreatorProfile=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/profile`)};getCreatorListings=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/listing`)};getUserStakingSummary=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/summary`)};getUserStakingAailable=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/available-pools`)};getUserCreatorInfo=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/details`)};getUserCollectionStaking=async(t,e)=>{if(!N(t))throw new Error("Invalid address");if(!P(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/user/${t}/staking/collection/${e}`)};getUserPoolStaking=async(t,e,i)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}/nfts?status=${i}`)};getOwnedPoolsByAddress=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-pools`)};getUserAnalyticsSummary=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/analytics/volume`)};getUserFavoriteNFTs=async(t,e,i)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/nfts`,{params:{top:e,skip:i}})};getUserFavoriteCollectionTickers=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/collections`)};getIsCreatorRegistered=async t=>await this.api.fetchWithTimeout(`/user/${t}/creator/is-registered`);getUsersStats=async({top:t,skip:e,orderBy:i})=>{if(t&&t>35)throw new Error("Top cannot be greater than 35");return await this.api.fetchWithTimeout("/user/stats",{params:{top:t,skip:e,orderBy:i??"totalVolume"},next:{tags:["/user/stats"],revalidate:180}})};getStakingCreatorInfo=async t=>await this.api.fetchWithTimeout(`/user/${t}/staking/creator`,{next:{tags:[`/user/${t}/staking/creator`],revalidate:30}});getUsersDrop=async({top:t,skip:e,address:i})=>{if(t&&t>35)throw new Error("Top cannot be greater than 35");if(i&&!N(i))throw new Error("Invalid address");return await this.api.fetchWithTimeout("/user/xoxno-drop",{params:{top:t,skip:e,...i?{address:i}:{}},next:{tags:["/user/xoxno-drop"],revalidate:30}})};getUserOwnerCollections=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-collections`)};getRoyaltiesSharesCreator=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/royalties`)};getMintSharesCreator=async(t,e)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/collection/${e}`)}}class F{api;constructor(){this.api=W.getInstance()}getPoolDetails=async t=>await this.api.fetchWithTimeout(`/pool/${t}/profile`)}class R{api;constructor(){this.api=W.getInstance()}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=[d.ALL],e)=>{let i={};e&&(i={identifier:e.join(",")}),t&&(i={...i,category:t.join(",")});return await this.api.fetchWithTimeout("/tokens",{params:i})};getGlobalGraphData=async(t,e,i)=>await this.api.fetchWithTimeout("/analytics/volume",{params:{startTime:t,endTime:e,bin:i},next:{tags:["/analytics/volume"],revalidate:60}});getAnalyticsOverview=async()=>await this.api.fetchWithTimeout("/analytics/overview",{next:{tags:["/analytics/overview"],revalidate:60}});suggestResults=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 35");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getExploreStaking=async()=>await this.api.fetchWithTimeout("/collection/staking/explore",{next:{tags:["/collection/staking/explore"],revalidate:60}})}return E})()));
|
|
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,i,a,r,o,n,s,l,c,d,g,h,u,p,f,y,m,T,w,S,k,q,v={d:(t,e)=>{for(var i in e)v.o(e,i)&&!v.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},E={};v.r(E),v.d(E,{AssetCategory:()=>d,AuctionType:()=>m,AuctionTypes:()=>c,Chain:()=>I,CollectionModule:()=>b,CollectionStatsOrderBy:()=>u,CollectionStatsSelectFields:()=>h,CollectionsFieldsToSelect:()=>s,CollectionsOrderBy:()=>o,CollectionsSummaryFilter:()=>g,CommonModule:()=>R,DropsOderBy:()=>a,FieldsToSelect:()=>e,GlobalOfferFieldsToSelect:()=>l,GlobalOfferOrderBy:()=>n,IssuingType:()=>T,Marketplace:()=>t,NFTModule:()=>V,NftActivityType:()=>p,OfferType:()=>k,OrderByTradingActivity:()=>f,PoolType:()=>w,SearchOrderBy:()=>i,SelectFieldsTradingActivity:()=>y,StakingModule:()=>F,StakingStatus:()=>S,SuggestOrderBy:()=>r,Type:()=>q,UserModule:()=>$,XOXNOClient:()=>W}),function(t){t.XO="xoxno",t.FM="frameit",t.DR="deadrare",t.KG="krogan"}(t||(t={})),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"}(e||(e={})),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"}(i||(i={})),function(t){t.EndingLate="startTime desc",t.EndingSoon="startTime asc"}(a||(a={})),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"}(r||(r={})),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"}(o||(o={})),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"}(n||(n={})),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"}(s||(s={})),function(t){t.Attributes="attributes",t.Collection="collection",t.Marketplace="marketplace",t.PaymentToken="paymentToken",t.LongPrice="price",t.ShortPrice="priceShort"}(l||(l={})),function(t){t.FixedPrice="FixedPrice",t.Auctions="Auctions",t.All="All",t.AllListed="AllListed"}(c||(c={})),function(t){t.ALL="all",t.Trade="trade",t.P2P="p2p",t.Staking="staking",t.Minting="minting"}(d||(d={})),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"}(g||(g={})),function(t){t.TradingStats="tradingStats"}(h||(h={})),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"}(u||(u={})),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="activityData.egldValue desc",t.PriceLowToHigh="activityData.egldValue asc",t.RecentPlaced="timestamp desc",t.OldestPlaced="timestamp asc"}(f||(f={})),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"}(T||(T={})),function(t){t.Duo="Duo",t.Single="Single",t.Perk="Perk"}(w||(w={})),function(t){t.Staked="staked",t.Unbounding="unStaked",t.Available="available"}(S||(S={})),function(t){t.Received="received",t.Placed="placed"}(k||(k={})),function(t){t.NonFungibleESDT="NonFungibleESDT"}(q||(q={}));const C="https://api.xoxno.com",A="erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s",D="erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0",x="erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e";var I;!function(t){t.MAINNET="1",t.DEVNET="D"}(I||(I={}));class W{static instance;apiUrl;apiKey;chain;config;constructor(t=C,e="",i){this.apiUrl=t,this.apiKey=e,this.chain=i,this.config=i==I.MAINNET?{mediaUrl:"https://media.xoxno.com",gatewayUrl:"https://gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",FM_SC:A,DR_SC:D,KG_SC:x,Staking_SC:"erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z",Manager_SC:"erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7",P2P_SC:"erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6"}:{mediaUrl:"https://devnet-media.xoxno.com",gatewayUrl:"https://devnet-gateway.xoxno.com",XO_SC:"erd1qqqqqqqqqqqqqpgql0dnz6n5hpuw8cptlt00khd0nn4ja8eadsfq2xrqw4",FM_SC:A,DR_SC:D,KG_SC:x,Staking_SC:"erd1qqqqqqqqqqqqqpgqsc5hnewwpep8qq0d7kjjzrquapuucrygah0s85zres",Manager_SC:"erd1qqqqqqqqqqqqqpgqluclyhfsa2uw7q9cjwd8knk989hg57u8ah0slq2nlr",P2P_SC:"erd1qqqqqqqqqqqqqpgqfja7ukpngrun78ueq583l0vd6aj4ekhrah0sa9wyrv"}}static init({apiUrl:t=C,apiKey:e="",chain:i=I.MAINNET}={}){if(null==W.instance||null==W.instance){if(i==I.DEVNET)return W.instance=new W(t??"https://devnet-api.xoxno.com",e,i),W.instance;W.instance=new W(t,e,i)}return W.instance}static getInstance(){if(null==W.instance||null==W.instance)throw new Error("XOXNOClient is not initialized");return W.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??{}},r=`${"string"==typeof t&&t.startsWith("/")?`${this.apiUrl}${t}`:t}${e.params?"?"+Object.keys(e.params).map((t=>`${t}=${encodeURIComponent(e.params[t])}`)).join("&"):""}`,o=new AbortController;setTimeout((()=>o.abort()),i);const n=await fetch(r,{...e,...e?.next&&e.next.revalidate?{}:{cache:"no-store"},signal:o.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>100)throw new Error("Top cannot be greater than 100");const i=[];t.priceRange&&i.push({...t.priceRange,field:"activityData.egldValue"}),t.timestampRange&&i.push({...t.timestampRange,field:"timestamp"});const a={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,range:i},strictSelect:t.strictSelect,includeCount:t.includeCount||!1,orderBy:t.orderBy,select:t.select,top:t.top||35,skip:t.skip||0},r=await e.fetchWithTimeout("/activity/query",{params:{filter:JSON.stringify(a)},next:{tags:["getActivity"],revalidate:180}});return{...r,getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)},empty:0===r.resources.length}},P=t=>/^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(t),M=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 b{api;constructor(){this.api=W.getInstance()}getCollectionProfile=async t=>{if(!P(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(!P(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(!P(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(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.priceRange&&e.push({...t.priceRange,field:t.auctionType==c.Auctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"}),t.rankRange&&e.push({...t.rankRange,field:"metadata.rarity.rank"});const i={filters:{dataType:t.dataType??["nft"],activeAuction:t.activeAuctions,collection:t.collections??[],onSale:t.onlyOnSale,saleInfo:{seller:t.listedBy||[],marketplace:t.listedOnlyOn||void 0,paymentToken:t.listedInToken||[],auctionType:t.auctionType==c.Auctions?["NftBid","SftAll"]:t.auctionType==c.FixedPrice?["Nft","SftOnePerPayment"]:t.auctionType==c.AllListed?["NftBid","SftAll","Nft","SftOnePerPayment"]:void 0},owner:t.ownedBy||[],verifiedOnly:t.onlyVerified||!1,metadata:{attributes:t.attributes||void 0},range:e,nonce:t.nonces||void 0,cp_staked:t.isStaked??void 0},applyNftExtraDetails:t.applyNftExtraDetails,orderBy:t.orderBy||[],select:t.onlySelectFields||[],strictSelect:t.strictSelect||!1,includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/nft/query",{params:{filter:JSON.stringify(i)},next:{tags:["getCollectionNFTs"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};suggestCollections=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/collection/search",{params:{filter:JSON.stringify(e)},next:{tags:["/collection/search"],revalidate:180}})};collectionListingsAnalytics=async t=>await this.api.fetchWithTimeout(`/collection/${t}/listings`,{next:{tags:["collection/${ticker}/listings"],revalidate:500}});getTradingActivity=async t=>await O(t,this.api);getCollections=async t=>{if(t?.top&&t.top>100)throw new Error("Top cannot be greater than 100");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=await this.api.fetchWithTimeout("/collection/query",{params:{filter:JSON.stringify(e)},next:{tags:["getCollections"],revalidate:180}});return{results:i,resultsCount:i.length,empty:0===i.length,getNextPagePayload:{...t,skip:(t?.skip||0)+(t?.top||25)},hasMoreResults:i.length>=(t?.top||25)}};getGlobalOffers=async t=>{if(t?.top&&t.top>100)throw new Error("Top cannot be greater than 100");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||n.PriceHighToLow]},i=await this.api.fetchWithTimeout("/collection/global-offer/query",{params:{filter:JSON.stringify(e)},next:{tags:["getGlobalOffers"],revalidate:12}});return{...i,getNextPagePayload:{...t,skip:(t?.top||25)+i.lastSkip}}};getCollectionVolume=async(t,e,i,a)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume?startTime=${e}&endTime=${i}&bin=${a}`,{next:{tags:["getCollectionVolume"],revalidate:180}})};getMarketplaceVolume=async(t,e,i)=>await this.api.fetchWithTimeout(`/analytics/volume?startTime=${t}&endTime=${e}&bin=${i}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});getCollectionOwners=async t=>{if(!P(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(!P(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>100)throw new Error("Top cannot be greater than 100");return{...await this.api.fetchWithTimeout("/collection/stats/query",{params:{filter:JSON.stringify(t)},next:{tags:["collectionStatistics"],revalidate:12}}),getNextPagePayload:{...t,skip:t.skip+t.top}}};getCollectionStats=async t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/stats`,{next:{tags:["collectionStatistics"],revalidate:12}})};getAwaitEmpty=async t=>new Promise((e=>{setTimeout((()=>{e(!0)}),t)}));getCollectionMintInfo=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/drop-info`,{next:{tags:[`/collection/${t}/drop-info`],revalidate:12},...e})};getCollectionRanks=async({ticker:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/ranks`,{next:{tags:[`/collection/${t}/ranks`],revalidate:60},...e})};getDropInfo=async({collectionTag:t,creatorTag:e,extra:i})=>await this.api.fetchWithTimeout(`/collection/${e}/${t}/drop-info`,{next:{tags:[`/collection/${e}/${t}/drop-info`],revalidate:12},...i});getCollectionGraphData=async(t,e,i,a)=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/analytics/volume`,{params:{startTime:e,endTime:i,bin:a},next:{tags:[`/collection/${t}/analytics/volume`],revalidate:60}})};getPinnedCollections=async()=>await this.api.fetchWithTimeout("/collection/pinned",{next:{tags:["/collection/pinned"],revalidate:60}});getDrops=async t=>{if(t?.collections?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)})),t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e=[];t.timeRange&&e.push({...t.timeRange,field:"startTime"});const i={filters:{collection:t.collections??[],verifiedOnly:t.onlyVerified||!1,mintToken:t.listedInToken||void 0,range:e},orderBy:t.orderBy||[],select:t.onlySelectFields||[],includeCount:t.includeCount||!1,top:t.top||35,skip:t.skip||0};return{...await this.api.fetchWithTimeout("/collection/drops/query",{params:{filter:JSON.stringify(i)},next:{tags:["/collection/drops/query"]},cache:"no-store"}),getNextPagePayload:{...t,skip:(t.skip??0)+(t.top??35)}}};getCollectionStakingSummary=async({collection:t,extra:e})=>{if(!P(t))throw new Error("Invalid collection ticker: "+t);return await this.api.fetchWithTimeout(`/collection/${t}/staking/summary`,{...e})};getCollectionsFloor=async t=>{t?.forEach((t=>{if(!P(t))throw new Error("Invalid collection ticker: "+t)}));return await this.api.fetchWithTimeout("/collection/floor-price",{params:{collection:t.join(",")}})}}const L=t=>{let e=t.toString(16);return e.length%2!=0&&(e="0"+e),e},N=t=>{try{return t.includes("erd1")}catch(t){return!1}};class V{api;constructor(){this.api=W.getInstance()}getNFTByIdentifier=async t=>{if(!M(t))throw new Error("Invalid identifier: "+t);return await this.api.fetchWithTimeout(`/nft/${t}`)};getNFTsOffers=async(t,e=0,i=25)=>{if(!M(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(!P(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(!P(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 ${api;collection;constructor(){this.api=W.getInstance(),this.collection=new b}getUserProfile=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/profile`)};getBulkAccounts=async t=>await this.api.fetchWithTimeout("/user/network-account",{method:"POST",body:JSON.stringify(t)});getUserAccount=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/network-account`)};getUserTokenInventory=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/token-inventory`)};getUserSummaryInventory=async t=>{if(!N(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(!N(t.address))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t.address}/offers`,{params:{type:t.type,skip:t.skip,top:t.top}})};suggestUsers=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/user/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getTradingActivity=async t=>await O(t,this.api);getUserCreatorProfile=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/profile`)};getCreatorListings=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/listing`)};getUserStakingSummary=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/summary`)};getUserStakingAailable=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/available-pools`)};getUserCreatorInfo=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/creator/details`)};getUserCollectionStaking=async(t,e)=>{if(!N(t))throw new Error("Invalid address");if(!P(e))throw new Error("Invalid collection ticker: "+e);return await this.api.fetchWithTimeout(`/user/${t}/staking/collection/${e}`)};getUserPoolStaking=async(t,e,i)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/pool/${e}/nfts?status=${i}`)};getOwnedPoolsByAddress=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-pools`)};getUserAnalyticsSummary=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/analytics/volume`)};getUserFavoriteNFTs=async(t,e,i)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/nfts`,{params:{top:e,skip:i}})};getUserFavoriteCollectionTickers=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/favorite/collections`)};getIsCreatorRegistered=async t=>await this.api.fetchWithTimeout(`/user/${t}/creator/is-registered`);getUsersStats=async({top:t,skip:e,orderBy:i})=>{if(t&&t>35)throw new Error("Top cannot be greater than 100");return await this.api.fetchWithTimeout("/user/stats",{params:{top:t,skip:e,orderBy:i??"totalVolume"},next:{tags:["/user/stats"],revalidate:180}})};getStakingCreatorInfo=async t=>await this.api.fetchWithTimeout(`/user/${t}/staking/creator`,{next:{tags:[`/user/${t}/staking/creator`],revalidate:30}});getUsersDrop=async({top:t,skip:e,address:i})=>{if(t&&t>35)throw new Error("Top cannot be greater than 100");if(i&&!N(i))throw new Error("Invalid address");return await this.api.fetchWithTimeout("/user/xoxno-drop",{params:{top:t,skip:e,...i?{address:i}:{}},next:{tags:["/user/xoxno-drop"],revalidate:30}})};getUserOwnerCollections=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/user/${t}/staking/owned-collections`)};getRoyaltiesSharesCreator=async t=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/royalties`)};getMintSharesCreator=async(t,e)=>{if(!N(t))throw new Error("Invalid address");return await this.api.fetchWithTimeout(`/launchpad/${t}/shareholders/collection/${e}`)}}class F{api;constructor(){this.api=W.getInstance()}getPoolDetails=async t=>await this.api.fetchWithTimeout(`/pool/${t}/profile`)}class R{api;constructor(){this.api=W.getInstance()}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=[d.ALL],e)=>{let i={};e&&(i={identifier:e.join(",")}),t&&(i={...i,category:t.join(",")});return await this.api.fetchWithTimeout("/tokens",{params:i})};getGlobalGraphData=async(t,e,i)=>await this.api.fetchWithTimeout("/analytics/volume",{params:{startTime:t,endTime:e,bin:i},next:{tags:["/analytics/volume"],revalidate:60}});getAnalyticsOverview=async()=>await this.api.fetchWithTimeout("/analytics/overview",{next:{tags:["/analytics/overview"],revalidate:60}});suggestResults=async t=>{if(t.top&&t.top>100)throw new Error("Top cannot be greater than 100");const e={name:t.name,top:t.top||35,skip:t.skip||0};return await this.api.fetchWithTimeout("/search",{params:{filter:JSON.stringify(e)},next:{tags:["/search/global"],revalidate:180}})};getExploreStaking=async()=>await this.api.fetchWithTimeout("/collection/staking/explore",{next:{tags:["/collection/staking/explore"],revalidate:60}})}return E})()));
|
package/dist/nft/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare class NFTModule {
|
|
|
62
62
|
*
|
|
63
63
|
* @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
|
|
64
64
|
* @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
|
|
65
|
-
* @throws {Error} Throws an error if the 'top' argument is greater than
|
|
65
|
+
* @throws {Error} Throws an error if the 'top' argument is greater than 100.
|
|
66
66
|
*/
|
|
67
67
|
getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
|
|
68
68
|
}
|
package/dist/users/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export declare class UserModule {
|
|
|
61
61
|
*
|
|
62
62
|
* This function fetches suggested users results based on the provided arguments. It takes an object with the following properties:
|
|
63
63
|
* - name (string): The name to search for (required).
|
|
64
|
-
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than
|
|
64
|
+
* - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 100).
|
|
65
65
|
* - skip (number, optional): The number of results to skip (default is 0).
|
|
66
66
|
*
|
|
67
67
|
* Finally, it returns a promise that resolves to the fetched users results.
|
|
@@ -72,7 +72,7 @@ export declare class UserModule {
|
|
|
72
72
|
*
|
|
73
73
|
* @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
|
|
74
74
|
* @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
|
|
75
|
-
* @throws {Error} Throws an error if the 'top' argument is greater than
|
|
75
|
+
* @throws {Error} Throws an error if the 'top' argument is greater than 100.
|
|
76
76
|
*/
|
|
77
77
|
getTradingActivity: (args: TradincActivityArgs) => Promise<TradingActivityResponse>;
|
|
78
78
|
/** Gets user's creator profile
|
|
@@ -5,7 +5,7 @@ import { TradincActivityArgs, TradingActivityResponse } from '../types/trading';
|
|
|
5
5
|
* @param args - The trading activity arguments
|
|
6
6
|
* @param api - The API client
|
|
7
7
|
* @returns - The trading activity response
|
|
8
|
-
* @throws - If the top is greater than
|
|
8
|
+
* @throws - If the top is greater than 100
|
|
9
9
|
*/
|
|
10
10
|
export declare const getActivity: (args: TradincActivityArgs, api: XOXNOClient) => Promise<TradingActivityResponse>;
|
|
11
11
|
//# sourceMappingURL=getActivity.d.ts.map
|