@xoxno/sdk-js 0.1.57-alpha → 0.1.59-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/collection/index.js +569 -0
  2. package/dist/collection/index.js.map +1 -0
  3. package/dist/common/index.js +50 -0
  4. package/dist/common/index.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +10 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.large.js +3 -0
  9. package/dist/index.large.js.map +1 -0
  10. package/dist/interactions/index.js +619 -0
  11. package/dist/interactions/index.js.map +1 -0
  12. package/dist/launchpad/index.js +140 -0
  13. package/dist/launchpad/index.js.map +1 -0
  14. package/dist/nft/index.js +109 -0
  15. package/dist/nft/index.js.map +1 -0
  16. package/dist/staking/index.js +17 -0
  17. package/dist/staking/index.js.map +1 -0
  18. package/dist/types/collection.d.ts +21 -9
  19. package/dist/types/collection.js +180 -0
  20. package/dist/types/collection.js.map +1 -0
  21. package/dist/types/common.js +2 -0
  22. package/dist/types/common.js.map +1 -0
  23. package/dist/types/index.js +8 -0
  24. package/dist/types/index.js.map +1 -0
  25. package/dist/types/interactions.js +8 -0
  26. package/dist/types/interactions.js.map +1 -0
  27. package/dist/types/nft.js +2 -0
  28. package/dist/types/nft.js.map +1 -0
  29. package/dist/types/staking.js +12 -0
  30. package/dist/types/staking.js.map +1 -0
  31. package/dist/types/trading.js +51 -0
  32. package/dist/types/trading.js.map +1 -0
  33. package/dist/types/user.js +10 -0
  34. package/dist/types/user.js.map +1 -0
  35. package/dist/users/index.js +209 -0
  36. package/dist/users/index.js.map +1 -0
  37. package/dist/utils/SmartContractAbis.js +84 -0
  38. package/dist/utils/SmartContractAbis.js.map +1 -0
  39. package/dist/utils/SmartContractService.js +9 -0
  40. package/dist/utils/SmartContractService.js.map +1 -0
  41. package/dist/utils/api.js +82 -0
  42. package/dist/utils/api.js.map +1 -0
  43. package/dist/utils/const.js +14 -0
  44. package/dist/utils/const.js.map +1 -0
  45. package/dist/utils/getActivity.js +53 -0
  46. package/dist/utils/getActivity.js.map +1 -0
  47. package/dist/utils/helpers.js +21 -0
  48. package/dist/utils/helpers.js.map +1 -0
  49. package/dist/utils/regex.js +7 -0
  50. package/dist/utils/regex.js.map +1 -0
  51. package/dist/utils/scCalls.js +25 -0
  52. package/dist/utils/scCalls.js.map +1 -0
  53. package/package.json +3 -3
  54. package/dist/236.bundle.js +0 -1
  55. package/dist/644.bundle.js +0 -2
  56. package/dist/644.bundle.js.LICENSE.txt +0 -10
  57. package/dist/index.bundle.js +0 -1
  58. package/dist/second.bundle.js +0 -1
