@xoxno/sdk-js 0.1.76-alpha → 0.1.77-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 (165) hide show
  1. package/dist/711.heavy.bundle.js +2 -0
  2. package/dist/711.heavy.bundle.js.LICENSE.txt +10 -0
  3. package/{out/cjs → dist}/collection/index.d.ts +13 -5
  4. package/dist/collection/index.d.ts.map +1 -0
  5. package/{out/cjs → dist}/common/index.d.ts +10 -1
  6. package/dist/common/index.d.ts.map +1 -0
  7. package/{out/cjs → dist}/index.large.d.ts +1 -0
  8. package/dist/index.large.d.ts.map +1 -0
  9. package/{out/cjs/index.d.ts → dist/index.light.d.ts} +1 -2
  10. package/dist/index.light.d.ts.map +1 -0
  11. package/{out/cjs → dist}/interactions/index.d.ts +1 -0
  12. package/dist/interactions/index.d.ts.map +1 -0
  13. package/{out/cjs → dist}/launchpad/index.d.ts +1 -0
  14. package/dist/launchpad/index.d.ts.map +1 -0
  15. package/dist/main.heavy.bundle.js +1 -0
  16. package/dist/main.light.bundle.js +1 -0
  17. package/{out/cjs → dist}/nft/index.d.ts +1 -0
  18. package/dist/nft/index.d.ts.map +1 -0
  19. package/{out/cjs → dist}/staking/index.d.ts +1 -0
  20. package/dist/staking/index.d.ts.map +1 -0
  21. package/{out/cjs → dist}/types/collection.d.ts +34 -6
  22. package/dist/types/collection.d.ts.map +1 -0
  23. package/{out/cjs → dist}/types/common.d.ts +10 -0
  24. package/dist/types/common.d.ts.map +1 -0
  25. package/{out/cjs → dist}/types/index.d.ts +1 -0
  26. package/dist/types/index.d.ts.map +1 -0
  27. package/{out/cjs → dist}/types/interactions.d.ts +1 -0
  28. package/dist/types/interactions.d.ts.map +1 -0
  29. package/{out/cjs → dist}/types/nft.d.ts +1 -0
  30. package/dist/types/nft.d.ts.map +1 -0
  31. package/{out/cjs → dist}/types/staking.d.ts +25 -1
  32. package/dist/types/staking.d.ts.map +1 -0
  33. package/{out/cjs → dist}/types/trading.d.ts +1 -0
  34. package/dist/types/trading.d.ts.map +1 -0
  35. package/{out/cjs → dist}/types/user.d.ts +60 -0
  36. package/dist/types/user.d.ts.map +1 -0
  37. package/{out/cjs → dist}/users/index.d.ts +36 -4
  38. package/dist/users/index.d.ts.map +1 -0
  39. package/{out/cjs → dist}/utils/SmartContractAbis.d.ts +1 -0
  40. package/dist/utils/SmartContractAbis.d.ts.map +1 -0
  41. package/{out/cjs → dist}/utils/SmartContractService.d.ts +1 -0
  42. package/dist/utils/SmartContractService.d.ts.map +1 -0
  43. package/{out/cjs → dist}/utils/api.d.ts +1 -0
  44. package/dist/utils/api.d.ts.map +1 -0
  45. package/{out/cjs → dist}/utils/const.d.ts +1 -0
  46. package/dist/utils/const.d.ts.map +1 -0
  47. package/{out/cjs → dist}/utils/getActivity.d.ts +2 -1
  48. package/dist/utils/getActivity.d.ts.map +1 -0
  49. package/{out/cjs → dist}/utils/helpers.d.ts +1 -0
  50. package/dist/utils/helpers.d.ts.map +1 -0
  51. package/{out/cjs → dist}/utils/regex.d.ts +1 -0
  52. package/dist/utils/regex.d.ts.map +1 -0
  53. package/{out/cjs → dist}/utils/scCalls.d.ts +1 -0
  54. package/dist/utils/scCalls.d.ts.map +1 -0
  55. package/package.json +18 -11
  56. package/out/cjs/collection/index.js +0 -625
  57. package/out/cjs/collection/index.js.map +0 -1
  58. package/out/cjs/common/index.js +0 -141
  59. package/out/cjs/common/index.js.map +0 -1
  60. package/out/cjs/index.js +0 -26
  61. package/out/cjs/index.js.map +0 -1
  62. package/out/cjs/index.large.js +0 -19
  63. package/out/cjs/index.large.js.map +0 -1
  64. package/out/cjs/interactions/index.js +0 -678
  65. package/out/cjs/interactions/index.js.map +0 -1
  66. package/out/cjs/launchpad/index.js +0 -158
  67. package/out/cjs/launchpad/index.js.map +0 -1
  68. package/out/cjs/nft/index.js +0 -121
  69. package/out/cjs/nft/index.js.map +0 -1
  70. package/out/cjs/staking/index.js +0 -29
  71. package/out/cjs/staking/index.js.map +0 -1
  72. package/out/cjs/types/collection.js +0 -195
  73. package/out/cjs/types/collection.js.map +0 -1
  74. package/out/cjs/types/common.js +0 -3
  75. package/out/cjs/types/common.js.map +0 -1
  76. package/out/cjs/types/index.js +0 -24
  77. package/out/cjs/types/index.js.map +0 -1
  78. package/out/cjs/types/interactions.js +0 -11
  79. package/out/cjs/types/interactions.js.map +0 -1
  80. package/out/cjs/types/nft.js +0 -3
  81. package/out/cjs/types/nft.js.map +0 -1
  82. package/out/cjs/types/staking.js +0 -15
  83. package/out/cjs/types/staking.js.map +0 -1
  84. package/out/cjs/types/trading.js +0 -52
  85. package/out/cjs/types/trading.js.map +0 -1
  86. package/out/cjs/types/user.js +0 -13
  87. package/out/cjs/types/user.js.map +0 -1
  88. package/out/cjs/users/index.js +0 -335
  89. package/out/cjs/users/index.js.map +0 -1
  90. package/out/cjs/utils/SmartContractAbis.js +0 -103
  91. package/out/cjs/utils/SmartContractAbis.js.map +0 -1
  92. package/out/cjs/utils/SmartContractService.js +0 -13
  93. package/out/cjs/utils/SmartContractService.js.map +0 -1
  94. package/out/cjs/utils/api.js +0 -79
  95. package/out/cjs/utils/api.js.map +0 -1
  96. package/out/cjs/utils/const.js +0 -17
  97. package/out/cjs/utils/const.js.map +0 -1
  98. package/out/cjs/utils/getActivity.js +0 -65
  99. package/out/cjs/utils/getActivity.js.map +0 -1
  100. package/out/cjs/utils/helpers.js +0 -27
  101. package/out/cjs/utils/helpers.js.map +0 -1
  102. package/out/cjs/utils/regex.js +0 -12
  103. package/out/cjs/utils/regex.js.map +0 -1
  104. package/out/cjs/utils/scCalls.js +0 -39
  105. package/out/cjs/utils/scCalls.js.map +0 -1
  106. package/out/src/collection/__tests__/collection.test.js +0 -2
  107. package/out/src/collection/__tests__/collection.test.js.map +0 -1
  108. package/out/src/collection/index.js +0 -2
  109. package/out/src/collection/index.js.map +0 -1
  110. package/out/src/common/index.js +0 -2
  111. package/out/src/common/index.js.map +0 -1
  112. package/out/src/index.js +0 -2
  113. package/out/src/index.js.map +0 -1
  114. package/out/src/index.large.js +0 -2
  115. package/out/src/index.large.js.map +0 -1
  116. package/out/src/interactions/__tests__/market.test.js +0 -2
  117. package/out/src/interactions/__tests__/market.test.js.map +0 -1
  118. package/out/src/interactions/index.js +0 -2
  119. package/out/src/interactions/index.js.map +0 -1
  120. package/out/src/launchpad/__tests__/market.test.js +0 -2
  121. package/out/src/launchpad/__tests__/market.test.js.map +0 -1
  122. package/out/src/launchpad/index.js +0 -2
  123. package/out/src/launchpad/index.js.map +0 -1
  124. package/out/src/nft/__tests__/nft.test.js +0 -2
  125. package/out/src/nft/__tests__/nft.test.js.map +0 -1
  126. package/out/src/nft/index.js +0 -2
  127. package/out/src/nft/index.js.map +0 -1
  128. package/out/src/staking/index.js +0 -2
  129. package/out/src/staking/index.js.map +0 -1
  130. package/out/src/types/collection.js +0 -2
  131. package/out/src/types/collection.js.map +0 -1
  132. package/out/src/types/common.js +0 -2
  133. package/out/src/types/common.js.map +0 -1
  134. package/out/src/types/index.js +0 -2
  135. package/out/src/types/index.js.map +0 -1
  136. package/out/src/types/interactions.js +0 -2
  137. package/out/src/types/interactions.js.map +0 -1
  138. package/out/src/types/nft.js +0 -2
  139. package/out/src/types/nft.js.map +0 -1
  140. package/out/src/types/staking.js +0 -2
  141. package/out/src/types/staking.js.map +0 -1
  142. package/out/src/types/trading.js +0 -2
  143. package/out/src/types/trading.js.map +0 -1
  144. package/out/src/types/user.js +0 -2
  145. package/out/src/types/user.js.map +0 -1
  146. package/out/src/users/__tests__/user.test.js +0 -2
  147. package/out/src/users/__tests__/user.test.js.map +0 -1
  148. package/out/src/users/index.js +0 -2
  149. package/out/src/users/index.js.map +0 -1
  150. package/out/src/utils/SmartContractAbis.js +0 -2
  151. package/out/src/utils/SmartContractAbis.js.map +0 -1
  152. package/out/src/utils/SmartContractService.js +0 -2
  153. package/out/src/utils/SmartContractService.js.map +0 -1
  154. package/out/src/utils/api.js +0 -2
  155. package/out/src/utils/api.js.map +0 -1
  156. package/out/src/utils/const.js +0 -2
  157. package/out/src/utils/const.js.map +0 -1
  158. package/out/src/utils/getActivity.js +0 -2
  159. package/out/src/utils/getActivity.js.map +0 -1
  160. package/out/src/utils/helpers.js +0 -2
  161. package/out/src/utils/helpers.js.map +0 -1
  162. package/out/src/utils/regex.js +0 -2
  163. package/out/src/utils/regex.js.map +0 -1
  164. package/out/src/utils/scCalls.js +0 -2
  165. package/out/src/utils/scCalls.js.map +0 -1
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.XOXNOClient = exports.Chain = void 0;
13
- const const_1 = require("./const");
14
- var Chain;
15
- (function (Chain) {
16
- Chain["MAINNET"] = "1";
17
- Chain["DEVNET"] = "D";
18
- })(Chain || (exports.Chain = Chain = {}));
19
- class XOXNOClient {
20
- constructor(apiUrl = const_1.API_URL, apiKey = '', chain = Chain.MAINNET) {
21
- this.fetchWithTimeout = (path_1, ...args_1) => __awaiter(this, [path_1, ...args_1], void 0, function* (path, options = {}, timeout = 40000) {
22
- var _a, _b;
23
- const headers = Object.assign(Object.assign({ 'Accept-Encoding': 'gzip,deflate,br', Referer: 'https://xoxno.sdk', 'User-Agent': 'XOXNO/1.0/SDK' }, (options.method === 'POST'
24
- ? { 'Content-Type': 'application/json' }
25
- : {})), ((_a = options.headers) !== null && _a !== void 0 ? _a : {}));
26
- const shouldInsertOrigin = typeof path === 'string' && path.startsWith('/');
27
- const url = `${shouldInsertOrigin ? `${this.apiUrl}${path}` : path}${options.params
28
- ? '?' +
29
- Object.keys(options.params)
30
- .map((key) => {
31
- return `${key}=${encodeURIComponent(options.params[key])}`;
32
- })
33
- .join('&')
34
- : ''}`;
35
- const controller = new AbortController();
36
- setTimeout(() => controller.abort(), timeout);
37
- const res = yield fetch(url, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, options), ((options === null || options === void 0 ? void 0 : options.next) && options.next.revalidate
38
- ? {}
39
- : { cache: 'no-store' })), { signal: controller.signal }), (Object.keys(headers).length ? { headers } : {})), { method: (_b = options.method) !== null && _b !== void 0 ? _b : 'GET' }));
40
- if (!res.ok)
41
- throw new Error((yield res.json()).message.toString());
42
- return res.json();
43
- });
44
- this.apiUrl = apiUrl;
45
- this.apiKey = apiKey;
46
- this.chain = chain;
47
- this.config =
48
- chain === Chain.MAINNET
49
- ? {
50
- XO_SC: const_1.XOXNO_SC,
51
- FM_SC: const_1.FM_SC,
52
- DR_SC: const_1.DR_SC,
53
- KG_SC: const_1.KG_SC,
54
- Staking_SC: const_1.Staking_SC,
55
- Manager_SC: const_1.Manager_SC,
56
- P2P_SC: const_1.P2P_SC,
57
- }
58
- : {
59
- XO_SC: const_1.XOXNO_SC_DEV,
60
- FM_SC: const_1.FM_SC,
61
- DR_SC: const_1.DR_SC,
62
- KG_SC: const_1.KG_SC,
63
- Staking_SC: const_1.Staking_SC_DEV,
64
- Manager_SC: const_1.Manager_SC_DEV,
65
- P2P_SC: const_1.P2P_SC_DEV,
66
- };
67
- }
68
- static init({ apiUrl = const_1.API_URL, apiKey = '', chain = Chain.MAINNET, } = {}) {
69
- if (!XOXNOClient.instance) {
70
- if (chain == Chain.DEVNET) {
71
- XOXNOClient.instance = new XOXNOClient(const_1.API_URL_DEV, apiKey, chain);
72
- }
73
- XOXNOClient.instance = new XOXNOClient(apiUrl, apiKey, chain);
74
- }
75
- return XOXNOClient.instance;
76
- }
77
- }
78
- exports.XOXNOClient = XO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,kBAAU;oBACV,MAAM,EAAN,cAAM;iBACP;gBACH,CAAC,CAAC;oBACE,KAAK,EAAE,oBAAY;oBACnB,KAAK,EAAL,aAAK;oBACL,KAAK,EAAL,aAAK;oBACL,KAAK,EAAL,aAAK;oBACL,UAAU,EAAE,sBAAc;oBAC1B,UAAU,EAAE,sBAAc;oBAC1B,MAAM,EAAE,kBAAU;iBACnB,CAAC;IACV,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,EACjB,MAAM,GAAG,eAAO,EAChB,MAAM,GAAG,EAAE,EACX,KAAK,GAAG,KAAK,CAAC,OAAO,MAKlB,EAAE;QACL,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBAC1B,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,mBAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YACrE,CAAC;YACD,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,WAAW,CAAC,QAAQ,CAAC;IAC9B,CAAC;CA4CF;AAzGD,kCAyGC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.P2P_SC_DEV = exports.Manager_SC_DEV = exports.Staking_SC_DEV = exports.XOXNO_SC_DEV = exports.P2P_SC = exports.Manager_SC = exports.Staking_SC = exports.KG_SC = exports.DR_SC = exports.FM_SC = exports.XOXNO_SC = exports.API_URL_DEV = exports.API_URL = void 0;
4
- exports.API_URL = 'https://api.xoxno.com';
5
- exports.API_URL_DEV = 'https://api-dev.xoxno.com';
6
- exports.XOXNO_SC = 'erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8';
7
- exports.FM_SC = 'erd1qqqqqqqqqqqqqpgq705fxpfrjne0tl3ece0rrspykq88mynn4kxs2cg43s';
8
- exports.DR_SC = 'erd1qqqqqqqqqqqqqpgqd9rvv2n378e27jcts8vfwynpx0gfl5ufz6hqhfy0u0';
9
- exports.KG_SC = 'erd1qqqqqqqqqqqqqpgq8xwzu82v8ex3h4ayl5lsvxqxnhecpwyvwe0sf2qj4e';
10
- exports.Staking_SC = 'erd1qqqqqqqqqqqqqpgqvpkd3g3uwludduv3797j54qt6c888wa59w2shntt6z';
11
- exports.Manager_SC = 'erd1qqqqqqqqqqqqqpgqg9fa0dmpn8fu3fnleeqn5zt8rl8mdqjkys5s2gtas7';
12
- exports.P2P_SC = 'erd1qqqqqqqqqqqqqpgq47y8hnct68v6asjv6gxem6h9rumn9frzah0skhxxt6';
13
- exports.XOXNO_SC_DEV = 'erd1qqqqqqqqqqqqqpgqn4fnwl43hhchz9emdy66eh5azzhl599zd8ssxjdyh3';
14
- exports.Staking_SC_DEV = 'erd1qqqqqqqqqqqqqpgqmkt2fvumf0zgum5qd0awl2l46x2pxdgmr5rswjr6r8';
15
- exports.Manager_SC_DEV = 'erd1qqqqqqqqqqqqqpgq6sysl7mga393a850xemfpawaqanf4da5d8ssp3xamn';
16
- exports.P2P_SC_DEV = 'erd1qqqqqqqqqqqqqpgqhuvnvkwwmucdzy3g7pvgvjumjfcgfwf69w2svch5c2';
17
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/utils/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,uBAAuB,CAAC;AAClC,QAAA,WAAW,GAAG,2BAA2B,CAAC;AAE1C,QAAA,QAAQ,GACnB,gEAAgE,CAAC;AACtD,QAAA,KAAK,GAChB,gEAAgE,CAAC;AACtD,QAAA,KAAK,GAChB,gEAAgE,CAAC;AACtD,QAAA,KAAK,GAChB,gEAAgE,CAAC;AACtD,QAAA,UAAU,GACrB,gEAAgE,CAAC;AACtD,QAAA,UAAU,GACrB,gEAAgE,CAAC;AACtD,QAAA,MAAM,GACjB,gEAAgE,CAAC;AAEtD,QAAA,YAAY,GACvB,gEAAgE,CAAC;AACtD,QAAA,cAAc,GACzB,gEAAgE,CAAC;AACtD,QAAA,cAAc,GACzB,gEAAgE,CAAC;AACtD,QAAA,UAAU,GACrB,gEAAgE,CAAC"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getActivity = void 0;
13
- /**
14
- * Fetches the trading activity of the given collections
15
- * @param args - The trading activity arguments
16
- * @param api - The API client
17
- * @returns - The trading activity response
18
- * @throws - If the top is greater than 35
19
- */
20
- const getActivity = (args, api) => __awaiter(void 0, void 0, void 0, function* () {
21
- var _a, _b;
22
- if (args.top && args.top > 35) {
23
- throw new Error('Top cannot be greater than 35');
24
- }
25
- const ranges = [];
26
- if (args.priceRange) {
27
- ranges.push(Object.assign(Object.assign({}, args.priceRange), { field: 'activityData.egldValue' }));
28
- }
29
- if (args.timestampRange) {
30
- ranges.push(Object.assign(Object.assign({}, args.timestampRange), { field: 'timestamp' }));
31
- }
32
- const payloadBody = {
33
- filters: {
34
- activityData: args.from == null && args.to == null
35
- ? {
36
- collection: args.collections,
37
- identifier: args.identifiers || undefined,
38
- }
39
- : undefined,
40
- from: args.from,
41
- to: args.to,
42
- activityAddress: args.wallets || undefined,
43
- source: args.source || undefined,
44
- activityType: args.activityType || undefined,
45
- range: ranges,
46
- },
47
- strictSelect: args.strictSelect,
48
- orderBy: args.orderBy,
49
- select: args.select,
50
- top: args.top || 35,
51
- skip: args.skip || 0,
52
- };
53
- const response = yield api.fetchWithTimeout(`/activity/query`, {
54
- params: {
55
- filter: JSON.stringify(payloadBody),
56
- },
57
- next: {
58
- tags: ['getActivity'],
59
- revalidate: 180,
60
- },
61
- });
62
- return Object.assign(Object.assign({}, response), { getNextPagePayload: Object.assign(Object.assign({}, args), { skip: ((_a = args.skip) !== null && _a !== void 0 ? _a : 0) + ((_b = args.top) !== null && _b !== void 0 ? _b : 35) }), empty: response.resources.length === 0 });
63
- });
64
- exports.getActivity = getActivity;
65
- //# sourceMappingURL=getActivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getActivity.js","sourceRoot":"","sources":["../../../src/utils/getActivity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA;;;;;;GAMG;AACI,MAAM,WAAW,GAAG,CACzB,IAAyB,EACzB,GAAgB,EACkB,EAAE;;IACpC,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,iCACN,IAAI,CAAC,UAAU,KAClB,KAAK,EAAE,wBAAwB,IAC/B,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,iCACN,IAAI,CAAC,cAAc,KACtB,KAAK,EAAE,WAAW,IAClB,CAAC;IACL,CAAC;IAED,MAAM,WAAW,GAA+B;QAC9C,OAAO,EAAE;YACP,YAAY,EACV,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI;gBAClC,CAAC,CAAC;oBACE,UAAU,EAAE,IAAI,CAAC,WAAW;oBAC5B,UAAU,EAAE,IAAI,CAAC,WAAW,IAAI,SAAS;iBAC1C;gBACH,CAAC,CAAC,SAAS;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,eAAe,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS;YAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,SAAS;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,SAAS;YAC5C,KAAK,EAAE,MAAM;SACd;QACD,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;KACrB,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,gBAAgB,CACzC,iBAAiB,EACjB;QACE,MAAM,EAAE;YACN,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;SACpC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC,aAAa,CAAC;YACrB,UAAU,EAAE,GAAG;SAChB;KACF,CACF,CAAC;IAEF,uCACK,QAAQ,KACX,kBAAkB,kCACb,IAAI,KACP,IAAI,EAAE,CAAC,MAAA,IAAI,CAAC,IAAI,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,GAAG,mCAAI,EAAE,CAAC,KAE3C,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,IACtC;AACJ,CAAC,CAAA,CAAC;AAlEW,QAAA,WAAW,eAkEtB"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAddressValid = exports.getIdentifierFromColAndNonce = exports.nonceToHex = void 0;
4
- const address_1 = require("@multiversx/sdk-core/out/address");
5
- const nonceToHex = (nonce) => {
6
- let nonceHex = nonce.toString(16);
7
- if (nonceHex.length % 2 !== 0) {
8
- nonceHex = '0' + nonceHex;
9
- }
10
- return nonceHex;
11
- };
12
- exports.nonceToHex = nonceToHex;
13
- const getIdentifierFromColAndNonce = (collection, nonce) => {
14
- return [collection, (0, exports.nonceToHex)(nonce)].join('-');
15
- };
16
- exports.getIdentifierFromColAndNonce = getIdentifierFromColAndNonce;
17
- const isAddressValid = (address) => {
18
- try {
19
- new address_1.Address(address);
20
- return true && address.includes('erd1');
21
- }
22
- catch (error) {
23
- return false;
24
- }
25
- };
26
- exports.isAddressValid = isAddressValid;
27
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAEpD,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE;IAClD,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEK,MAAM,4BAA4B,GAAG,CAC1C,UAAkB,EAClB,KAAa,EACL,EAAE;IACV,OAAO,CAAC,UAAU,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AALW,QAAA,4BAA4B,gCAKvC;AAEK,MAAM,cAAc,GAAG,CAAC,OAAwB,EAAW,EAAE;IAClE,IAAI,CAAC;QACH,IAAI,iBAAO,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidNftIdentifier = exports.isValidCollectionTicker = void 0;
4
- const isValidCollectionTicker = (ticker) => {
5
- return /^[A-Z0-9]{3,10}-[a-z0-9]{6}$/.test(ticker);
6
- };
7
- exports.isValidCollectionTicker = isValidCollectionTicker;
8
- const isValidNftIdentifier = (identifier) => {
9
- return /^[A-Za-z0-9]{3,10}-[A-Za-z0-9]{6}-[A-Za-z0-9]{2,5}(?:-\d+(?:-[A-Za-z0-9]+)?)?$/.test(identifier);
10
- };
11
- exports.isValidNftIdentifier = isValidNftIdentifier;
12
- //# sourceMappingURL=regex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/utils/regex.ts"],"names":[],"mappings":";;;AAAO,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAW,EAAE;IACjE,OAAO,8BAA8B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC;AAEK,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAW,EAAE;IAClE,OAAO,gFAAgF,CAAC,IAAI,CAC1F,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ContractQueryRunner = void 0;
13
- const index_1 = require("../index");
14
- const resultsParser_1 = require("@multiversx/sdk-core/out/smartcontracts/resultsParser");
15
- const proxyNetworkProvider_1 = require("@multiversx/sdk-network-providers/out/proxyNetworkProvider");
16
- class ContractQueryRunner {
17
- constructor() {
18
- this.parser = new resultsParser_1.ResultsParser();
19
- const api = index_1.XOXNOClient.init().apiUrl;
20
- this.proxy = new proxyNetworkProvider_1.ProxyNetworkProvider(api, {
21
- timeout: 10000,
22
- });
23
- }
24
- runQuery(contract, interaction) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- try {
27
- const queryResponse = yield this.proxy.queryContract(interaction.buildQuery());
28
- return this.parser.parseQueryResponse(queryResponse, interaction.getEndpoint());
29
- }
30
- catch (error) {
31
- console.log(`Unexpected error when running query '${interaction.buildQuery().func}' to sc '${contract.getAddress().bech32()}' `);
32
- console.error(error);
33
- throw error;
34
- }
35
- });
36
- }
37
- }
38
- exports.ContractQueryRunner = ContractQueryRunner;
39
- //# sourceMappingURL=scCalls.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scCalls.js","sourceRoot":"","sources":["../../../src/utils/scCalls.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,oCAAuC;AACvC,yFAAsF;AAKtF,qGAAkG;AAElG,MAAa,mBAAmB;IAI9B;QAFiB,WAAM,GAAkB,IAAI,6BAAa,EAAE,CAAC;QAG3D,MAAM,GAAG,GAAG,mBAAW,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,2CAAoB,CAAC,GAAG,EAAE;YACzC,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAEK,QAAQ,CACZ,QAAuB,EACvB,WAAwB;;YAExB,IAAI,CAAC;gBACH,MAAM,aAAa,GACjB,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC;gBAE3D,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CACnC,aAAa,EACb,WAAW,CAAC,WAAW,EAAE,CAC1B,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CACT,wCACE,WAAW,CAAC,UAAU,EAAE,CAAC,IAC3B,YAAY,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,IAAI,CAC/C,CAAC;gBACF,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAErB,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF;AAlCD,kDAkCC"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});const _index=require("../../index");const _types=require("../../types");describe("CollectionModule",()=>{let collectionModule;const inputCollection="BANANA-e955fd";beforeAll(()=>{_index.XOXNOClient.init();collectionModule=new _index.CollectionModule});beforeEach(async()=>{return new Promise(resolve=>setTimeout(resolve,1e3))});test("getCollectionProfile should return the correct result",async()=>{const collectionModule=new _index.CollectionModule;const result=await collectionModule.getCollectionProfile(inputCollection);expect(result.collection).toEqual(inputCollection)});test("getCollectionProfiles should return the correct results",async()=>{const collectionModule=new _index.CollectionModule;const result=await collectionModule.getCollections();expect(result).toBeDefined();expect(result.results).toHaveLength(25)});it("should get the floor price of a collection",async()=>{const floorPrice=await collectionModule.getCollectionFloorPrice(inputCollection);expect(floorPrice).toBeLessThan(1)});it("should get the collection attributes",async()=>{const attributesInfo=await collectionModule.getCollectionAttributes(inputCollection);expect(attributesInfo).toMatchObject({Accessorie:{Dollars:{attributeOccurrence:260}}})});it("should get the collection trading activity",async()=>{const tradingActivity=await collectionModule.getTradingActivity({collections:[inputCollection],top:1});expect(tradingActivity).toMatchObject({getNextPagePayload:{top:1,skip:1,collections:[inputCollection]}});const tradingActivitySecondPage=await collectionModule.getTradingActivity(tradingActivity.getNextPagePayload);expect(tradingActivitySecondPage).toMatchObject({getNextPagePayload:{top:1,skip:2,collections:[inputCollection]}})});it("should get fetch and filter NFTs from a collection",async()=>{const nfts=await collectionModule.getNFTs({collections:[inputCollection],onlyOnSale:true,auctionType:_types.AuctionTypes.FixedPrice,top:1,onlySelectFields:[_types.FieldsToSelect.Attributes,_types.FieldsToSelect.Name,_types.FieldsToSelect.SaleInfo,_types.FieldsToSelect.Rank,_types.FieldsToSelect.Description,_types.FieldsToSelect.Royalties,_types.FieldsToSelect.Collection]});expect(nfts).toMatchObject({getNextPagePayload:{top:1,skip:1}});const nftsSecondPage=await collectionModule.getNFTs(nfts.getNextPagePayload);expect(nftsSecondPage).toMatchObject({getNextPagePayload:{top:1,skip:2}})})});
2
- //# sourceMappingURL=collection.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/collection/__tests__/collection.test.ts"],"sourcesContent":["import { CollectionModule, XOXNOClient } from '../../index';\nimport { AuctionTypes, FieldsToSelect, SearchNFTsResponse } from '../../types';\n\ndescribe('CollectionModule', () => {\n let collectionModule: CollectionModule;\n const inputCollection = 'BANANA-e955fd';\n beforeAll(() => {\n XOXNOClient.init();\n collectionModule = new CollectionModule();\n });\n\n beforeEach(async () => {\n return new Promise((resolve) => setTimeout(resolve, 1000));\n });\n\n test('getCollectionProfile should return the correct result', async () => {\n const collectionModule = new CollectionModule();\n const result = await collectionModule.getCollectionProfile(inputCollection);\n expect(result.collection).toEqual(inputCollection);\n });\n\n test('getCollectionProfiles should return the correct results', async () => {\n const collectionModule = new CollectionModule();\n const result = await collectionModule.getCollections();\n expect(result).toBeDefined();\n expect(result.results).toHaveLength(25);\n });\n\n it('should get the floor price of a collection', async () => {\n const floorPrice =\n await collectionModule.getCollectionFloorPrice(inputCollection);\n expect(floorPrice).toBeLessThan(1);\n });\n\n it('should get the collection attributes', async () => {\n const attributesInfo =\n await collectionModule.getCollectionAttributes(inputCollection);\n expect(attributesInfo).toMatchObject({\n Accessorie: {\n Dollars: {\n attributeOccurrence: 260,\n },\n },\n });\n });\n\n it('should get the collection trading activity', async () => {\n const tradingActivity = await collectionModule.getTradingActivity({\n collections: [inputCollection],\n top: 1,\n });\n expect(tradingActivity).toMatchObject({\n getNextPagePayload: {\n top: 1,\n skip: 1,\n collections: [inputCollection],\n },\n });\n\n const tradingActivitySecondPage = await collectionModule.getTradingActivity(\n tradingActivity.getNextPagePayload\n );\n expect(tradingActivitySecondPage).toMatchObject({\n getNextPagePayload: {\n top: 1,\n skip: 2,\n collections: [inputCollection],\n },\n });\n });\n\n it('should get fetch and filter NFTs from a collection', async () => {\n const nfts: SearchNFTsResponse = await collectionModule.getNFTs({\n collections: [inputCollection],\n onlyOnSale: true,\n auctionType: AuctionTypes.FixedPrice,\n top: 1,\n onlySelectFields: [\n FieldsToSelect.Attributes,\n FieldsToSelect.Name,\n FieldsToSelect.SaleInfo,\n FieldsToSelect.Rank,\n FieldsToSelect.Description,\n FieldsToSelect.Royalties,\n FieldsToSelect.Collection,\n ],\n });\n expect(nfts).toMatchObject({\n getNextPagePayload: {\n top: 1,\n skip: 1,\n },\n });\n\n const nftsSecondPage = await collectionModule.getNFTs(\n nfts.getNextPagePayload\n );\n expect(nftsSecondPage).toMatchObject({\n getNextPagePayload: {\n top: 1,\n skip: 2,\n },\n });\n });\n});\n"],"names":["describe","collectionModule","inputCollection","beforeAll","XOXNOClient","init","CollectionModule","beforeEach","Promise","resolve","setTimeout","test","result","getCollectionProfile","expect","collection","toEqual","getCollections","toBeDefined","results","toHaveLength","it","floorPrice","getCollectionFloorPrice","toBeLessThan","attributesInfo","getCollectionAttributes","toMatchObject","Accessorie","Dollars","attributeOccurrence","tradingActivity","getTradingActivity","collections","top","getNextPagePayload","skip","tradingActivitySecondPage","nfts","getNFTs","onlyOnSale","auctionType","AuctionTypes","FixedPrice","onlySelectFields","FieldsToSelect","Attributes","Name","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ED,gBAAgBI,kBAAkB,EAEpCrB,OAAOuB,2BAA2BV,aAAa,CAAC,CAC9CQ,mBAAoB,CAClBD,IAAK,EACLE,KAAM,EACNH,YAAa,CAAC/B,gBAAgB,AAChC,CACF,EACF,GAEAmB,GAAG,qDAAsD,UACvD,MAAMiB,KAA2B,MAAMrC,iBAAiBsC,OAAO,CAAC,CAC9DN,YAAa,CAAC/B,gBAAgB,CAC9BsC,WAAY,KACZC,YAAaC,mBAAY,CAACC,UAAU,CACpCT,IAAK,EACLU,iBAAkB,CAChBC,qBAAc,CAACC,UAAU,CACzBD,qBAAc,CAACE,IAAI,CACnBF,qBAAc,CAACG,QAAQ,CACvBH,qBAAc,CAACI,IAAI,CACnBJ,qBAAc,CAACK,WAAW,CAC1BL,qBAAc,CAACM,SAAS,CACxBN,qBAAc,CAACO,UAAU,CAC1B,AACH,GACAtC,OAAOwB,MAAMX,aAAa,CAAC,CACzBQ,mBAAoB,CAClBD,IAAK,EACLE,KAAM,CACR,CACF,GAEA,MAAMiB,eAAiB,MAAMpD,iBAAiBsC,OAAO,CACnDD,KAAKH,kBAAkB,EAEzBrB,OAAOuC,gBAAgB1B,aAAa,CAAC,CACnCQ,mBAAoB,CAClBD,IAAK,EACLE,KAAM,CACR,CACF,EACF,EACF"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CollectionModule",{enumerable:true,get:function(){return CollectionModule}});const _collection=require("../types/collection");const _index=require("../index");const _getActivity=require("../utils/getActivity");const _regex=require("../utils/regex");let CollectionModule=class CollectionModule{api;constructor(){this.api=_index.XOXNOClient.init()}getCollectionProfile=async collection=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/profile`,{next:{tags:["getCollectionProfile"],revalidate:30}});return response};getDailyTrending=async()=>{const response=await this.api.fetchWithTimeout("/nfts/getDailyTrending",{next:{tags:["getDailyTrending"],revalidate:180}});return response};getCollectionFloorPrice=async(collection,token="EGLD")=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/floor-price`,{next:{tags:["getCollectionFloorPrice"]},params:{token}});return response?.price?response.price:0};getCollectionAttributes=async collection=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/attributes`,{next:{tags:["getCollectionAttributes"],revalidate:180}});return response};getNFTs=async args=>{args?.collections?.forEach(element=>{if(!(0,_regex.isValidCollectionTicker)(element)){throw new Error("Invalid collection ticker: "+element)}});if(args.top&&args.top>35){throw new Error("Top cannot be greater than 35")}const ranges=[];if(args.priceRange){ranges.push({...args.priceRange,field:args.auctionType==_collection.AuctionTypes.Auctions?"saleInfo.currentBidShort":"saleInfo.minBidShort"})}if(args.rankRange){ranges.push({...args.rankRange,field:"metadata.rarity.rank"})}const payloadBody={filters:{dataType:args.dataType??["nft"],activeAuction:args.activeAuctions,collection:args.collections??[],onSale:args.onlyOnSale,saleInfo:{seller:args.listedBy||[],marketplace:args.listedOnlyOn||undefined,paymentToken:args.listedInToken||[],auctionType:args.auctionType==_collection.AuctionTypes.Auctions?["NftBid","SftAll"]:args.auctionType==_collection.AuctionTypes.FixedPrice?["Nft","SftOnePerPayment"]:args.auctionType==_collection.AuctionTypes.AllListed?["NftBid","SftAll","Nft","SftOnePerPayment"]:undefined},owner:args.ownedBy||[],verifiedOnly:args.onlyVerified||false,metadata:{attributes:args.attributes||undefined},range:ranges,cp_staked:args.isStaked||undefined},applyNftExtraDetails:args.applyNftExtraDetails,orderBy:args.orderBy||[],select:args.onlySelectFields||[],includeCount:args.includeCount||false,top:args.top||35,skip:args.skip||0};const response=await this.api.fetchWithTimeout(`/nft/query`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["getCollectionNFTs"]},cache:"no-store"});return{...response,getNextPagePayload:{...args,skip:(args.skip??0)+(args.top??35)}}};suggestCollections=async args=>{if(args.top&&args.top>35){throw new Error("Top cannot be greater than 35")}if(!args.name){throw new Error("Name is required")}const payloadBody={name:args.name,top:args.top||35,skip:args.skip||0};return await this.api.fetchWithTimeout(`/collection/search`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["/collection/search"],revalidate:180}})};collectionListingsAnalytics=async ticker=>{return await this.api.fetchWithTimeout(`collection/${ticker}/listing`,{next:{tags:["collection/${ticker}/listing"],revalidate:500}})};getTradingActivity=async args=>{return await (0,_getActivity.getActivity)(args,this.api)};getCollections=async args=>{if(args?.top&&args.top>25){throw new Error("Top cannot be greater than 25")}const payloadBody={skip:args?.skip||0,top:args?.top||25,select:args?.onlySelectFields||[],filters:{dataType:"collectionProfile",isMintable:args?.onlyMintable||undefined,...args?.collections&&args.collections.length>0&&{collection:args.collections}},orderBy:[args?.orderBy||"statistics.tradeData.weekEgldVolume desc"]};const response=await this.api.fetchWithTimeout(`/collection/query`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["getCollections"],revalidate:180}});return{results:response,resultsCount:response.length,empty:response.length===0,getNextPagePayload:{...args,skip:(args?.skip||0)+(args?.top||25)},hasMoreResults:response.length>=(args?.top||25)}};getGlobalOffers=async args=>{if(args?.top&&args.top>25){throw new Error("Top cannot be greater than 25")}const payloadBody={skip:args?.skip||0,top:args?.top||25,select:args?.onlySelectFields||[],filters:{collection:args?.collections||[],withAttributes:args?.withAttributes??false,isActive:args?.onlyActive??true,offerId:args?.offerIds,owner:args?.ownedBy,marketplace:args?.listedOnlyOn,range:args?.priceRange?{...args.priceRange,type:"priceShort"}:undefined,attributes:args?.attributes},orderBy:[args?.orderBy||_collection.GlobalOfferOrderBy.PriceHighToLow]};const response=await this.api.fetchWithTimeout(`/collection/global-offer/query`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["getGlobalOffers"],revalidate:12}});return{...response,getNextPagePayload:{...args,skip:(args?.top||25)+response.lastSkip}}};getCollectionVolume=async(collection,after,before,bin)=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/analytics/volume?startTime=${after}&endTime=${before}&bin=${bin}`,{next:{tags:["getCollectionVolume"],revalidate:180}});return response};getMarketplaceVolume=async(after,before,bin)=>{const response=await this.api.fetchWithTimeout(`/analytics/volume?startTime=${after}&endTime=${before}&bin=${bin}`,{next:{tags:["getMarketplaceVolume"],revalidate:180}});return response};getCollectionOwners=async collection=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/holders`,{next:{tags:["getCollectionOwners"],revalidate:500}});return response};getExportOwners=async collection=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/holders?exportHolders=true`,{next:{tags:["getExportOwners"]}});return response};getCollectionsStatistics=async args=>{if(args?.top&&args.top>25){throw new Error("Top cannot be greater than 25")}const response=await this.api.fetchWithTimeout(`/collection/stats/query`,{params:{filter:JSON.stringify(args)},next:{tags:["collectionStatistics"],revalidate:12}});return{...response,getNextPagePayload:{...args,skip:args.skip+args.top}}};getCollectionStats=async ticker=>{if(!(0,_regex.isValidCollectionTicker)(ticker)){throw new Error("Invalid collection ticker: "+ticker)}return await this.api.fetchWithTimeout(`/collection/${ticker}/stats`,{next:{tags:["collectionStatistics"],revalidate:12}})};getAwaitEmpty=async delay=>{return new Promise(resolve=>{setTimeout(()=>{resolve(true)},delay)})};getCollectionMintInfo=async({ticker,extra})=>{if(!(0,_regex.isValidCollectionTicker)(ticker)){throw new Error("Invalid collection ticker: "+ticker)}const response=await this.api.fetchWithTimeout(`/collection/${ticker}/drop-info`,{next:{tags:[`/collection/${ticker}/drop-info`],revalidate:12},...extra});return response};getCollectionRanks=async({ticker,extra})=>{if(!(0,_regex.isValidCollectionTicker)(ticker)){throw new Error("Invalid collection ticker: "+ticker)}const response=await this.api.fetchWithTimeout(`/collection/${ticker}/ranks`,{next:{tags:[`/collection/${ticker}/ranks`],revalidate:60},...extra});return response};getDropInfo=async({collectionTag,creatorTag,extra})=>{const response=await this.api.fetchWithTimeout(`/collection/${creatorTag}/${collectionTag}/drop-info`,{next:{tags:[`/collection/${creatorTag}/${collectionTag}/drop-info`],revalidate:12},...extra});return response};getCollectionGraphData=async(collection,startTime,endTime,bin)=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/analytics/volume`,{params:{startTime:startTime,endTime:endTime,bin:bin},next:{tags:[`/collection/${collection}/analytics/volume`],revalidate:60}});return response};getPinnedCollections=async()=>{const response=await this.api.fetchWithTimeout(`/collection/pinned`,{next:{tags:[`/collection/pinned`],revalidate:60}});return response};getDrops=async args=>{args?.collections?.forEach(element=>{if(!(0,_regex.isValidCollectionTicker)(element)){throw new Error("Invalid collection ticker: "+element)}});if(args.top&&args.top>35){throw new Error("Top cannot be greater than 35")}const ranges=[];if(args.timeRange){ranges.push({...args.timeRange,field:"startTime"})}const payloadBody={filters:{collection:args.collections??[],verifiedOnly:args.onlyVerified||false,mintToken:args.listedInToken||undefined,range:ranges},orderBy:args.orderBy||[],select:args.onlySelectFields||[],includeCount:args.includeCount||false,top:args.top||35,skip:args.skip||0};const response=await this.api.fetchWithTimeout(`/collection/drops/query`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["/collection/drops/query"]},cache:"no-store"});return{...response,getNextPagePayload:{...args,skip:(args.skip??0)+(args.top??35)}}};getCollectionStakingSummary=async({collection,extra})=>{if(!(0,_regex.isValidCollectionTicker)(collection)){throw new Error("Invalid collection ticker: "+collection)}const response=await this.api.fetchWithTimeout(`/collection/${collection}/staking/summary`,{...extra});return response}};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/collection/index.ts"],"sourcesContent":["import { AnalyticsGraphs, NftData, StakingSummaryPools } from '../types';\nimport {\n CollectionsNFTsResponse,\n GetCollectionsArgs,\n ICollectionAttributes,\n ICollectionProfile,\n SearchNFTs,\n GetNFTsArgs,\n SearchNFTsResponse,\n SuggestNFTsArgs,\n SuggestResults,\n CollectionVolume,\n IOwners,\n ISingleHolder,\n GetGlobalOffersArgs,\n GlobalOffersResult,\n GlobalOfferOrderBy,\n ListingDistribution,\n GetCollectionMintInfo,\n GetCollectionStatsArgs,\n CollectionStatsResults,\n CollectionRanksExport,\n CollectionStatsDoc,\n AuctionTypes,\n GETDropsArgs,\n GetDropsResponse,\n} from '../types/collection';\nimport { TradincActivityArgs, TradingActivityResponse } from '../types/trading';\nimport { XOXNOClient } from '../index';\nimport { getActivity } from '../utils/getActivity';\nimport { isValidCollectionTicker } from '../utils/regex';\n\n/**\n * CollectionModule provides a set of methods to interact with NFT collections.\n * It includes methods for getting collection profile information, floor price,\n * collection attributes, and searching NFTs within a collection.\n *\n * @example\n * const collectionModule = new CollectionModule();\n */\nexport class CollectionModule {\n private api: XOXNOClient;\n constructor() {\n this.api = XOXNOClient.init();\n }\n\n /**\n * @public\n * @async\n * @function getCollectionProfile\n * @param {string} collection - The ticker of the collection to fetch the profile for.\n * @returns {Promise<ICollectionProfile>} A promise that resolves to the fetched collection profile.\n *\n * This function fetches the profile of a given collection. It takes the following parameter:\n * - collection (string): The ticker of the collection to fetch the profile for.\n *\n * The function first validates the input ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection profile using the API.\n * Finally, it returns a promise that resolves to the fetched collection profile.\n */\n public getCollectionProfile = async (\n collection: string\n ): Promise<ICollectionProfile> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<ICollectionProfile>(\n `/collection/${collection}/profile`,\n {\n next: {\n tags: ['getCollectionProfile'],\n revalidate: 30,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getDailyTrending\n * @returns {Promise<NftData[]>} A promise that resolves to the array of trending NFTs.\n * This function fetches the top NFTs that are trending today based on their floor and volumes\n */\n public getDailyTrending = async (): Promise<NftData[]> => {\n const response = await this.api.fetchWithTimeout<NftData[]>(\n '/nfts/getDailyTrending',\n {\n next: {\n tags: ['getDailyTrending'],\n revalidate: 180,\n },\n }\n );\n return response;\n };\n\n /**\n * Fetches the floor price of a collection.\n * @param collection - The ticker of the collection.\n * @param token - The token for the floor price calculation (default: 'EGLD').\n * @returns A Promise that resolves to the collection's floor price as a number.\n * @throws An error if the provided collection ticker is invalid.\n */\n public getCollectionFloorPrice = async (\n collection: string,\n token = 'EGLD'\n ): Promise<number> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<{\n price: number;\n }>(`/collection/${collection}/floor-price`, {\n next: {\n tags: ['getCollectionFloorPrice'],\n },\n params: {\n token,\n },\n });\n return response?.price ? response.price : 0;\n };\n\n /**\n * @public\n * @async\n * @function getCollectionAttributes\n * @param {string} collection - The ticker of the collection to fetch the attributes for.\n * @returns {Promise<ICollectionAttributes>} A promise that resolves to the fetched collection attributes.\n *\n * This function fetches the attributes of a given collection. It takes the following parameter:\n * - collection (string): The ticker of the collection to fetch the attributes for.\n *\n * The function first validates the input ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection attributes using the API.\n * Finally, it returns a promise that resolves to the fetched collection attributes.\n */\n public getCollectionAttributes = async (\n collection: string\n ): Promise<ICollectionAttributes> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<ICollectionAttributes>(\n `/collection/${collection}/attributes`,\n {\n next: {\n tags: ['getCollectionAttributes'],\n revalidate: 180,\n },\n }\n );\n return response;\n };\n\n /**\n * Searches for NFTs based on the provided arguments.\n * @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.\n * @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.\n * @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 35.\n */\n public getNFTs = async (args: GetNFTsArgs): Promise<SearchNFTsResponse> => {\n args?.collections?.forEach((element) => {\n if (!isValidCollectionTicker(element)) {\n throw new Error('Invalid collection ticker: ' + element);\n }\n });\n\n if (args.top && args.top > 35) {\n throw new Error('Top cannot be greater than 35');\n }\n const ranges = [];\n if (args.priceRange) {\n ranges.push({\n ...args.priceRange,\n field:\n args.auctionType == AuctionTypes.Auctions\n ? 'saleInfo.currentBidShort'\n : 'saleInfo.minBidShort',\n });\n }\n if (args.rankRange) {\n ranges.push({\n ...args.rankRange,\n field: 'metadata.rarity.rank',\n });\n }\n const payloadBody: SearchNFTs = {\n filters: {\n dataType: args.dataType ?? ['nft'],\n // @borispoehland Has to be false only if we want to show the expired auctions, undefined to show all, and true only actives\n activeAuction: args.activeAuctions,\n collection: args.collections ?? [],\n onSale: args.onlyOnSale,\n saleInfo: {\n seller: args.listedBy || [],\n marketplace: args.listedOnlyOn || undefined,\n paymentToken: args.listedInToken || [],\n auctionType:\n args.auctionType == AuctionTypes.Auctions\n ? ['NftBid', 'SftAll']\n : args.auctionType == AuctionTypes.FixedPrice\n ? ['Nft', 'SftOnePerPayment']\n : args.auctionType == AuctionTypes.AllListed\n ? ['NftBid', 'SftAll', 'Nft', 'SftOnePerPayment']\n : undefined,\n },\n owner: args.ownedBy || [],\n verifiedOnly: args.onlyVerified || false,\n metadata: {\n attributes: args.attributes || undefined,\n },\n range: ranges,\n cp_staked: args.isStaked || undefined,\n },\n applyNftExtraDetails: args.applyNftExtraDetails,\n orderBy: args.orderBy || [],\n select: args.onlySelectFields || [],\n includeCount: args.includeCount || false,\n top: args.top || 35,\n skip: args.skip || 0,\n };\n\n const response = await this.api.fetchWithTimeout<SearchNFTsResponse>(\n `/nft/query`,\n {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['getCollectionNFTs'],\n },\n cache: 'no-store',\n }\n );\n return {\n ...response,\n getNextPagePayload: {\n ...args,\n skip: (args.skip ?? 0) + (args.top ?? 35),\n },\n };\n };\n\n /**\n * @public\n * @async\n * @function suggestCollections\n * @param {SuggestNFTsArgs} args - An object containing the necessary parameters to fetch suggested collections results.\n * @returns {Promise<SuggestResults>} A promise that resolves to the fetched collections results.\n *\n * This function fetches suggested collections results based on the provided arguments. It takes an object with the following properties:\n * - name (string): The name to search for (required).\n * - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 35).\n * - skip (number, optional): The number of results to skip (default is 0).\n *\n * Finally, it returns a promise that resolves to the fetched collections results.\n */\n public suggestCollections = async (\n args: SuggestNFTsArgs\n ): Promise<SuggestResults> => {\n if (args.top && args.top > 35) {\n throw new Error('Top cannot be greater than 35');\n }\n if (!args.name) {\n throw new Error('Name is required');\n }\n\n const payloadBody: SuggestNFTsArgs = {\n name: args.name,\n top: args.top || 35,\n skip: args.skip || 0,\n };\n\n return await this.api.fetchWithTimeout<SuggestResults>(\n `/collection/search`,\n {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['/collection/search'],\n revalidate: 180,\n },\n }\n );\n };\n\n /**\n * @public\n * @async\n * @function collectionListings\n * @param {string} ticker - The unique collection identifier called ticker\n * @returns {Promise<ListingDistribution[]>} A promise that resolves to the distribution of listings\n */\n public collectionListingsAnalytics = async (\n ticker: string\n ): Promise<ListingDistribution[]> => {\n return await this.api.fetchWithTimeout<ListingDistribution[]>(\n `collection/${ticker}/listing`,\n {\n next: {\n tags: ['collection/${ticker}/listing'],\n revalidate: 500,\n },\n }\n );\n };\n\n /**\n * Retrieves trading history based on the provided arguments.\n *\n * @param {TradincActivityArgs} args - The arguments for filtering the trading activity.\n * @returns {Promise<TradingActivityResponse>} A promise resolving to a TradingActivityResponse object containing the activity.\n * @throws {Error} Throws an error if the 'top' argument is greater than 35.\n */\n public getTradingActivity = async (\n args: TradincActivityArgs\n ): Promise<TradingActivityResponse> => {\n return await getActivity(args, this.api);\n };\n\n /**\n * Fetch collections profiles based on the provided arguments.\n * @param {GetCollectionsArgs} args - The GetCollectionsArgs object containing the search parameters.\n * @returns {Promise<CollectionsNFTsResponse>} A Promise that resolves to the CollectionsNFTsResponse object.\n * @throws An error if the 'top' value is greater than 35.\n */\n public getCollections = async (\n args?: GetCollectionsArgs\n ): Promise<CollectionsNFTsResponse> => {\n if (args?.top && args.top > 25) {\n throw new Error('Top cannot be greater than 25');\n }\n\n const payloadBody = {\n skip: args?.skip || 0,\n top: args?.top || 25,\n select: args?.onlySelectFields || [],\n filters: {\n dataType: 'collectionProfile',\n isMintable: args?.onlyMintable || undefined,\n ...(args?.collections &&\n args.collections.length > 0 && {\n collection: args.collections,\n }),\n },\n orderBy: [args?.orderBy || 'statistics.tradeData.weekEgldVolume desc'],\n };\n\n const response = await this.api.fetchWithTimeout<ICollectionProfile[]>(\n `/collection/query`,\n {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['getCollections'],\n revalidate: 180,\n },\n }\n );\n return {\n results: response,\n resultsCount: response.length,\n empty: response.length === 0,\n getNextPagePayload: {\n ...args,\n skip: (args?.skip || 0) + (args?.top || 25),\n },\n hasMoreResults: response.length >= (args?.top || 25),\n };\n };\n\n /**\n * Fetch global offers based on the provided arguments.\n * @param {GetGlobalOffersArgs} args - The GetCollectionsArgs object containing the search parameters.\n * @returns {Promise<GlobalOffersResult>} A Promise that resolves to the GlobalOffersResult object.\n * @throws An error if the 'top' value is greater than 35.\n */\n public getGlobalOffers = async (\n args?: GetGlobalOffersArgs\n ): Promise<GlobalOffersResult> => {\n if (args?.top && args.top > 25) {\n throw new Error('Top cannot be greater than 25');\n }\n\n const payloadBody = {\n skip: args?.skip || 0,\n top: args?.top || 25,\n select: args?.onlySelectFields || [],\n filters: {\n collection: args?.collections || [],\n withAttributes: args?.withAttributes ?? false,\n isActive: args?.onlyActive ?? true,\n offerId: args?.offerIds,\n owner: args?.ownedBy,\n marketplace: args?.listedOnlyOn,\n range: args?.priceRange\n ? { ...args.priceRange, type: 'priceShort' }\n : undefined,\n attributes: args?.attributes,\n },\n orderBy: [args?.orderBy || GlobalOfferOrderBy.PriceHighToLow],\n };\n\n const response = await this.api.fetchWithTimeout<GlobalOffersResult>(\n `/collection/global-offer/query`,\n {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['getGlobalOffers'],\n revalidate: 12,\n },\n }\n );\n return {\n ...response,\n getNextPagePayload: {\n ...args,\n skip: (args?.top || 25) + response.lastSkip,\n },\n };\n };\n\n /**\n * @public\n * @async\n * @function getCollectionVolume\n * @param {string} collection - The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').\n * @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').\n * @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').\n * @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).\n * @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.\n *\n * This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:\n * - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').\n * - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').\n * - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').\n * - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).\n *\n * The function first validates the input collection ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection volume data using the API with the specified query parameters.\n * Finally, it returns a promise that resolves to an array of collection volume data.\n */\n public getCollectionVolume = async (\n collection: string,\n after: string,\n before: string,\n bin: string\n ): Promise<CollectionVolume[]> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<CollectionVolume[]>(\n `/collection/${collection}/analytics/volume?startTime=${after}&endTime=${before}&bin=${bin}`,\n {\n next: {\n tags: ['getCollectionVolume'],\n revalidate: 180,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getMarketplaceVolume\n * @param {string} after - The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').\n * @param {string} before - The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').\n * @param {string} bin - The binning period for the volume data (e.g., '1d' for 1 day).\n * @returns {Promise<CollectionVolume[]>} A promise that resolves to an array of collection volume data.\n *\n * This function fetches volume data for a given collection within a specified date range and binning period. It takes the following parameters:\n * - collection (string): The ticker of the collection to fetch the volume for (e.g., 'EAPES-8f3c1f').\n * - after (string): The start date (inclusive) of the date range for the volume data (e.g., '2023-04-17').\n * - before (string): The end date (inclusive) of the date range for the volume data (e.g., '2023-04-25').\n * - bin (string): The binning period for the volume data (e.g., '1d' for 1 day).\n *\n * The function first validates the input collection ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection volume data using the API with the specified query parameters.\n * Finally, it returns a promise that resolves to an array of collection volume data.\n */\n public getMarketplaceVolume = async (\n after: string,\n before: string,\n bin: string\n ): Promise<CollectionVolume[]> => {\n const response = await this.api.fetchWithTimeout<CollectionVolume[]>(\n `/analytics/volume?startTime=${after}&endTime=${before}&bin=${bin}`,\n {\n next: {\n tags: ['getMarketplaceVolume'],\n revalidate: 180,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getCollectionOwners\n * @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n * @returns {Promise<IOwners>} A promise that resolves a struct of collection information about holders\n *\n * This function fetches owner information for a given collection. It takes the following parameter:\n * - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n *\n * The function first validates the input collection ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection owner information using the API.\n * Finally, it returns a promise that resolves a struct of collection information about holders\n */\n public getCollectionOwners = async (collection: string): Promise<IOwners> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<IOwners>(\n `/collection/${collection}/holders`,\n\n {\n next: {\n tags: ['getCollectionOwners'],\n revalidate: 500,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getExportOwners\n * @param {string} collection - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n * @returns {Promise<ISingleHolder[]>} A promise that resolves an array of holders part of the collection.\n *\n * This function fetches owners information for a given collection. It takes the following parameter:\n * - collection (string): The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n *\n * The function first validates the input collection ticker and checks if it is a valid collection ticker.\n * If it is valid, the function fetches the collection owner information using the API.\n * Finally, it returns a promise that resolves to an array of collection owner information.\n */\n public getExportOwners = async (\n collection: string\n ): Promise<ISingleHolder[]> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<ISingleHolder[]>(\n `/collection/${collection}/holders?exportHolders=true`,\n\n {\n next: {\n tags: ['getExportOwners'],\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getCollectionsStatistics\n * @param {GetCollectionStatsArgs} args - The filter payload for the collection statsitics\n * @returns {Promise<CollectionStatsResults>} A promise that resolves to a struct with information\n * Finally, it returns a promise that resolves a struct with information\n */\n public getCollectionsStatistics = async (\n args: GetCollectionStatsArgs\n ): Promise<CollectionStatsResults> => {\n if (args?.top && args.top > 25) {\n throw new Error('Top cannot be greater than 25');\n }\n\n const response = await this.api.fetchWithTimeout<CollectionStatsResults>(\n `/collection/stats/query`,\n {\n params: {\n filter: JSON.stringify(args),\n },\n next: {\n tags: ['collectionStatistics'],\n revalidate: 12,\n },\n }\n );\n return {\n ...response,\n getNextPagePayload: {\n ...args,\n skip: args.skip + args.top,\n },\n };\n };\n\n /**\n * @public\n * @async\n * @function getCollectionStats\n * @param {GetCollectionStatsArgs} args - The filter payload for the collection statsitics\n * @returns {Promise<CollectionStatsDoc>} A promise that resolves to a struct with information\n * Finally, it returns a promise that resolves a struct with information\n */\n public getCollectionStats = async (\n ticker: string\n ): Promise<CollectionStatsDoc> => {\n if (!isValidCollectionTicker(ticker)) {\n throw new Error('Invalid collection ticker: ' + ticker);\n }\n\n return await this.api.fetchWithTimeout<CollectionStatsDoc>(\n `/collection/${ticker}/stats`,\n {\n next: {\n tags: ['collectionStatistics'],\n revalidate: 12,\n },\n }\n );\n };\n\n public getAwaitEmpty = async (delay: number): Promise<boolean> => {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true);\n }, delay);\n });\n };\n\n /**\n * @public\n * @async\n * @function getCollectionMintInfo\n * @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n * @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information\n * Finally, it returns a promise that resolves a struct with information\n */\n public getCollectionMintInfo = async ({\n ticker,\n extra,\n }: {\n ticker: string;\n extra?: RequestInit;\n }): Promise<GetCollectionMintInfo> => {\n if (!isValidCollectionTicker(ticker)) {\n throw new Error('Invalid collection ticker: ' + ticker);\n }\n const response = await this.api.fetchWithTimeout<GetCollectionMintInfo>(\n `/collection/${ticker}/drop-info`,\n {\n next: {\n tags: [`/collection/${ticker}/drop-info`],\n revalidate: 12,\n },\n ...extra,\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getCollectionRanks\n * @param {string} ticker - The ticker of the collection to fetch the owner information for (e.g., 'EAPES-8f3c1f').\n * @returns {Promise<CollectionRanksExport[]>} A promise that resolves to a struct with information\n * Finally, it returns a promise that resolves a struct with information\n */\n public getCollectionRanks = async ({\n ticker,\n extra,\n }: {\n ticker: string;\n extra?: RequestInit;\n }): Promise<CollectionRanksExport[]> => {\n if (!isValidCollectionTicker(ticker)) {\n throw new Error('Invalid collection ticker: ' + ticker);\n }\n const response = await this.api.fetchWithTimeout<CollectionRanksExport[]>(\n `/collection/${ticker}/ranks`,\n {\n next: {\n tags: [`/collection/${ticker}/ranks`],\n revalidate: 60,\n },\n ...extra,\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getDropInfo\n * @param {string} collectionTag - The unique ID of the collection part of the launchpad smart contract\n * @param {string} creatorTag - The unique ID of the creator part of the launchpad smart contract\n * @returns {Promise<GetCollectionMintInfo>} A promise that resolves to a struct with information\n * Finally, it returns a promise that resolves a struct with information\n */\n public getDropInfo = async ({\n collectionTag,\n creatorTag,\n extra,\n }: {\n collectionTag: string;\n creatorTag: string;\n extra?: RequestInit;\n }): Promise<GetCollectionMintInfo> => {\n const response = await this.api.fetchWithTimeout<GetCollectionMintInfo>(\n `/collection/${creatorTag}/${collectionTag}/drop-info`,\n {\n next: {\n tags: [`/collection/${creatorTag}/${collectionTag}/drop-info`],\n revalidate: 12,\n },\n ...extra,\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getCollectionGraphData\n * @param category - The ticker of the collection.\n * @returns {Promise<AnalyticsGraphs>} A promise the required analytics data\n * This function gets the global graph data\n */\n public getCollectionGraphData = async (\n collection: string,\n startTime: string,\n endTime: string,\n bin: string\n ): Promise<AnalyticsGraphs> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n const response = await this.api.fetchWithTimeout<AnalyticsGraphs>(\n `/collection/${collection}/analytics/volume`,\n {\n params: {\n startTime: startTime,\n endTime: endTime,\n bin: bin,\n },\n next: {\n tags: [`/collection/${collection}/analytics/volume`],\n revalidate: 60,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getPinnedCollections\n * @returns {Promise<ICollectionProfile[]>} A promise that resolves to the fetched pinned collections.\n */\n public getPinnedCollections = async (): Promise<\n Pick<\n ICollectionProfile,\n | 'name'\n | 'profile'\n | 'collection'\n | 'banner'\n | 'description'\n | 'isMintable'\n | 'creator'\n >[]\n > => {\n const response = await this.api.fetchWithTimeout<\n Pick<\n ICollectionProfile,\n | 'name'\n | 'profile'\n | 'collection'\n | 'banner'\n | 'description'\n | 'isMintable'\n | 'creator'\n >[]\n >(`/collection/pinned`, {\n next: {\n tags: [`/collection/pinned`],\n revalidate: 60,\n },\n });\n return response;\n };\n\n /**\n * Get drops based on the provided arguments.\n * @param {SearchNFTsArgs} args - The SearchNFTsArgs object containing the search parameters.\n * @returns {Promise<SearchNFTsResponse>} A Promise that resolves to the SearchNFTsResponse object.\n * @throws An error if the provided collection ticker is invalid or if the 'top' value is greater than 35.\n */\n public getDrops = async (args: GETDropsArgs): Promise<GetDropsResponse> => {\n args?.collections?.forEach((element) => {\n if (!isValidCollectionTicker(element)) {\n throw new Error('Invalid collection ticker: ' + element);\n }\n });\n\n if (args.top && args.top > 35) {\n throw new Error('Top cannot be greater than 35');\n }\n const ranges = [];\n\n if (args.timeRange) {\n ranges.push({\n ...args.timeRange,\n field: 'startTime',\n });\n }\n const payloadBody = {\n filters: {\n collection: args.collections ?? [],\n verifiedOnly: args.onlyVerified || false,\n mintToken: args.listedInToken || undefined,\n range: ranges,\n },\n orderBy: args.orderBy || [],\n select: args.onlySelectFields || [],\n includeCount: args.includeCount || false,\n top: args.top || 35,\n skip: args.skip || 0,\n };\n\n const response = await this.api.fetchWithTimeout<GetDropsResponse>(\n `/collection/drops/query`,\n {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['/collection/drops/query'],\n },\n cache: 'no-store',\n }\n );\n return {\n ...response,\n getNextPagePayload: {\n ...args,\n skip: (args.skip ?? 0) + (args.top ?? 35),\n },\n };\n };\n\n /** Gets collection staking info\n * @param {String} collection - User's address\n * @returns {StakingSummaryPools[]} Collection's staking info\n * @throws {Error} Throws an error if the collection is invalid\n * */\n public getCollectionStakingSummary = async ({\n collection,\n extra,\n }: {\n collection: string;\n extra?: RequestInit;\n }): Promise<StakingSummaryPools[]> => {\n if (!isValidCollectionTicker(collection)) {\n throw new Error('Invalid collection ticker: ' + collection);\n }\n\n const response = await this.api.fetchWithTimeout<StakingSummaryPools[]>(\n `/collection/${collection}/staking/summary`,\n {\n ...extra,\n }\n );\n return response;\n };\n}\n"],"names":["CollectionModule","api","constructor","XOXNOClient","init","getCollectionProfile","collection","isValidCollectionTicker","Error","response","fetchWithTimeout","next","tags","revalidate","getDailyTrending","getCollectionFloorPrice","token","params","price","getCollectionAttributes","getNFTs","args","collections","forEach","element","top","ranges","priceRange","push","field","auctionType","AuctionTypes","Auctions","rankRange","payloadBody","filters","dataType","activeAuction","activeAuctions","onSale","onlyOnSale","saleInfo","seller","listedBy","marketplace","listedOnlyOn","undefined","paymentToken","listedInToken","FixedPrice","AllListed","owner","ownedBy","verifiedOnly","onlyVerified","metadata","attributes","range","cp_staked","isStaked","applyNftExtraDetails","orderBy","select","onlySelectFields","includeCount","skip","filter","JSON","stringify","cache","getNextPagePayload","suggestCollections","name","collectionListingsAnalytics","ticker","getTradingActivity","getActivity","getCollections","isMintable","onlyMintable","length","results","resultsCount","empty","hasMoreResults","getGlobalOffers","withAttributes","isActive","onlyActive","offerId","offerIds","type","GlobalOfferOrderBy","PriceHighToLow","lastSkip","getCollectionVolume","after","before","bin","getMarketplaceVolume","getCollectionOwners","getExportOwners","getCollectionsStatistics","getCollectionStats","getAwaitEmpty","delay","Promise","resolve","setTimeout","getCollectionMintInfo","extra","getCollectionRanks","getDropInfo","collectionTag","creatorTag","getCollectionGraphData","startTime","endTime","getPinnedCollections","getDrops","timeRange","mintToken","getCollectionStakingSummary"],"rangeMappings":"","mappings":"oGAwCaA,0DAAAA,8CAdN,4CAEqB,uCACA,6CACY,kBAUjC,IAAA,AAAMA,iBAAN,MAAMA,iBACX,AAAQC,GAAiB,AACzBC,cAAc,CACZ,IAAI,CAACD,GAAG,CAAGE,kBAAW,CAACC,IAAI,EAC7B,CAgBA,AAAOC,qBAAuB,MAC5BC,aAEA,GAAI,CAACC,GAAAA,8BAAuB,EAACD,YAAa,CACxC,MAAM,IAAIE,MAAM,8BAAgCF,WAClD,CACA,MAAMG,SAAW,MAAM,IAAI,CAACR,GA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,CACxC,MAAM,IAAIE,MAAM,8BAAgCF,WAClD,CAEA,MAAMG,SAAW,MAAM,IAAI,CAACR,GAAG,CAACS,gBAAgB,CAC9C,CAAC,YAAY,EAAEJ,WAAW,gBAAgB,CAAC,CAC3C,CACE,GAAGwG,KAAK,AACV,GAEF,OAAOrG,QACT,CAAE,AACJ"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CommonModule",{enumerable:true,get:function(){return CommonModule}});const _collection=require("../types/collection");const _api=require("../utils/api");let CommonModule=class CommonModule{api;constructor(){this.api=_api.XOXNOClient.init()}getTokensUsdPrice=async()=>{const response=await this.api.fetchWithTimeout(`/tokens/usd-price`);return response};getAshSwapAmount=async({originalToken,originalTokenValue,paymentToken})=>{const response=await this.api.fetchWithTimeout(`/ash/min-token-quantity`,{params:{originalToken:originalToken,originalTokenValue:originalTokenValue,paymentToken:paymentToken}});return response};getFungibleTokens=async(categories=[_collection.AssetCategory.ALL],identifiers)=>{let params={};if(identifiers){params={identifier:identifiers.join(",")}}if(categories){params={...params,category:categories.join(",")}}const response=await this.api.fetchWithTimeout(`/tokens`,{params});return response};getGlobalGraphData=async(startTime,endTime,bin)=>{const response=await this.api.fetchWithTimeout(`/analytics/volume`,{params:{startTime:startTime,endTime:endTime,bin:bin},next:{tags:["/analytics/volume"],revalidate:60}});return response};getAnalyticsOverview=async()=>{const response=await this.api.fetchWithTimeout(`/analytics/overview`,{next:{tags:["/analytics/overview"],revalidate:60}});return response};suggestResults=async args=>{if(args.top&&args.top>35){throw new Error("Top cannot be greater than 35")}if(!args.name){throw new Error("Name is required")}const payloadBody={name:args.name,top:args.top||35,skip:args.skip||0};return await this.api.fetchWithTimeout(`/search`,{params:{filter:JSON.stringify(payloadBody)},next:{tags:["/search/global"],revalidate:180}})};getExploreStaking=async()=>{const response=await this.api.fetchWithTimeout(`/collection/staking/explore`,{next:{tags:["/collection/staking/explore"],revalidate:60}});return response}};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/common/index.ts"],"sourcesContent":["import {\n AssetCategory,\n FungibleAssetsMap,\n SuggestNFTsArgs,\n SuggestResults,\n} from '../types/collection';\nimport {\n AnalyticsGraphs,\n AshSwapPaymentData,\n StakingExplore,\n StatisticsSummary,\n TokenUSDPrices,\n} from '../types/common';\nimport { XOXNOClient } from '../utils/api';\n\nexport class CommonModule {\n private api: XOXNOClient;\n constructor() {\n this.api = XOXNOClient.init();\n }\n /** Gets all tokens usd price\n * @returns {TokenUSDPrices} User's creator info\n * */\n public getTokensUsdPrice = async (): Promise<TokenUSDPrices> => {\n const response =\n await this.api.fetchWithTimeout<TokenUSDPrices>(`/tokens/usd-price`);\n return response;\n };\n\n /** Gets all tokens usd price\n * @returns {TokenUSDPrices} User's creator info\n * */\n public getAshSwapAmount = async ({\n originalToken,\n originalTokenValue,\n paymentToken,\n }: {\n originalToken: string;\n originalTokenValue: string;\n paymentToken: string;\n }): Promise<AshSwapPaymentData> => {\n const response = await this.api.fetchWithTimeout<AshSwapPaymentData>(\n `/ash/min-token-quantity`,\n {\n params: {\n originalToken: originalToken,\n originalTokenValue: originalTokenValue,\n paymentToken: paymentToken,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getFungibleTokens\n * @param category - The ticker of the collection.\n * @returns {Promise<FungibleAssetsMap>} A promise that resolves a map of ESDT tokens and their info\n * This function fetches all branded fungible assets and their info\n */\n public getFungibleTokens = async (\n categories: AssetCategory[] = [AssetCategory.ALL],\n identifiers?: string[]\n ): Promise<FungibleAssetsMap> => {\n let params = {};\n\n if (identifiers) {\n params = {\n identifier: identifiers.join(','),\n };\n }\n\n if (categories) {\n params = {\n ...params,\n category: categories.join(','),\n };\n }\n const response = await this.api.fetchWithTimeout<FungibleAssetsMap>(\n `/tokens`,\n {\n params,\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getGlobalGraphData\n * @param category - The ticker of the collection.\n * @returns {Promise<AnalyticsGraphs>} A promise the required analytics data\n * This function gets the global graph data\n */\n public getGlobalGraphData = async (\n startTime: string,\n endTime: string,\n bin: string\n ): Promise<AnalyticsGraphs> => {\n const response = await this.api.fetchWithTimeout<AnalyticsGraphs>(\n `/analytics/volume`,\n {\n params: {\n startTime: startTime,\n endTime: endTime,\n bin: bin,\n },\n next: {\n tags: ['/analytics/volume'],\n revalidate: 60,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function getAnalyticsOverview\n * @returns {Promise<StatisticsSummary>} A promise the required analytics data\n * This function gets the global graph data\n */\n public getAnalyticsOverview = async (): Promise<StatisticsSummary> => {\n const response = await this.api.fetchWithTimeout<StatisticsSummary>(\n `/analytics/overview`,\n {\n next: {\n tags: ['/analytics/overview'],\n revalidate: 60,\n },\n }\n );\n return response;\n };\n\n /**\n * @public\n * @async\n * @function suggestResults\n * @param {SuggestNFTsArgs} args - An object containing the necessary parameters to fetch suggested NFT results.\n * @returns {Promise<SuggestResults>} A promise that resolves to the fetched NFT results.\n *\n * This function fetches suggested NFT results based on the provided arguments. It takes an object with the following properties:\n * - name (string): The name to search for (required).\n * - orderBy (SuggestOrderBy[], optional): An array of ordering preferences for the results.\n * - top (number, optional): The maximum number of results to return (default is 35, cannot be greater than 35).\n * - skip (number, optional): The number of results to skip (default is 0).\n *\n * The function first validates the input arguments and constructs a payload body with the provided parameters.\n * Then, it converts the payload body into a base64 string and fetches the suggested results using the API.\n * Finally, it returns a promise that resolves to the fetched NFT results.\n */\n public suggestResults = async (\n args: SuggestNFTsArgs\n ): Promise<SuggestResults> => {\n if (args.top && args.top > 35) {\n throw new Error('Top cannot be greater than 35');\n }\n if (!args.name) {\n throw new Error('Name is required');\n }\n\n const payloadBody: SuggestNFTsArgs = {\n name: args.name,\n top: args.top || 35,\n skip: args.skip || 0,\n };\n\n return await this.api.fetchWithTimeout<SuggestResults>(`/search`, {\n params: {\n filter: JSON.stringify(payloadBody),\n },\n next: {\n tags: ['/search/global'],\n revalidate: 180,\n },\n });\n };\n\n /**\n * @public\n * @async\n * @function getExploreStaking\n * @returns {Promise<StakingExplore[]>} A promise that resolves to the fetched staking explore data.\n * This function fetches the staking explore data.\n */\n public getExploreStaking = async (): Promise<StakingExplore[]> => {\n const response = await this.api.fetchWithTimeout<StakingExplore[]>(\n `/collection/staking/explore`,\n {\n next: {\n tags: ['/collection/staking/explore'],\n revalidate: 60,\n },\n }\n );\n return response;\n };\n}\n"],"names":["CommonModule","api","constructor","XOXNOClient","init","getTokensUsdPrice","response","fetchWithTimeout","getAshSwapAmount","originalToken","originalTokenValue","paymentToken","params","getFungibleTokens","categories","AssetCategory","ALL","identifiers","identifier","join","category","getGlobalGraphData","startTime","endTime","bin","next","tags","revalidate","getAnalyticsOverview","suggestResults","args","top","Error","name","payloadBody","skip","filter","JSON","stringify","getExploreStaking"],"rangeMappings":"","mappings":"oGAeaA,sDAAAA,0CAVN,0CAQqB,gBAErB,IAAA,AAAMA,aAAN,MAAMA,aACX,AAAQC,GAAiB,AACzBC,cAAc,CACZ,IAAI,CAACD,GAAG,CAAGE,gBAAW,CAACC,IAAI,EAC7B,CAIA,AAAOC,kBAAoB,UACzB,MAAMC,SACJ,MAAM,IAAI,CAACL,GAAG,CAACM,gBAAgB,CAAiB,CAAC,iBAAiB,CAAC,EACrE,OAAOD,QACT,CAAE,AAKF,CAAOE,iBAAmB,MAAO,CAC/BC,aAAa,CACbC,kBAAkB,CAClBC,YAAY,CAKb,IACC,MAAML,SAAW,MAAM,IAAI,CAACL,GAAG,CAACM,gBAAgB,CAC9C,CAAC,uBAAuB,CAAC,CACzB,CACEK,OAAQ,CACNH,cAAeA,cACfC,mBAAoBA,mBACpBC,aAAcA,YAChB,CACF,GAEF,OAAOL,QACT,CAAE,AAUF,CAAOO,kBAAoB,MACzBC,WAA8B,CAACC,yBAAa,CAACC,GAAG,CAAC,CACjDC,eAEA,IAAIL,OAAS,CAAC,EAEd,GAAIK,YAAa,CACfL,OAA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BC,WAAY,GACd,CACF,EACF,CAAE,AASF,CAAOY,kBAAoB,UACzB,MAAMjC,SAAW,MAAM,IAAI,CAACL,GAAG,CAACM,gBAAgB,CAC9C,CAAC,2BAA2B,CAAC,CAC7B,CACEkB,KAAM,CACJC,KAAM,CAAC,8BAA8B,CACrCC,WAAY,EACd,CACF,GAEF,OAAOrB,QACT,CAAE,AACJ"}
package/out/src/index.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});_export_star(require("./types"),exports);_export_star(require("./collection"),exports);_export_star(require("./nft"),exports);_export_star(require("./users"),exports);_export_star(require("./staking"),exports);_export_star(require("./utils/api"),exports);_export_star(require("./common"),exports);_export_star(require("./interactions"),exports);_export_star(require("./launchpad"),exports);function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './types';\nexport * from './collection';\nexport * from './nft';\nexport * from './users';\nexport * from './staking';\nexport * from './utils/api';\nexport * from './common';\nexport * from './interactions';\nexport * from './launchpad';\n"],"names":[],"rangeMappings":"","mappings":"2FAAc,yCACA,8CACA,uCACA,yCACA,2CACA,6CACA,0CACA,gDACA"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});_export_star(require("./interactions"),exports);_export_star(require("./launchpad"),exports);function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
2
- //# sourceMappingURL=index.large.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.large.ts"],"sourcesContent":["export * from './interactions';\nexport * from './launchpad';\n"],"names":[],"rangeMappings":"","mappings":"2FAAc,gDACA"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});const _index=require("../../index");describe("SCInteraction",()=>{let sc;beforeAll(async()=>{_index.XOXNOClient.init();sc=await _index.SCInteraction.init()});beforeEach(async()=>{return new Promise(resolve=>setTimeout(resolve,1e3))});it("should return the XOXNO marketplace cut fees from SC",async()=>{const fees=await sc.getMarketplaceFees();expect(fees).toBeDefined();expect(fees).toEqual(100)});it("should return the XOXNO marketplace accepted payment tokens",async()=>{const tokens=await sc.getAcceptedPaymentTokens();expect(tokens).toBeDefined();expect(tokens).toContain("EGLD")});it("should return the XOXNO marketplace global offers unique IDs",async()=>{const global_offer_ids=await sc.getGlobalOfferIDs();expect(global_offer_ids).toBeDefined();expect(global_offer_ids.length).toBeGreaterThan(1)});it("should return the XOXNO listings count",async()=>{const listings=await sc.getListingsCount();expect(listings).toBeDefined();expect(listings).toBeGreaterThan(1)});it("should return the XOXNO custom offers count",async()=>{const listings=await sc.getOffersCount();expect(listings).toBeDefined();expect(listings).toBeGreaterThan(1)});it("should return the XOXNO global offers count",async()=>{const listings=await sc.getGlobalOffersCount();expect(listings).toBeDefined();expect(listings).toBeGreaterThan(1)});it("should return the XOXNO user deposit balance",async()=>{const balance=await sc.getUserPoolBalance("erd1fmd662htrgt07xxd8me09newa9s0euzvpz3wp0c4pz78f83grt9qm6pn57","EGLD",0);expect(balance).toBeDefined();expect(balance).toBeGreaterThan(0)});it("should return the XOXNO unique listed collections",async()=>{const listings=await sc.getCollectionsCount();expect(listings).toBeDefined();expect(listings).toBeGreaterThan(1)});it("should return the XOXNO unique auction IDs of a collection",async()=>{const IDs=await sc.getAuctionIDsForCollection("COW-cd463d");expect(IDs).toBeDefined();expect(IDs.length).toBeGreaterThan(1)});it("should return the XOXNO on sale NFT count of a collection",async()=>{const count=await sc.getCollectionNFTsOnSaleCount("COW-cd463d");expect(count).toBeDefined();expect(count).toBeGreaterThan(10)});it("should return if the collection is listed on XOXNO",async()=>{const isListed=await sc.isCollectionListed("COW-cd463d");expect(isListed).toBeDefined();expect(isListed).toEqual(true)});it("should create the transaction to withdraw auctions",async()=>{const interaction=await sc.withdrawAuctions([1],{address:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",nonce:1},"XO");expect(interaction).toBeDefined();expect(interaction.buildTransaction().toSendable()).toEqual({nonce:1,value:"0",receiver:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",sender:"erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8",gasPrice:1e9,gasLimit:2e7,data:"d2l0aGRyYXdAMDE=",chainID:"1",version:1,options:undefined,guardian:undefined,signature:undefined,guardianSignature:undefined})})});
2
- //# sourceMappingURL=market.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/interactions/__tests__/market.test.ts"],"sourcesContent":["import { SCInteraction, XOXNOClient } from '../../index';\n\ndescribe('SCInteraction', () => {\n let sc: SCInteraction;\n beforeAll(async () => {\n XOXNOClient.init();\n sc = await SCInteraction.init();\n });\n\n beforeEach(async () => {\n return new Promise((resolve) => setTimeout(resolve, 1000));\n });\n\n it('should return the XOXNO marketplace cut fees from SC', async () => {\n const fees = await sc.getMarketplaceFees();\n expect(fees).toBeDefined();\n expect(fees).toEqual(100);\n });\n\n it('should return the XOXNO marketplace accepted payment tokens', async () => {\n const tokens = await sc.getAcceptedPaymentTokens();\n expect(tokens).toBeDefined();\n expect(tokens).toContain('EGLD');\n });\n\n it('should return the XOXNO marketplace global offers unique IDs', async () => {\n const global_offer_ids = await sc.getGlobalOfferIDs();\n expect(global_offer_ids).toBeDefined();\n expect(global_offer_ids.length).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO listings count', async () => {\n const listings = await sc.getListingsCount();\n expect(listings).toBeDefined();\n expect(listings).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO custom offers count', async () => {\n const listings = await sc.getOffersCount();\n expect(listings).toBeDefined();\n expect(listings).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO global offers count', async () => {\n const listings = await sc.getGlobalOffersCount();\n expect(listings).toBeDefined();\n expect(listings).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO user deposit balance', async () => {\n const balance = await sc.getUserPoolBalance(\n 'erd1fmd662htrgt07xxd8me09newa9s0euzvpz3wp0c4pz78f83grt9qm6pn57',\n 'EGLD',\n 0\n );\n expect(balance).toBeDefined();\n expect(balance).toBeGreaterThan(0);\n });\n\n it('should return the XOXNO unique listed collections', async () => {\n const listings = await sc.getCollectionsCount();\n expect(listings).toBeDefined();\n expect(listings).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO unique auction IDs of a collection', async () => {\n const IDs = await sc.getAuctionIDsForCollection('COW-cd463d');\n expect(IDs).toBeDefined();\n expect(IDs.length).toBeGreaterThan(1);\n });\n\n it('should return the XOXNO on sale NFT count of a collection', async () => {\n const count = await sc.getCollectionNFTsOnSaleCount('COW-cd463d');\n expect(count).toBeDefined();\n expect(count).toBeGreaterThan(10);\n });\n\n it('should return if the collection is listed on XOXNO', async () => {\n const isListed = await sc.isCollectionListed('COW-cd463d');\n expect(isListed).toBeDefined();\n expect(isListed).toEqual(true);\n });\n\n it('should create the transaction to withdraw auctions', async () => {\n const interaction = await sc.withdrawAuctions(\n [1],\n {\n address:\n 'erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8',\n nonce: 1,\n },\n 'XO'\n );\n expect(interaction).toBeDefined();\n expect(interaction.buildTransaction().toSendable()).toEqual({\n nonce: 1,\n value: '0',\n receiver:\n 'erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8',\n sender: 'erd1qqqqqqqqqqqqqpgq6wegs2xkypfpync8mn2sa5cmpqjlvrhwz5nqgepyg8',\n gasPrice: 1000000000,\n gasLimit: 20000000,\n data: 'd2l0aGRyYXdAMDE=',\n chainID: '1',\n version: 1,\n options: undefined,\n guardian: undefined,\n signature: undefined,\n guardianSignature: undefined,\n });\n });\n});\n"],"names":["describe","sc","beforeAll","XOXNOClient","init","SCInteraction","beforeEach","Promise","resolve","setTimeout","it","fees","getMarketplaceFees","expect","toBeDefined","toEqual","tokens","getAcceptedPaymentTokens","toContain","global_offer_ids","getGlobalOfferIDs","length","toBeGreaterThan","listings","getListingsCount","getOffersCount","getGlobalOffersCount","balance","getUserPoolBalance","getCollectionsCount","IDs","getAuctionIDsForCollection","count","getCollectionNFTsOnSaleCount","isListed","isCollectionListed","interaction","withdrawAuctions","address","nonce","buildTransaction","toSendable","value","receiver","sender","gasPrice","gasLimit","data","chainID","version","options","undefined","guardian","signature","guardianSignature"],"rangeMappings":"","mappings":"2FAA2C,eAE3CA,SAAS,gBAAiB,KACxB,IAAIC,GACJC,UAAU,UACRC,kBAAW,CAACC,IAAI,GAChBH,GAAK,MAAMI,oBAAa,CAACD,IAAI,EAC/B,GAEAE,WAAW,UACT,OAAO,IAAIC,QAAQ,AAACC,SAAYC,WAAWD,QAAS,KACtD,GAEAE,GAAG,uDAAwD,UACzD,MAAMC,KAAO,MAAMV,GAAGW,kBAAkB,GACxCC,OAAOF,MAAMG,WAAW,GACxBD,OAAOF,MAAMI,OAAO,CAAC,IACvB,GAEAL,GAAG,8DAA+D,UAChE,MAAMM,OAAS,MAAMf,GAAGgB,wBAAwB,GAChDJ,OAAOG,QAAQF,WAAW,GAC1BD,OAAOG,QAAQE,SAAS,CAAC,OAC3B,GAEAR,GAAG,+DAAgE,UACjE,MAAMS,iBAAmB,MAAMlB,GAAGmB,iBAAiB,GACnDP,OAAOM,kBAAkBL,WAAW,GACpCD,OAAOM,iBAAiBE,MAAM,EAAEC,eAAe,CAAC,EAClD,GAEAZ,GAAG,yCAA0C,UAC3C,MAAMa,SAAW,MAAMtB,GAAGuB,gBAAgB,GAC1CX,OAAOU,UAAUT,WAAW,G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OuB,YAAYI,gBAAgB,GAAGC,UAAU,IAAI1B,OAAO,CAAC,CAC1DwB,MAAO,EACPG,MAAO,IACPC,SACE,iEACFC,OAAQ,iEACRC,SAAU,IACVC,SAAU,IACVC,KAAM,mBACNC,QAAS,IACTC,QAAS,EACTC,QAASC,UACTC,SAAUD,UACVE,UAAWF,UACXG,kBAAmBH,SACrB,EACF,EACF"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"SCInteraction",{enumerable:true,get:function(){return SCInteraction}});const _=require("..");const _scCalls=require("../utils/scCalls");const _SmartContractAbis=require("../utils/SmartContractAbis");const _SmartContractService=require("../utils/SmartContractService");const _numerical=require("@multiversx/sdk-core/out/smartcontracts/typesystem/numerical");const _interactions=require("../types/interactions");const _bignumber=_interop_require_default(require("bignumber.js"));const _struct=require("@multiversx/sdk-core/out/smartcontracts/typesystem/struct");const _tokenIdentifier=require("@multiversx/sdk-core/out/smartcontracts/typesystem/tokenIdentifier");const _fields=require("@multiversx/sdk-core/out/smartcontracts/typesystem/fields");const _boolean=require("@multiversx/sdk-core/out/smartcontracts/typesystem/boolean");const _address=require("@multiversx/sdk-core/out/address");const _tokens=require("@multiversx/sdk-core/out/tokens");function _interop_require_default(obj){return obj&&obj.__esModule?obj:{default:obj}}let SCInteraction=class SCInteraction{xo;call;api;constructor(marketAbiXOXNO){this.xo=marketAbiXOXNO;this.call=new _scCalls.ContractQueryRunner;this.api=_.XOXNOClient.init()}static async init(){const config=_.XOXNOClient.init().config;const marketAbiXOXNO=await _SmartContractAbis.SmartContractAbis.getMarket();const xo_abi=(0,_SmartContractService.getSmartContract)(marketAbiXOXNO,config.XO_SC);return new SCInteraction(xo_abi)}async getResult(interaction){return await this.call.runQuery(this.xo,interaction)}getMarketplaceFees=async()=>{const interaction=this.xo.methods.getMarketplaceCutPercentage();const result=await this.getResult(interaction);return parseInt(result.firstValue?.valueOf())};getAcceptedPaymentTokens=async()=>{const interaction=this.xo.methods.getAcceptedTokens();const result=await this.getResult(interaction);return result.firstValue?.valueOf()};getGlobalOfferIDs=async()=>{const interaction=this.xo.methods.getGlobalOffers();const result=await this.getResult(interaction);return result.firstValue?.valueOf().map(id=>parseInt(id))};async getUserPoolBalance(address,token,nonce){const result=await this.getResult(this.xo.methods.userDeposit([address,token,nonce]));if(!result?.firstValue){return 0}return new _numerical.BigUIntValue(result.firstValue.valueOf().amount).valueOf().shiftedBy(-18).toNumber()}isOfferActive(offer_price,user_balance){return offer_price<=user_balance}getGlobalOfferData=async global_offer_id=>{const interaction=this.xo.methods.getGlobalOffer([global_offer_id]);const result=await this.getResult(interaction);const body=result.firstValue?.valueOf();body.offer_id=parseInt(body.offer_id.valueOf());body.marketplace="XO";body.short_price=parseFloat(new _numerical.BigUIntValue(body.price).valueOf().shiftedBy(-18).toString());body.new_version=Boolean(body.new_version);if(!body.new_version){body.isActive=this.isOfferActive(body.short_price,await this.getUserPoolBalance(body.owner,body.payment_token,body.payment_nonce))}else{body.isActive=true}body.quantity=parseInt(body.quantity.valueOf());body.payment_nonce=parseInt(body.payment_nonce.valueOf());body.price=body.price.valueOf();body.timestamp=parseInt(body.timestamp.valueOf());body.owner=body.owner.valueOf().toString();if(body.attributes){body.attributes=JSON.parse(Buffer.from(body.attributes.valueOf().toString(),"base64").toString("ascii"))}return body};getAuctionInfo=async auctionID=>{const interaction=this.xo.methods.getFullAuctionData([auctionID]);const result=await this.getResult(interaction);const body=result.firstValue?.valueOf();if(!body){return null}body.auctioned_token_nonce=parseInt(body.auctioned_token_nonce.valueOf());body.nr_auctioned_tokens=parseInt(body.nr_auctioned_tokens.valueOf());body.auction_type=body.auction_type.name;body.payment_token_nonce=parseInt(body.payment_token_nonce.valueOf());body.min_bid=body.min_bid.valueOf();body.max_bid=body.max_bid.valueOf();body.start_time=parseInt(body.start_time.valueOf());body.deadline=parseInt(body.deadline.valueOf());body.original_owner=body.original_owner.valueOf().toString();body.current_winner=body.current_winner.valueOf().toString();body.current_bid=body.current_bid.valueOf().toString();body.marketplace_cut_percentage=body.marketplace_cut_percentage.valueOf();body.creator_royalties_percentage=body.creator_royalties_percentage.valueOf();return body};async getListingsCount(){const result=await this.getResult(this.xo.methods.getListingsCount());const count=parseInt(result.firstValue?.valueOf());return count}async getOffersCount(){const result=await this.getResult(this.xo.methods.getOffersCount());const count=parseInt(result.firstValue?.valueOf());return count}async getGlobalOffersCount(){const result=await this.getResult(this.xo.methods.getGlobalOffersCount());const count=parseInt(result.firstValue?.valueOf());return count}async getCollectionsCount(){const result=await this.getResult(this.xo.methods.getCollectionsCount());const count=parseInt(result.firstValue?.valueOf());return count}async isCollectionListed(collection){const result=await this.getResult(this.xo.methods.isCollectionListed([collection]));return Boolean(result.firstValue?.valueOf())}async getCollectionNFTsOnSaleCount(collection){const result=await this.getResult(this.xo.methods.getTokenItemsForSaleCount([collection]));return parseInt(result.firstValue?.valueOf())}async getAuctionIDsForCollection(collection){const result=await this.getResult(this.xo.methods.getAuctionsForTicker([collection]));const ids=result.firstValue?.valueOf().map(id=>parseInt(id));return ids}withdrawAuctions(auctionIDs,senderNonce,market){if(market==="XO"){const interaction=this.xo.methods.withdraw(auctionIDs);if(senderNonce.nonce){interaction.withNonce(senderNonce.nonce)}return interaction.withChainID(this.api.chain).withSender(new _address.Address(senderNonce.address)).withGasLimit(Math.min(6e8,15e6+auctionIDs.length*5e6))}else{throw new Error("Market not supported")}}withdrawGlobalOffer(offerID,senderNonce){const interaction=this.xo.methods.withdrawGlobalOffer([offerID]);if(senderNonce.nonce){interaction.withNonce(senderNonce.nonce)}return interaction.withChainID(this.api.chain).withSender(new _address.Address(senderNonce.address)).withGasLimit(15e6)}acceptGlobalOffer({signature,offer_id,auction_id_opt,nft,address,nonce}){const interaction=signature?this.xo.methods.acceptGlobalOffer([offer_id,auction_id_opt,signature]):this.xo.methods.acceptGlobalOffer([offer_id,auction_id_opt]);interaction.withSender(new _address.Address(address));if(nft){interaction.withSingleESDTNFTTransfer(_tokens.TokenTransfer.semiFungible(nft.collection,nft.nonce,nft.amount??1))}if(nonce){interaction.withNonce(nonce)}return interaction.withChainID(this.api.chain).withGasLimit(3e7)}sendGlobalOffer({payment_token,payment_nonce,price,collection,attributes,depositAmount,address,nonce}){const interaction=attributes?this.xo.methods.sendGlobalOffer([payment_token,payment_nonce,_tokens.TokenTransfer.egldFromAmount(price).toString(),collection,attributes]):this.xo.methods.sendGlobalOffer([payment_token,payment_nonce,_tokens.TokenTransfer.egldFromAmount(price).toString(),collection]);if(nonce){interaction.withNonce(nonce)}interaction.withSender(new _address.Address(address));if(depositAmount){interaction.withValue(_tokens.TokenTransfer.egldFromAmount(depositAmount))}return interaction.withChainID(this.api.chain).withGasLimit(3e7)}sendCustomOffer({payment_token,payment_nonce,price,deadline,nft,depositAmount,address,nonce}){const interaction=this.xo.methods.sendOffer([payment_token,payment_nonce,_tokens.TokenTransfer.egldFromAmount(price).toString(),nft.collection,nft.nonce,nft.amount??1,deadline]);if(nonce){interaction.withNonce(nonce)}interaction.withSender(new _address.Address(address));if(depositAmount){interaction.withValue(_tokens.TokenTransfer.egldFromAmount(depositAmount))}return interaction.withChainID(this.api.chain).withGasLimit(3e7)}withdrawCustomOffer(offerID,senderNonce){const interaction=this.xo.methods.withdrawOffer([offerID]);if(senderNonce.nonce){interaction.withNonce(senderNonce.nonce)}interaction.withSender(new _address.Address(senderNonce.address));return interaction.withChainID(this.api.chain).withGasLimit(15e6)}declineCustomOffer(offerID,sender,nft){const interaction=this.xo.methods.declineOffer([offerID]);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));if(nft){interaction.withSingleESDTNFTTransfer(_tokens.TokenTransfer.semiFungible(nft.collection,nft.nonce,nft.amount??1))}return interaction.withChainID(this.api.chain).withGasLimit(2e7)}acceptCustomOffer(offerID,sender,nft){const interaction=this.xo.methods.acceptOffer([offerID]);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));if(nft){interaction.withSingleESDTNFTTransfer(_tokens.TokenTransfer.semiFungible(nft.collection,nft.nonce,nft.amount??1))}return interaction.withChainID(this.api.chain).withGasLimit(3e7)}endAuction(auctionID,sender,market="XO"){if(market=="XO"){const interaction=this.xo.methods.endAuction([auctionID]);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));return interaction.withChainID(this.api.chain).withGasLimit(15e6)}else{throw new Error("Market not supported")}}bidOnAuctionId(auctionID,collection,nonce,payment,sender){const interaction=this.xo.methods.bid([auctionID,collection,nonce]);if(!payment.amount){throw new Error("Payment amount is required")}if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));if(payment.collection=="EGLD"&&payment.amount){interaction.withValue(_tokens.TokenTransfer.egldFromAmount(payment.amount))}else{interaction.withSingleESDTTransfer(_tokens.TokenTransfer.fungibleFromAmount(payment.collection,payment.amount,payment.decimals??18))}return interaction.withChainID(this.api.chain).withGasLimit(3e7)}bulkBuy(auctionIDs,payment,sender){const interaction=this.xo.methods.bid(auctionIDs);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));if(!payment.amount){throw new Error("Payment amount is required")}if(payment.collection=="EGLD"&&payment.amount){interaction.withValue(_tokens.TokenTransfer.egldFromAmount(payment.amount))}else{interaction.withSingleESDTTransfer(_tokens.TokenTransfer.fungibleFromAmount(payment.collection,payment.amount,payment.decimals??18))}return interaction.withChainID(this.api.chain).withGasLimit(Math.min(6e8,2e7+auctionIDs.length*5e6))}async buyAuctionById({auctionID,collection,nonce,paymentAmount,quantity=1,token="EGLD",withCheck=true,isBigUintPayment=false,address,nonce:senderNonce,isBid=false,decimals=18,market="XO"}){if(market!=="XO"){throw new Error("Market not supported")}if(!auctionID){throw new Error("AuctionID not provided")}let auction=null;if(!paymentAmount||!token||!collection||!nonce||withCheck){auction=await this.getAuctionInfo(auctionID);if(auction===null){throw new Error("Auction not found")}if(auction.auction_type===_interactions.AuctionType.Nft||auction.auction_type===_interactions.AuctionType.SftOnePerPayment){throw new Error("Auction type is not NFT or SftOnePerPayment")}}const paymentToken=auction?.payment_token_type??token;const bigNumber=auction?true:isBigUintPayment;let amount=isBid?auction?.max_bid??paymentAmount:auction?.min_bid??paymentAmount;if(!amount){throw new Error("Payment amount not provided")}const interaction=this.xo.methods.buy([auctionID,auction?.auctioned_token_type??collection,auction?.auctioned_token_nonce??nonce,quantity??1]);if(senderNonce){interaction.withNonce(senderNonce)}interaction.withSender(new _address.Address(address));if(token==="EGLD"){interaction.withValue(bigNumber?_tokens.TokenTransfer.egldFromBigInteger(new _bignumber.default(amount).multipliedBy(quantity)):_tokens.TokenTransfer.egldFromAmount(new _bignumber.default(amount).multipliedBy(quantity)))}else{if(!bigNumber){auction=await this.getAuctionInfo(auctionID);if(auction===null){throw new Error("Auction not found")}amount=isBid?auction.max_bid:auction.min_bid}interaction.withSingleESDTTransfer(_tokens.TokenTransfer.fungibleFromBigInteger(paymentToken,amount,decimals))}return interaction.withChainID(this.api.chain).withGasLimit(2e7)}async changeListing(listings,sender){const fooType=new _struct.StructType("BulkUpdateListing",[new _fields.FieldDefinition("payment_token_type","",new _tokenIdentifier.TokenIdentifierType),new _fields.FieldDefinition("new_price","",new _numerical.BigUIntType),new _fields.FieldDefinition("auction_id","",new _numerical.U64Type),new _fields.FieldDefinition("deadline","",new _numerical.U64Type)]);const structs=[];listings.forEach(({paymentToken,price,auctionID,deadline})=>{structs.push(new _struct.Struct(fooType,[new _fields.Field(new _tokenIdentifier.TokenIdentifierValue(paymentToken),"payment_token_type"),new _fields.Field(new _numerical.BigUIntValue(price),"new_price"),new _fields.Field(new _numerical.U64Value(auctionID),"auction_id"),new _fields.Field(new _numerical.U64Value(deadline),"deadline")]))});const interaction=this.xo.methods.changeListing(structs);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));return interaction.withChainID(this.api.chain).withGasLimit(Math.min(6e8,8e6+listings.length*2e6))}async listNFTs(listings,sender){const fooType=new _struct.StructType("BulkListing",[new _fields.FieldDefinition("min_bid","",new _numerical.BigUIntType),new _fields.FieldDefinition("max_bid","",new _numerical.BigUIntType),new _fields.FieldDefinition("deadline","",new _numerical.U64Type),new _fields.FieldDefinition("accepted_payment_token","",new _tokenIdentifier.TokenIdentifierType),new _fields.FieldDefinition("bid","",new _boolean.BooleanType),new _fields.FieldDefinition("opt_sft_max_one_per_payment","",new _boolean.BooleanType),new _fields.FieldDefinition("opt_start_time","",new _numerical.U64Type),new _fields.FieldDefinition("collection","",new _tokenIdentifier.TokenIdentifierType),new _fields.FieldDefinition("nonce","",new _numerical.U64Type),new _fields.FieldDefinition("nft_amount","",new _numerical.BigUIntType)]);const structs=[];const tokens=[];listings.forEach(listing=>{const decimals=listing.accepted_payment_token_decimals??18;const minBID=new _bignumber.default(listing.min_bid).shiftedBy(decimals);const maxBID=new _bignumber.default(listing.max_bid??0).shiftedBy(decimals);tokens.push(_tokens.TokenTransfer.semiFungible(listing.collection,listing.nonce,listing.nft_amount));structs.push(new _struct.Struct(fooType,[new _fields.Field(new _numerical.BigUIntValue(minBID),"min_bid"),new _fields.Field(new _numerical.BigUIntValue(maxBID),"max_bid"),new _fields.Field(new _numerical.U64Value(new _bignumber.default(listing.deadline??0)),"deadline"),new _fields.Field(new _tokenIdentifier.TokenIdentifierValue(listing.accepted_payment_token??"EGLD"),"accepted_payment_token"),new _fields.Field(new _boolean.BooleanValue(listing.bid??false),"bid"),new _fields.Field(new _boolean.BooleanValue(listing.isSFTPack??false),"opt_sft_max_one_per_payment"),new _fields.Field(new _numerical.U64Value(new _bignumber.default(listing.opt_start_time?listing.opt_start_time:0)),"opt_start_time"),new _fields.Field(new _tokenIdentifier.TokenIdentifierValue(listing.collection),"collection"),new _fields.Field(new _numerical.U64Value(listing.nonce),"nonce"),new _fields.Field(new _numerical.BigUIntValue(new _bignumber.default(listing.nft_amount)),"nft_amount")]))});const interaction=this.xo.methods.listings(structs);if(sender.nonce){interaction.withNonce(sender.nonce)}interaction.withSender(new _address.Address(sender.address));interaction.withMultiESDTNFTTransfer(tokens);return interaction.withChainID(this.api.chain).withGasLimit(Math.min(6e8,8e6+listings.length*2e6))}};
2
- //# sourceMappingURL=index.js.map