@@ -0,0 +1,569 @@
1
+ import { SuggestOrderBy, GlobalOfferOrderBy, } from '../types/collection';
2
+ import { XOXNOClient } from '../index';
3
+ import { getActivity } from '../utils/getActivity';
4
+ import { isValidCollectionTicker } from '../utils/regex';
5
+ /**
6
+ * CollectionModule provides a set of methods to interact with NFT collections.
7
+ * It includes methods for getting collection profile information, floor price,
8
+ * collection attributes, and searching NFTs within a collection.
9
+ *
10
+ * @example
11
+ * const collectionModule = new CollectionModule();
12
+ */
13
+ export class CollectionModule {
14
+ api;
15
+ constructor() {
16
+ this.api = XOXNOClient.init();
17
+ }
18
+ /**
19
+ * @public
20
+ * @async
21
+ * @function getCollectionProfile
22
+ * @param {string} collection - The ticker of the collection to fetch the profile for.
23
+ * @returns {Promise<ICollectionProfile>} A promise that resolves to the fetched collection profile.
24
+ *
25
+ * This function fetches the profile of a given collection. It takes the following parameter:
26
+ * - collection (string): The ticker of the collection to fetch the profile for.
27
+ *
28
+ * The function first validates the input ticker and checks if it is a valid collection ticker.
29
+ * If it is valid, the function fetches the collection profile using the API.
30
+ * Finally, it returns a promise that resolves to the fetched collection profile.
31
+ */
32
+ getCollectionProfile = async (collection) => {
33
+ if (!isValidCollectionTicker(collection)) {
34
+ throw new Error('Invalid collection ticker: ' + collection);
35
+ }
36
+ const response = await this.api.fetchWithTimeout(`/collection/${collection}/profile`, {
37
+ next: {
38
+ tags: ['getCollectionProfile'],
39
+ revalidate: 30,
40
+ },
41
+ });
42
+ return response;
43
+ };
44
+ /**
45
+ * @public
46
+ * @async
47
+ * @function getDailyTrending
48
+ * @returns {Promise<NftData[]>} A promise that resolves to the array of trending NFTs.
49
+ * This function fetches the top NFTs that are trending today based on their floor and volumes
50
+ */
51
+ getDailyTrending = async () => {
52
+ const response = await this.api.fetchWithTimeout('/nfts/getDailyTrending', {
53
+ next: {
54
+ tags: ['getDailyTrending'],
55
+ revalidate: 180,
56
+ },
57
+ });
58
+ return response;
59
+ };
60
+ /**
61
+ * Fetches the floor price of a collection.
62
+ * @param collection - The ticker of the collection.
63
+ * @param token - The token for the floor price calculation (default: 'EGLD').
64
+ * @returns A Promise that resolves to the collection's floor price as a number.
65
+ * @throws An error if the provided collection ticker is invalid.
66
+ */
67
+ getCollectionFloorPrice = async (collection, token = 'EGLD') => {
68
+ if (!isValidCollectionTicker(collection)) {
69
+ throw new Error('Invalid collection ticker: ' + collection);
70
+ }
71
+ const response = await this.api.fetchWithTimeout(`/collection/${collection}/floor-price`, {
72
+ next: {
73
+ tags: ['getCollectionFloorPrice'],
74
+ },
75
+ params: {
76
+ token,
77
+ },
78
+ });
79
+ return response?.price ? response.price : 0;
80
+ };
81
+ /**
82
+ * @public
83
+ * @async
84
+ * @function getCollectionAttributes
85
+ * @param {string} collection - The ticker of the collection to fetch the attributes for.
86
+ * @returns {Promise<ICollectionAttributes>} A promise that resolves to the fetched collection attributes.
87
+ *
88
+ * This function fetches the attributes of a given collection. It takes the following parameter:
89
+ * - collection (string): The ticker of the collection to fetch the attributes for.
90
+ *
91
+ * The function first validates the input ticker and checks if it is a valid collection ticker.
92
+ * If it is valid, the function fetches the collection attributes using the API.
93
+ * Finally, it returns a promise that resolves to the fetched collection attributes.
94
+ */
95
+ getCollectionAttributes = async (collection) => {
96
+ if (!isValidCollectionTicker(collection)) {
97
+ throw new Error('Invalid collection ticker: ' + collection);
98
+ }
99
+ const response = await this.api.fetchWithTimeout(`/collection/${collection}/attributes`, {
100
+ next: {
101
+ tags: ['getCollectionAttributes'],
102
+ revalidate: 180,
103
+ },
104
+ });
105
+ return response;
106
+ };
107
+ /**
108
+ * Searches for NFTs based on the provided arguments.
109
+ * @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.
110
+ * @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.
111
+ * @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 35.
112
+ */
113
+ getNFTs = async (args) => {
114
+ args?.collections?.forEach((element) => {
115
+ if (!isValidCollectionTicker(element)) {
116
+ throw new Error('Invalid collection ticker: ' + element);
117
+ }
118
+ });
119
+ if (args.top && args.top > 35) {
120
+ throw new Error('Top cannot be greater than 35');
121
+ }
122
+ const ranges = [];
123
+ if (args.priceRange) {
124
+ ranges.push({
125
+ ...args.priceRange,
126
+ field: args.onlyAuctions
127
+ ? 'saleInfo.currentBidShort'
128
+ : 'saleInfo.minBidShort',
129
+ });
130
+ }
131
+ if (args.rankRange) {
132
+ ranges.push({
133
+ ...args.rankRange,
134
+ field: 'metadata.rarity.rank',
135
+ });
136
+ }
137
+ const payloadBody = {
138
+ filters: {
139
+ dataType: args.dataType ?? ['nft'],
140
+ activeAuction: args.onlyAuctions || args.activeAuctions,
141
+ collection: args.collections ?? [],
142
+ onSale: args.onlyOnSale,
143
+ saleInfo: {
144
+ seller: args.listedBy || [],
145
+ marketplace: args.listedOnlyOn || undefined,
146
+ paymentToken: args.listedInToken || [],
147
+ auctionType: args.onlyOnSale
148
+ ? args.onlyAuctions
149
+ ? ['NftBid', 'SftAll']
150
+ : ['Nft', 'SftOnePerPayment']
151
+ : undefined,
152
+ },
153
+ owner: args.ownedBy || [],
154
+ verifiedOnly: args.onlyVerified || false,
155
+ metadata: {
156
+ attributes: args.attributes || undefined,
157
+ },
158
+ range: ranges,
159
+ cp_staked: args.isStaked || undefined,
160
+ },
161
+ applyNftExtraDetails: args.applyNftExtraDetails || true,
162
+ orderBy: args.orderBy || [],
163
+ select: args.onlySelectFields || [],
164
+ includeCount: args.includeCount || false,
165
+ top: args.top || 35,
166
+ skip: args.skip || 0,
167
+ };
168
+ const buffer = Buffer.from(JSON.stringify(payloadBody)).toString('base64');
169
+ const response = await this.api.fetchWithTimeout(`/nft/${buffer}/query`, {
170
+ next: {
171
+ tags: ['getCollectionNFTs'],
172
+ },
173
+ cache: 'no-store',
174
+ });
175
+ return {
176
+ ...response,
177
+ getNextPagePayload: {
178
+ ...args,
179
+ skip: (args.skip ?? 0) + (args.top ?? 35),
180
+ },
181
+ };
182
+ };
183
+ /**
184
+ * @public
185
+ * @async
186
+ * @function suggestResults
187
+ * @param {SuggestNFTsArgs} args - An object containing the necessary parameters to fetch suggested NFT results.
188
+ * @returns {Promise<SuggestResults>} A promise that resolves to the fetched NFT results.
189
+ *
190
+ * This function fetches suggested NFT results based on the provided arguments. It takes an object with the following properties:
191
+ * - name (string): The name to search for (required).
192
+ * - orderBy (SuggestOrderBy[], optional): An array of ordering preferences for the results.
193
+ * - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 35).
194
+ * - skip (number, optional): The number of results to skip (default is 0).
195
+ *
196
+ * The function first validates the input arguments and constructs a payload body with the provided parameters.
197
+ * Then, it converts the payload body into a base64 string and fetches the suggested results using the API.
198
+ * Finally, it returns a promise that resolves to the fetched NFT results.
199
+ */
200
+ suggestResults = async (args) => {
201
+ if (args.top && args.top > 35) {
202
+ throw new Error('Top cannot be greater than 35');
203
+ }
204
+ if (!args.name) {
205
+ throw new Error('Name is required');
206
+ }
207
+ const payloadBody = {
208
+ name: args.name,
209
+ orderBy: args.orderBy || [
210
+ SuggestOrderBy.TotalVolumeHighToLow,
211
+ SuggestOrderBy.FollowersHighToLow,
212
+ SuggestOrderBy.IsVerifiedTrueToFalse,
213
+ SuggestOrderBy.HasImageTrueToFalse,
214
+ ],
215
+ top: args.top || 35,
216
+ skip: args.skip || 0,
217
+ };
218
+ const buffer = Buffer.from(JSON.stringify(payloadBody)).toString('base64');
219
+ return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/search/${buffer}`, {
220
+ next: {
221
+ tags: ['suggestResults'],
222
+ revalidate: 180,
223
+ },
224
+ });
225
+ };
226
+ /**
227
+ * @public
228
+ * @async
229
+ * @function suggestResults
230
+ * @param {string} ticker - The unique collection identifier called ticker
231
+ * @returns {Promise<ListingDistribution[]>} A promise that resolves to the distribution of listings
232
+ */
233
+ collectionListings = async (ticker) => {
234
+ return await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/listingDistribution/${ticker}`, {
235
+ next: {
236
+ tags: ['collectionListings'],
237
+ revalidate: 180,
238
+ },
239
+ });
240
+ };
241
+ /**
242
+ * Retrieves trading history based on the provided arguments.
243
+ *
244
+ * @param {TradincActivityArgs} args - The arguments for filtering the trading activity.
245
+ * @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.
246
+ * @throws {Error} Throws an error if the 'top' argument is greater than 35.
247
+ */
248
+ getTradingActivity = async (args) => {
249
+ return await getActivity(args, this.api);
250
+ };
251
+ /**
252
+ * Fetch collections profiles based on the provided arguments.
253
+ * @param {GetCollectionsArgs} args - The GetCollectionsArgs object containing the search parameters.
254
+ * @returns {Promise<CollectionsNFTsResponse>} A Promise that resolves to the CollectionsNFTsResponse object.
255
+ * @throws An error if the 'top' value is greater than 35.
256
+ */
257
+ getCollections = async (args) => {
258
+ if (args?.top && args.top > 25) {
259
+ throw new Error('Top cannot be greater than 25');
260
+ }
261
+ const payloadBody = {
262
+ skip: args?.skip || 0,
263
+ top: args?.top || 25,
264
+ select: args?.onlySelectFields || [],
265
+ filters: {
266
+ dataType: 'collectionProfile',
267
+ isMintable: args?.onlyMintable || undefined,
268
+ ...(args?.collections &&
269
+ args.collections.length > 0 && {
270
+ collection: args.collections,
271
+ }),
272
+ },
273
+ orderBy: [args?.orderBy || 'statistics.tradeData.weekEgldVolume desc'],
274
+ };
275
+ const buffer = Buffer.from(JSON.stringify(payloadBody)).toString('base64');
276
+ const response = await this.api.fetchWithTimeout(`/collection/${buffer}/query`, {
277
+ next: {
278
+ tags: ['getCollections'],
279
+ revalidate: 180,
280
+ },
281
+ });
282
+ return {
283
+ results: response,
284
+ resultsCount: response.length,
285
+ empty: response.length === 0,
286
+ getNextPagePayload: {
287
+ ...args,
288
+ skip: (args?.skip || 0) + (args?.top || 25),
289
+ },
290
+ hasMoreResults: response.length >= (args?.top || 25),
291
+ };
292
+ };
293
+ /**
294
+ * Fetch global offers based on the provided arguments.
295
+ * @param {GetGlobalOffersArgs} args - The GetCollectionsArgs object containing the search parameters.
296
+ * @returns {Promise<GlobalOffersResult>} A Promise that resolves to the GlobalOffersResult object.
297
+ * @throws An error if the 'top' value is greater than 35.
298
+ */
299
+ getGlobalOffers = async (args) => {
300
+ if (args?.top && args.top > 25) {
301
+ throw new Error('Top cannot be greater than 25');
302
+ }
303
+ const payloadBody = {
304
+ skip: args?.skip || 0,
305
+ top: args?.top || 25,
306
+ select: args?.onlySelectFields || [],
307
+ filters: {
308
+ collection: args?.collections || [],
309
+ withAttributes: args?.withAttributes ?? false,
310
+ isActive: args?.onlyActive ?? true,
311
+ offerId: args?.offerIds,
312
+ owner: args?.ownedBy,
313
+ marketplace: args?.listedOnlyOn,
314
+ range: args?.priceRange
315
+ ? { ...args.priceRange, type: 'priceShort' }
316
+ : undefined,
317
+ attributes: args?.attributes,
318
+ },
319
+ orderBy: [args?.orderBy || GlobalOfferOrderBy.PriceHighToLow],
320
+ };
321
+ const buffer = Buffer.from(JSON.stringify(payloadBody)).toString('base64');
322
+ const response = await this.api.fetchWithTimeout(`/collection/${buffer}/global-offer/query`, {
323
+ next: {
324
+ tags: ['getGlobalOffers'],
325
+ revalidate: 12,
326
+ },
327
+ });
328
+ return {
329
+ ...response,
330
+ getNextPagePayload: {
331
+ ...args,
332
+ skip: (args?.top || 25) + response.lastSkip,
333
+ },
334
+ };
335
+ };
336
+ /**
337
+ * @public
338
+ * @async
339
+ * @function getCollectionVolume
340
+ * @param {string} collection - The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
341
+ * @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
342
+ * @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
343
+ * @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).
344
+ * @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.
345
+ *
346
+ * This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:
347
+ * - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
348
+ * - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
349
+ * - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
350
+ * - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).
351
+ *
352
+ * The function first validates the input collection ticker and checks if it is a valid collection ticker.
353
+ * If it is valid, the function fetches the collection volume data using the API with the specified query parameters.
354
+ * Finally, it returns a promise that resolves to an array of collection volume data.
355
+ */
356
+ getCollectionVolume = async (collection, after, before, bin) => {
357
+ if (!isValidCollectionTicker(collection)) {
358
+ throw new Error('Invalid collection ticker: ' + collection);
359
+ }
360
+ const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getCollectionVolume/${collection}?after=${after}&before=${before}&bin=${bin}`, {
361
+ next: {
362
+ tags: ['getCollectionVolume'],
363
+ revalidate: 180,
364
+ },
365
+ });
366
+ return response;
367
+ };
368
+ /**
369
+ * @public
370
+ * @async
371
+ * @function getMarketplaceVolume
372
+ * @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
373
+ * @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
374
+ * @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).
375
+ * @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.
376
+ *
377
+ * This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:
378
+ * - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
379
+ * - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
380
+ * - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
381
+ * - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).
382
+ *
383
+ * The function first validates the input collection ticker and checks if it is a valid collection ticker.
384
+ * If it is valid, the function fetches the collection volume data using the API with the specified query parameters.
385
+ * Finally, it returns a promise that resolves to an array of collection volume data.
386
+ */
387
+ getMarketplaceVolume = async (after, before, bin) => {
388
+ const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getMarketplaceVolume?after=${after}&before=${before}&bin=${bin}`, {
389
+ next: {
390
+ tags: ['getMarketplaceVolume'],
391
+ revalidate: 180,
392
+ },
393
+ });
394
+ return response;
395
+ };
396
+ /**
397
+ * @public
398
+ * @async
399
+ * @function getCollectionFloor
400
+ * @param {string} collection - The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
401
+ * @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
402
+ * @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
403
+ * @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).
404
+ * @returns {Promise<FloorPriceHistory[]>} A promise that resolves to an array of floor price history data.
405
+ *
406
+ * This function fetches floor data for a given collection within a specified date range and binning period. It takes the following parameters:
407
+ * - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').
408
+ * - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').
409
+ * - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').
410
+ * - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).
411
+ *
412
+ * The function first validates the input collection ticker and checks if it is a valid collection ticker.
413
+ * If it is valid, the function fetches the collection volume data using the API with the specified query parameters.
414
+ * Finally, it returns a promise that resolves to an array of floor price history data.
415
+ */
416
+ getCollectionFloor = async (collection, after, before, bin) => {
417
+ if (!isValidCollectionTicker(collection)) {
418
+ throw new Error('Invalid collection ticker: ' + collection);
419
+ }
420
+ const response = await this.api.fetchWithTimeout(`https://proxy-api.xoxno.com/getCollectionFloor/${collection}?after=${after}&before=${before}&bin=${bin}`, {
421
+ next: {
422
+ tags: ['getCollectionFloor'],
423
+ revalidate: 180,
424
+ },
425
+ });
426
+ return response;
427
+ };
428
+ /**
429
+ * @public
430
+ * @async
431
+ * @function getCollectionOwners
432
+ * @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
433
+ * @returns {Promise<IOwners>} A promise that resolves a struct of collection information about holders
434
+ *
435
+ * This function fetches owner information for a given collection. It takes the following parameter:
436
+ * - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
437
+ *
438
+ * The function first validates the input collection ticker and checks if it is a valid collection ticker.
439
+ * If it is valid, the function fetches the collection owner information using the API.
440
+ * Finally, it returns a promise that resolves a struct of collection information about holders
441
+ */
442
+ getCollectionOwners = async (collection) => {
443
+ if (!isValidCollectionTicker(collection)) {
444
+ throw new Error('Invalid collection ticker: ' + collection);
445
+ }
446
+ const response = await this.api.fetchWithTimeout(`/collection/${collection}/holders`, {
447
+ next: {
448
+ tags: ['getCollectionOwners'],
449
+ revalidate: 500,
450
+ },
451
+ });
452
+ return response;
453
+ };
454
+ /**
455
+ * @public
456
+ * @async
457
+ * @function getExportOwners
458
+ * @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
459
+ * @returns {Promise<ISingleHolder[]>} A promise that resolves an array of holders part of the collection.
460
+ *
461
+ * This function fetches owners information for a given collection. It takes the following parameter:
462
+ * - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
463
+ *
464
+ * The function first validates the input collection ticker and checks if it is a valid collection ticker.
465
+ * If it is valid, the function fetches the collection owner information using the API.
466
+ * Finally, it returns a promise that resolves to an array of collection owner information.
467
+ */
468
+ getExportOwners = async (collection) => {
469
+ if (!isValidCollectionTicker(collection)) {
470
+ throw new Error('Invalid collection ticker: ' + collection);
471
+ }
472
+ const response = await this.api.fetchWithTimeout(`/collection/${collection}/holders?exportHolders=true`, {
473
+ next: {
474
+ tags: ['getExportOwners'],
475
+ },
476
+ });
477
+ return response;
478
+ };
479
+ /**
480
+ * @public
481
+ * @async
482
+ * @function getCollectionsStatistics
483
+ * @param {GetCollectionStatsArgs} args - The filter payload for the collection statsitics
484
+ * @returns {Promise<CollectionStatsResults>} A promise that resolves to a struct with information
485
+ * Finally, it returns a promise that resolves a struct with information
486
+ */
487
+ getCollectionsStatistics = async (args) => {
488
+ if (args?.top && args.top > 25) {
489
+ throw new Error('Top cannot be greater than 25');
490
+ }
491
+ const buffer = Buffer.from(JSON.stringify(args)).toString('base64');
492
+ const response = await this.api.fetchWithTimeout(`/collection/${buffer}/stats/query`, {
493
+ next: {
494
+ tags: ['collectionStatistics'],
495
+ revalidate: 12,
496
+ },
497
+ });
498
+ return {
499
+ ...response,
500
+ getNextPagePayload: {
501
+ ...args,
502
+ skip: args.skip + args.top,
503
+ },
504
+ };
505
+ };
506
+ getAwaitEmpty = async (delay) => {
507
+ return new Promise((resolve) => {
508
+ setTimeout(() => {
509
+ resolve(true);
510
+ }, delay);
511
+ });
512
+ };
513
+ /**
514
+ * @public
515
+ * @async
516
+ * @function getCollectionMintInfo
517
+ * @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
518
+ * @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information
519
+ * Finally, it returns a promise that resolves a struct with information
520
+ */
521
+ getCollectionMintInfo = async ({ ticker, extra, }) => {
522
+ const response = await this.api.fetchWithTimeout(`/collection/${ticker}/drop-info`, {
523
+ next: {
524
+ tags: ['getCollectionMintInfo'],
525
+ revalidate: 12,
526
+ },
527
+ ...extra,
528
+ });
529
+ return response;
530
+ };
531
+ /**
532
+ * @public
533
+ * @async
534
+ * @function getCollectionRanks
535
+ * @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').
536
+ * @returns {Promise<CollectionRanksExport[]>} A promise that resolves to a struct with information
537
+ * Finally, it returns a promise that resolves a struct with information
538
+ */
539
+ getCollectionRanks = async ({ ticker, extra, }) => {
540
+ const response = await this.api.fetchWithTimeout(`/collection/${ticker}/ranks`, {
541
+ next: {
542
+ tags: ['getCollectionRanks'],
543
+ revalidate: 60,
544
+ },
545
+ ...extra,
546
+ });
547
+ return response;
548
+ };
549
+ /**
550
+ * @public
551
+ * @async
552
+ * @function getDropInfo
553
+ * @param {string} collectionTag - The unique ID of the collection part of the launchpad smart contract
554
+ * @param {string} creatorTag - The unique ID of the creator part of the launchpad smart contract
555
+ * @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information
556
+ * Finally, it returns a promise that resolves a struct with information
557
+ */
558
+ getDropInfo = async ({ collectionTag, creatorTag, extra, }) => {
559
+ const response = await this.api.fetchWithTimeout(`/collection/${creatorTag}/${collectionTag}/drop-info`, {
560
+ next: {
561
+ tags: ['getDropInfo'],
562
+ revalidate: 12,
563
+ },
564
+ ...extra,
565
+ });
566
+ return response;
567
+ };
568
+ }
569
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AACA,OAAO,EASL,cAAc,EAQd,kBAAkB,GAMnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,GAAG,CAAc;IACzB;QACE,IAAI,CAAC,GAAG,GAAG,W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kB,GAAG,KAAK,EAAE,EACjC,MAAM,EACN,KAAK,GAIN,EAAoC,EAAE;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,eAAe,MAAM,QAAQ,EAC7B;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,CAAC,oBAAoB,CAAC;gBAC5B,UAAU,EAAE,EAAE;aACf;YACD,GAAG,KAAK;SACT,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF;;;;;;;;OAQG;IACI,WAAW,GAAG,KAAK,EAAE,EAC1B,aAAa,EACb,UAAU,EACV,KAAK,GAKN,EAAkC,EAAE;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,eAAe,UAAU,IAAI,aAAa,YAAY,EACtD;YACE,IAAI,EAAE;gBACJ,IAAI,EAAE,CAAC,aAAa,CAAC;gBACrB,UAAU,EAAE,EAAE;aACf;YACD,GAAG,KAAK;SACT,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;CACH"}
@@ -0,0 +1,50 @@
1
+ import { AssetCategory } from '../types/collection';
2
+ import { XOXNOClient } from '../utils/api';
3
+ export class CommonModule {
4
+ api;
5
+ constructor() {
6
+ this.api = XOXNOClient.init();
7
+ }
8
+ /** Gets all tokens usd price
9
+ * @returns {TokenUSDPrices} User's creator info
10
+ * */
11
+ getTokensUsdPrice = async () => {
12
+ const response = await this.api.fetchWithTimeout(`/tokens/usd-price`);
13
+ return response;
14
+ };
15
+ /** Gets all tokens usd price
16
+ * @returns {TokenUSDPrices} User's creator info
17
+ * */
18
+ getAshSwapAmount = async ({ originalToken, originalTokenValue, paymentToken, }) => {
19
+ const response = await this.api.fetchWithTimeout(`/ash/min-token-quantity`, {
20
+ params: {
21
+ originalToken: originalToken,
22
+ originalTokenValue: originalTokenValue,
23
+ paymentToken: paymentToken,
24
+ },
25
+ });
26
+ return response;
27
+ };
28
+ /**
29
+ * @public
30
+ * @async
31
+ * @function getFungibleTokens
32
+ * @param category - The ticker of the collection.
33
+ * @returns {Promise<FungibleAssetsMap>} A promise that resolves a map of ESDT tokens and their info
34
+ * This function fetches all branded fungible assets and their info
35
+ */
36
+ getFungibleTokens = async (categories = [AssetCategory.ALL], identifiers) => {
37
+ const response = await this.api.fetchWithTimeout(`/tokens`, {
38
+ params: {
39
+ identifiers: identifiers ? identifiers.join(',') : undefined,
40
+ category: categories ? categories.join(',') : undefined,
41
+ },
42
+ next: {
43
+ tags: ['getFungibleTokens'],
44
+ revalidate: 500,
45
+ },
46
+ });
47
+ return response;
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,YAAY;IACf,GAAG,CAAc;IACzB;QACE,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IACD;;UAEM;IACC,iBAAiB,GAAG,KAAK,IAA6B,EAAE;QAC7D,MAAM,QAAQ,GACZ,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAiB,mBAAmB,CAAC,CAAC;QACvE,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF;;UAEM;IACC,gBAAgB,GAAG,KAAK,EAAE,EAC/B,aAAa,EACb,kBAAkB,EAClB,YAAY,GAKb,EAA+B,EAAE;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,yBAAyB,EACzB;YACE,MAAM,EAAE;gBACN,aAAa,EAAE,aAAa;gBAC5B,kBAAkB,EAAE,kBAAkB;gBACtC,YAAY,EAAE,YAAY;aAC3B;SACF,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF;;;;;;;OAOG;IACI,iBAAiB,GAAG,KAAK,EAC9B,aAA8B,CAAC,aAAa,CAAC,GAAG,CAAC,EACjD,WAAsB,EACM,EAAE;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC9C,SAAS,EACT;YACE,MAAM,EAAE;gBACN,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC5D,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;aACxD;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,CAAC,mBAAmB,CAAC;gBAC3B,UAAU,EAAE,GAAG;aAChB;SACF,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;CACH"}
package/dist/index.d.ts CHANGED
@@ -5,3 +5,5 @@ export * from './users';
5
5
  export * from './staking';
6
6
  export * from './utils/api';
7
7
  export * from './common';
8
+ export * from './interactions';
9
+ export * from './launchpad';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './types';
2
+ export * from './collection';
3
+ export * from './nft';
4
+ export * from './users';
5
+ export * from './staking';
6
+ export * from './utils/api';
7
+ export * from './common';
8
+ export * from './interactions';
9
+ export * from './launchpad';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}