@eluvio/elv-client-js 3.1.97 → 3.2.2
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.
- package/dist/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +2 -2
- package/dist/ElvPermissionsClient-min.js +3 -3
- package/dist/src/ElvClient.js +4 -1
- package/dist/src/Utils.js +20 -3
- package/dist/src/index.js +11 -0
- package/dist/src/marketplaceClient/ClientMethods.js +1918 -0
- package/dist/src/marketplaceClient/Configuration.js +29 -0
- package/dist/src/marketplaceClient/Utils.js +304 -0
- package/dist/src/marketplaceClient/index.js +1553 -0
- package/dist/src/walletClient/ClientMethods.js +1828 -0
- package/dist/src/walletClient/Configuration.js +29 -0
- package/dist/src/walletClient/Utils.js +290 -0
- package/dist/src/walletClient/index.js +1459 -0
- package/package.json +5 -3
- package/src/ElvClient.js +4 -1
- package/src/Utils.js +22 -3
- package/src/index.js +7 -0
- package/src/walletClient/ClientMethods.js +1016 -0
- package/src/walletClient/Configuration.js +40 -0
- package/src/walletClient/README.md +185 -0
- package/src/walletClient/Utils.js +234 -0
- package/src/walletClient/index.js +884 -0
- package/testScripts/TestMarketplaceClient.js +25 -0
- package/package-lock.json +0 -22001
|
@@ -0,0 +1,1918 @@
|
|
|
1
|
+
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
2
|
+
|
|
3
|
+
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
|
+
|
|
5
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
|
+
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
|
|
11
|
+
var Utils = require("../Utils");
|
|
12
|
+
|
|
13
|
+
var UrlJoin = require("url-join");
|
|
14
|
+
|
|
15
|
+
var _require = require("./Utils"),
|
|
16
|
+
FormatNFTDetails = _require.FormatNFTDetails,
|
|
17
|
+
FormatNFTMetadata = _require.FormatNFTMetadata,
|
|
18
|
+
FormatNFT = _require.FormatNFT;
|
|
19
|
+
/**
|
|
20
|
+
* Methods
|
|
21
|
+
*
|
|
22
|
+
* @module ClientMethods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* USER INFO */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* <b><i>Requires login</i></b>
|
|
29
|
+
*
|
|
30
|
+
* Retrieve information about the user, including the address, wallet type, and (for custodial users) email address.
|
|
31
|
+
*
|
|
32
|
+
* @methodGroup User
|
|
33
|
+
*
|
|
34
|
+
* @returns {Object} - User info
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
exports.UserInfo = function () {
|
|
39
|
+
if (!this.loggedIn) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
address: this.UserAddress(),
|
|
45
|
+
email: this.__authorization.email,
|
|
46
|
+
walletType: this.__authorization.walletType,
|
|
47
|
+
walletName: this.__authorization.walletName
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* <b><i>Requires login</i></b>
|
|
52
|
+
*
|
|
53
|
+
* Retrieve the address of the current user.
|
|
54
|
+
*
|
|
55
|
+
* @methodGroup User
|
|
56
|
+
*
|
|
57
|
+
* @returns {string} - The address of the current user
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
exports.UserAddress = function () {
|
|
62
|
+
if (!this.loggedIn) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return this.client.utils.DecodeSignedToken(this.AuthToken()).payload.adr;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* <b><i>Requires login</i></b>
|
|
70
|
+
*
|
|
71
|
+
* Retrieve the fund balances for the current user
|
|
72
|
+
*
|
|
73
|
+
* @methodGroup User
|
|
74
|
+
* @returns {Promise<{Object}>} - Returns balances for the user. All values are in USD.
|
|
75
|
+
* <ul>
|
|
76
|
+
* <li>- totalWalletBalance - Total balance of the users sales and wallet balance purchases</li>
|
|
77
|
+
* <li>- availableWalletBalance - Balance available for purchasing items</li>
|
|
78
|
+
* <li>- pendingWalletBalance - Balance unavailable for purchasing items</li>
|
|
79
|
+
* <li>- withdrawableWalletBalance - Amount that is available for withdrawal</li>
|
|
80
|
+
* <li>- usedBalance - <i>(Only included if user has set up Solana link with the Phantom wallet)</i> Available USDC balance of the user's Solana wallet</li>
|
|
81
|
+
* </ul>
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
exports.UserWalletBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
86
|
+
var checkOnboard,
|
|
87
|
+
_yield$this$client$ut,
|
|
88
|
+
balance,
|
|
89
|
+
usage_hold,
|
|
90
|
+
payout_hold,
|
|
91
|
+
stripe_id,
|
|
92
|
+
stripe_payouts_enabled,
|
|
93
|
+
userStripeId,
|
|
94
|
+
userStripeEnabled,
|
|
95
|
+
totalWalletBalance,
|
|
96
|
+
availableWalletBalance,
|
|
97
|
+
pendingWalletBalance,
|
|
98
|
+
withdrawableWalletBalance,
|
|
99
|
+
rootUrl,
|
|
100
|
+
balances,
|
|
101
|
+
_args = arguments;
|
|
102
|
+
|
|
103
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
+
while (1) {
|
|
105
|
+
switch (_context.prev = _context.next) {
|
|
106
|
+
case 0:
|
|
107
|
+
checkOnboard = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
|
|
108
|
+
|
|
109
|
+
if (this.loggedIn) {
|
|
110
|
+
_context.next = 3;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return _context.abrupt("return");
|
|
115
|
+
|
|
116
|
+
case 3:
|
|
117
|
+
_context.t0 = this.client.utils;
|
|
118
|
+
_context.next = 6;
|
|
119
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
120
|
+
path: UrlJoin("as", "wlt", "mkt", "bal"),
|
|
121
|
+
method: "GET",
|
|
122
|
+
headers: {
|
|
123
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
case 6:
|
|
128
|
+
_context.t1 = _context.sent;
|
|
129
|
+
_context.next = 9;
|
|
130
|
+
return _context.t0.ResponseToJson.call(_context.t0, _context.t1);
|
|
131
|
+
|
|
132
|
+
case 9:
|
|
133
|
+
_yield$this$client$ut = _context.sent;
|
|
134
|
+
balance = _yield$this$client$ut.balance;
|
|
135
|
+
usage_hold = _yield$this$client$ut.usage_hold;
|
|
136
|
+
payout_hold = _yield$this$client$ut.payout_hold;
|
|
137
|
+
stripe_id = _yield$this$client$ut.stripe_id;
|
|
138
|
+
stripe_payouts_enabled = _yield$this$client$ut.stripe_payouts_enabled;
|
|
139
|
+
userStripeId = stripe_id;
|
|
140
|
+
userStripeEnabled = stripe_payouts_enabled;
|
|
141
|
+
totalWalletBalance = parseFloat(balance || 0);
|
|
142
|
+
availableWalletBalance = Math.max(0, this.totalWalletBalance - parseFloat(usage_hold || 0));
|
|
143
|
+
pendingWalletBalance = Math.max(0, this.totalWalletBalance - this.availableWalletBalance);
|
|
144
|
+
withdrawableWalletBalance = Math.max(0, this.totalWalletBalance - parseFloat(payout_hold || 0));
|
|
145
|
+
|
|
146
|
+
if (!(checkOnboard && stripe_id && !stripe_payouts_enabled)) {
|
|
147
|
+
_context.next = 28;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Refresh stripe enabled flag
|
|
152
|
+
rootUrl = new URL(UrlJoin(window.location.origin, window.location.pathname)).toString();
|
|
153
|
+
_context.next = 25;
|
|
154
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
155
|
+
path: UrlJoin("as", "wlt", "onb", "stripe"),
|
|
156
|
+
method: "POST",
|
|
157
|
+
body: {
|
|
158
|
+
country: "US",
|
|
159
|
+
mode: this.mode,
|
|
160
|
+
refresh_url: rootUrl.toString(),
|
|
161
|
+
return_url: rootUrl.toString()
|
|
162
|
+
},
|
|
163
|
+
headers: {
|
|
164
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
case 25:
|
|
169
|
+
_context.next = 27;
|
|
170
|
+
return this.UserWalletBalance(false);
|
|
171
|
+
|
|
172
|
+
case 27:
|
|
173
|
+
return _context.abrupt("return", _context.sent);
|
|
174
|
+
|
|
175
|
+
case 28:
|
|
176
|
+
balances = {
|
|
177
|
+
totalWalletBalance: totalWalletBalance,
|
|
178
|
+
availableWalletBalance: availableWalletBalance,
|
|
179
|
+
pendingWalletBalance: pendingWalletBalance,
|
|
180
|
+
withdrawableWalletBalance: withdrawableWalletBalance
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
if (userStripeEnabled) {
|
|
184
|
+
balances.userStripeId = userStripeId;
|
|
185
|
+
balances.userStripeEnabled = userStripeEnabled;
|
|
186
|
+
} // TODO: integrate
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
if(cryptoStore.usdcConnected) {
|
|
190
|
+
balances.usdcBalance = cryptoStore.phantomUSDCBalance;
|
|
191
|
+
}
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
return _context.abrupt("return", balances);
|
|
196
|
+
|
|
197
|
+
case 31:
|
|
198
|
+
case "end":
|
|
199
|
+
return _context.stop();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}, _callee, this);
|
|
203
|
+
}));
|
|
204
|
+
/**
|
|
205
|
+
* <b><i>Requires login</i></b>
|
|
206
|
+
*
|
|
207
|
+
* Returns basic contract info about the items the current user owns, organized by contract address + token ID
|
|
208
|
+
*
|
|
209
|
+
* This method is significantly faster than <a href="#.UserItems">UserItems</a>, but does not include any NFT metadata.
|
|
210
|
+
*
|
|
211
|
+
* @methodGroup User
|
|
212
|
+
*
|
|
213
|
+
* @returns {Promise<Object>} - Basic info about all owned items.
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
exports.UserItemInfo = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
217
|
+
var _this = this;
|
|
218
|
+
|
|
219
|
+
var accountId, nftInfo;
|
|
220
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
221
|
+
while (1) {
|
|
222
|
+
switch (_context2.prev = _context2.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
if (this.loggedIn) {
|
|
225
|
+
_context2.next = 2;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return _context2.abrupt("return", {});
|
|
230
|
+
|
|
231
|
+
case 2:
|
|
232
|
+
accountId = "iusr".concat(Utils.AddressToHash(this.UserAddress()));
|
|
233
|
+
_context2.next = 5;
|
|
234
|
+
return this.client.ethClient.MakeProviderCall({
|
|
235
|
+
methodName: "send",
|
|
236
|
+
args: ["elv_getAccountProfile", [this.client.contentSpaceId, accountId]]
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
case 5:
|
|
240
|
+
this.profileData = _context2.sent;
|
|
241
|
+
|
|
242
|
+
if (!(!this.profileData || !this.profileData.NFTs)) {
|
|
243
|
+
_context2.next = 8;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return _context2.abrupt("return", {});
|
|
248
|
+
|
|
249
|
+
case 8:
|
|
250
|
+
nftInfo = {};
|
|
251
|
+
Object.keys(this.profileData.NFTs).map(function (tenantId) {
|
|
252
|
+
return _this.profileData.NFTs[tenantId].forEach(function (details) {
|
|
253
|
+
var versionHash = (details.TokenUri || "").split("/").find(function (s) {
|
|
254
|
+
return (s || "").startsWith("hq__");
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
if (!versionHash) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (details.TokenHold) {
|
|
262
|
+
details.TokenHoldDate = new Date(parseInt(details.TokenHold) * 1000);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var contractAddress = Utils.FormatAddress(details.ContractAddr);
|
|
266
|
+
var key = "".concat(contractAddress, "-").concat(details.TokenIdStr);
|
|
267
|
+
nftInfo[key] = _objectSpread(_objectSpread({}, details), {}, {
|
|
268
|
+
ContractAddr: Utils.FormatAddress(details.ContractAddr),
|
|
269
|
+
ContractId: "ictr".concat(Utils.AddressToHash(details.ContractAddr)),
|
|
270
|
+
VersionHash: versionHash
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
this.nftInfo = nftInfo;
|
|
275
|
+
return _context2.abrupt("return", this.nftInfo);
|
|
276
|
+
|
|
277
|
+
case 12:
|
|
278
|
+
case "end":
|
|
279
|
+
return _context2.stop();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, _callee2, this);
|
|
283
|
+
}));
|
|
284
|
+
/**
|
|
285
|
+
* <b><i>Requires login</i></b>
|
|
286
|
+
*
|
|
287
|
+
* Retrieve items owned by the current user matching the specified parameters.
|
|
288
|
+
*
|
|
289
|
+
* @methodGroup User
|
|
290
|
+
* @namedParams
|
|
291
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
292
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
293
|
+
* @param {string=} sortBy="created" - Sort order. Options: `default`, `meta/display_name`
|
|
294
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
295
|
+
* @param {string=} filter - Filter results by item name.
|
|
296
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
297
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
298
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
299
|
+
* @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
|
|
300
|
+
*
|
|
301
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
exports.UserItems = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
305
|
+
var _args3 = arguments;
|
|
306
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
307
|
+
while (1) {
|
|
308
|
+
switch (_context3.prev = _context3.next) {
|
|
309
|
+
case 0:
|
|
310
|
+
return _context3.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
311
|
+
mode: "owned"
|
|
312
|
+
}, _args3[0] || {})));
|
|
313
|
+
|
|
314
|
+
case 1:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context3.stop();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}, _callee3, this);
|
|
320
|
+
}));
|
|
321
|
+
/**
|
|
322
|
+
* Return all listings for the current user. Not paginated.
|
|
323
|
+
*
|
|
324
|
+
* @methodGroup User
|
|
325
|
+
* @namedParams
|
|
326
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
327
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
328
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
329
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
330
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
331
|
+
*
|
|
332
|
+
* @returns {Promise<Array<Object>>} - List of current user's listings
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
exports.UserListings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
336
|
+
var _ref5,
|
|
337
|
+
_ref5$sortBy,
|
|
338
|
+
sortBy,
|
|
339
|
+
_ref5$sortDesc,
|
|
340
|
+
sortDesc,
|
|
341
|
+
contractAddress,
|
|
342
|
+
tokenId,
|
|
343
|
+
marketplaceParams,
|
|
344
|
+
_args4 = arguments;
|
|
345
|
+
|
|
346
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
347
|
+
while (1) {
|
|
348
|
+
switch (_context4.prev = _context4.next) {
|
|
349
|
+
case 0:
|
|
350
|
+
_ref5 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref5$sortBy = _ref5.sortBy, sortBy = _ref5$sortBy === void 0 ? "created" : _ref5$sortBy, _ref5$sortDesc = _ref5.sortDesc, sortDesc = _ref5$sortDesc === void 0 ? false : _ref5$sortDesc, contractAddress = _ref5.contractAddress, tokenId = _ref5.tokenId, marketplaceParams = _ref5.marketplaceParams;
|
|
351
|
+
_context4.next = 3;
|
|
352
|
+
return this.FilteredQuery({
|
|
353
|
+
mode: "listings",
|
|
354
|
+
start: 0,
|
|
355
|
+
limit: 10000,
|
|
356
|
+
sortBy: sortBy,
|
|
357
|
+
sortDesc: sortDesc,
|
|
358
|
+
sellerAddress: this.UserAddress(),
|
|
359
|
+
marketplaceParams: marketplaceParams,
|
|
360
|
+
contractAddress: contractAddress,
|
|
361
|
+
tokenId: tokenId
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
case 3:
|
|
365
|
+
return _context4.abrupt("return", _context4.sent.results);
|
|
366
|
+
|
|
367
|
+
case 4:
|
|
368
|
+
case "end":
|
|
369
|
+
return _context4.stop();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, _callee4, this);
|
|
373
|
+
}));
|
|
374
|
+
/**
|
|
375
|
+
* Return all sales for the current user. Not paginated.
|
|
376
|
+
*
|
|
377
|
+
* @methodGroup User
|
|
378
|
+
* @namedParams
|
|
379
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
380
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
381
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
382
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
383
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
384
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
385
|
+
*
|
|
386
|
+
* @returns {Promise<Array<Object>>} - List of current user's sales
|
|
387
|
+
*/
|
|
388
|
+
|
|
389
|
+
exports.UserSales = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
390
|
+
var _ref7,
|
|
391
|
+
_ref7$sortBy,
|
|
392
|
+
sortBy,
|
|
393
|
+
_ref7$sortDesc,
|
|
394
|
+
sortDesc,
|
|
395
|
+
contractAddress,
|
|
396
|
+
tokenId,
|
|
397
|
+
marketplaceParams,
|
|
398
|
+
_args5 = arguments;
|
|
399
|
+
|
|
400
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
401
|
+
while (1) {
|
|
402
|
+
switch (_context5.prev = _context5.next) {
|
|
403
|
+
case 0:
|
|
404
|
+
_ref7 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, _ref7$sortBy = _ref7.sortBy, sortBy = _ref7$sortBy === void 0 ? "created" : _ref7$sortBy, _ref7$sortDesc = _ref7.sortDesc, sortDesc = _ref7$sortDesc === void 0 ? false : _ref7$sortDesc, contractAddress = _ref7.contractAddress, tokenId = _ref7.tokenId, marketplaceParams = _ref7.marketplaceParams;
|
|
405
|
+
_context5.next = 3;
|
|
406
|
+
return this.FilteredQuery({
|
|
407
|
+
mode: "sales",
|
|
408
|
+
start: 0,
|
|
409
|
+
limit: 10000,
|
|
410
|
+
sortBy: sortBy,
|
|
411
|
+
sortDesc: sortDesc,
|
|
412
|
+
sellerAddress: this.UserAddress(),
|
|
413
|
+
marketplaceParams: marketplaceParams,
|
|
414
|
+
contractAddress: contractAddress,
|
|
415
|
+
tokenId: tokenId
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
case 3:
|
|
419
|
+
return _context5.abrupt("return", _context5.sent.results);
|
|
420
|
+
|
|
421
|
+
case 4:
|
|
422
|
+
case "end":
|
|
423
|
+
return _context5.stop();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}, _callee5, this);
|
|
427
|
+
}));
|
|
428
|
+
/* TENANT */
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Retrieve configuration information about the specified tenant, or the tenant associated with the specified contract.
|
|
432
|
+
*
|
|
433
|
+
* This information includes the royalty rate the tenant receives for secondary sales.
|
|
434
|
+
*
|
|
435
|
+
* @methodGroup Tenants
|
|
436
|
+
* @namedParams
|
|
437
|
+
* @param {string=} tenantId - The ID of the tenant for which to retrieve configuration
|
|
438
|
+
* @param {string=} contractAddress - The ID of an nft contract for which to retrieve configuration
|
|
439
|
+
*
|
|
440
|
+
* @returns {Promise<{Object}>} - The tenant configuration
|
|
441
|
+
*/
|
|
442
|
+
|
|
443
|
+
exports.TenantConfiguration = /*#__PURE__*/function () {
|
|
444
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref8) {
|
|
445
|
+
var tenantId, contractAddress;
|
|
446
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
447
|
+
while (1) {
|
|
448
|
+
switch (_context6.prev = _context6.next) {
|
|
449
|
+
case 0:
|
|
450
|
+
tenantId = _ref8.tenantId, contractAddress = _ref8.contractAddress;
|
|
451
|
+
_context6.prev = 1;
|
|
452
|
+
_context6.next = 4;
|
|
453
|
+
return this.utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
454
|
+
path: contractAddress ? UrlJoin("as", "config", "nft", contractAddress) : UrlJoin("as", "config", "tnt", tenantId),
|
|
455
|
+
method: "GET"
|
|
456
|
+
}));
|
|
457
|
+
|
|
458
|
+
case 4:
|
|
459
|
+
return _context6.abrupt("return", _context6.sent);
|
|
460
|
+
|
|
461
|
+
case 7:
|
|
462
|
+
_context6.prev = 7;
|
|
463
|
+
_context6.t0 = _context6["catch"](1);
|
|
464
|
+
this.Log("Failed to load tenant configuration", true);
|
|
465
|
+
this.Log(_context6.t0, true);
|
|
466
|
+
return _context6.abrupt("return", {});
|
|
467
|
+
|
|
468
|
+
case 12:
|
|
469
|
+
case "end":
|
|
470
|
+
return _context6.stop();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}, _callee6, this, [[1, 7]]);
|
|
474
|
+
}));
|
|
475
|
+
|
|
476
|
+
return function (_x) {
|
|
477
|
+
return _ref9.apply(this, arguments);
|
|
478
|
+
};
|
|
479
|
+
}();
|
|
480
|
+
/* MARKETPLACE */
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Retrieve available stock for the specified marketplace, organized by SKU.
|
|
484
|
+
*
|
|
485
|
+
* If a user is logged in, stock information will also include how many of that item the user has purchased.
|
|
486
|
+
*
|
|
487
|
+
* @methodGroup Marketplaces
|
|
488
|
+
* @namedParams
|
|
489
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
490
|
+
*
|
|
491
|
+
* @returns {Promise<Object>} - Stock info for items in the marketplace
|
|
492
|
+
*/
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
exports.MarketplaceStock = /*#__PURE__*/function () {
|
|
496
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
497
|
+
var marketplaceParams, tenantId, marketplaceInfo;
|
|
498
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
499
|
+
while (1) {
|
|
500
|
+
switch (_context7.prev = _context7.next) {
|
|
501
|
+
case 0:
|
|
502
|
+
marketplaceParams = _ref10.marketplaceParams, tenantId = _ref10.tenantId;
|
|
503
|
+
|
|
504
|
+
if (!tenantId) {
|
|
505
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
506
|
+
marketplaceParams: marketplaceParams
|
|
507
|
+
});
|
|
508
|
+
tenantId = marketplaceInfo.tenantId;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (!this.loggedIn) {
|
|
512
|
+
_context7.next = 6;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
_context7.next = 5;
|
|
517
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
518
|
+
path: UrlJoin("as", "wlt", "nft", "info", tenantId),
|
|
519
|
+
method: "GET",
|
|
520
|
+
headers: {
|
|
521
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
522
|
+
}
|
|
523
|
+
}));
|
|
524
|
+
|
|
525
|
+
case 5:
|
|
526
|
+
return _context7.abrupt("return", _context7.sent);
|
|
527
|
+
|
|
528
|
+
case 6:
|
|
529
|
+
_context7.next = 8;
|
|
530
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
531
|
+
path: UrlJoin("as", "nft", "stock", tenantId),
|
|
532
|
+
method: "GET"
|
|
533
|
+
}));
|
|
534
|
+
|
|
535
|
+
case 8:
|
|
536
|
+
return _context7.abrupt("return", _context7.sent);
|
|
537
|
+
|
|
538
|
+
case 9:
|
|
539
|
+
case "end":
|
|
540
|
+
return _context7.stop();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}, _callee7, this);
|
|
544
|
+
}));
|
|
545
|
+
|
|
546
|
+
return function (_x2) {
|
|
547
|
+
return _ref11.apply(this, arguments);
|
|
548
|
+
};
|
|
549
|
+
}();
|
|
550
|
+
/**
|
|
551
|
+
* Retrieve basic information about a specific available marketplace with the specified tenant/marketplace slug, ID, or hash.
|
|
552
|
+
*
|
|
553
|
+
* Includes the slugs, ID and hash of the marketplace, as well as branding information.
|
|
554
|
+
*
|
|
555
|
+
* To retrieve full metadata for the marketplace, use the <a href="#.Marketplace">Marketplace</a> method.
|
|
556
|
+
*
|
|
557
|
+
* @methodGroup Marketplaces
|
|
558
|
+
* @namedParams
|
|
559
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
560
|
+
*
|
|
561
|
+
* @returns {Promise<Object>} - Info about the marketplace
|
|
562
|
+
*/
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
exports.MarketplaceInfo = function (_ref12) {
|
|
566
|
+
var marketplaceParams = _ref12.marketplaceParams;
|
|
567
|
+
|
|
568
|
+
var _ref13 = marketplaceParams || {},
|
|
569
|
+
tenantSlug = _ref13.tenantSlug,
|
|
570
|
+
marketplaceSlug = _ref13.marketplaceSlug,
|
|
571
|
+
marketplaceId = _ref13.marketplaceId,
|
|
572
|
+
marketplaceHash = _ref13.marketplaceHash;
|
|
573
|
+
|
|
574
|
+
var marketplaceInfo;
|
|
575
|
+
|
|
576
|
+
if (tenantSlug && marketplaceSlug) {
|
|
577
|
+
marketplaceInfo = (this.availableMarketplaces[tenantSlug] || {})[marketplaceSlug];
|
|
578
|
+
} else {
|
|
579
|
+
marketplaceInfo = this.availableMarketplacesById[marketplaceId || this.client.utils.DecodeVersionHash(marketplaceHash).objectId];
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (!marketplaceInfo) {
|
|
583
|
+
throw Error("Eluvio Marketplace Client: Unable to find marketplace with parameters ".concat(JSON.stringify(arguments)));
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return marketplaceInfo;
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* Retrieve custom CSS for the specified marketplace
|
|
590
|
+
*
|
|
591
|
+
* @methodGroup Marketplaces
|
|
592
|
+
* @namedParams
|
|
593
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
594
|
+
*
|
|
595
|
+
* @returns {Promise<string>} - The CSS of the marketplace
|
|
596
|
+
*/
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
exports.MarketplaceCSS = /*#__PURE__*/function () {
|
|
600
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref14) {
|
|
601
|
+
var marketplaceParams, marketplaceInfo, marketplaceHash;
|
|
602
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
603
|
+
while (1) {
|
|
604
|
+
switch (_context8.prev = _context8.next) {
|
|
605
|
+
case 0:
|
|
606
|
+
marketplaceParams = _ref14.marketplaceParams;
|
|
607
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
608
|
+
marketplaceParams: marketplaceParams
|
|
609
|
+
});
|
|
610
|
+
marketplaceHash = marketplaceInfo.marketplaceHash;
|
|
611
|
+
|
|
612
|
+
if (this.cachedCSS[marketplaceHash]) {
|
|
613
|
+
_context8.next = 7;
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
_context8.next = 6;
|
|
618
|
+
return this.client.ContentObjectMetadata({
|
|
619
|
+
versionHash: marketplaceHash,
|
|
620
|
+
metadataSubtree: "public/asset_metadata/info/branding/custom_css",
|
|
621
|
+
authorizationToken: this.publicStaticToken,
|
|
622
|
+
noAuth: true
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
case 6:
|
|
626
|
+
this.cachedCSS[marketplaceHash] = _context8.sent;
|
|
627
|
+
|
|
628
|
+
case 7:
|
|
629
|
+
return _context8.abrupt("return", this.cachedCSS[marketplaceHash] || "");
|
|
630
|
+
|
|
631
|
+
case 8:
|
|
632
|
+
case "end":
|
|
633
|
+
return _context8.stop();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}, _callee8, this);
|
|
637
|
+
}));
|
|
638
|
+
|
|
639
|
+
return function (_x3) {
|
|
640
|
+
return _ref15.apply(this, arguments);
|
|
641
|
+
};
|
|
642
|
+
}();
|
|
643
|
+
/**
|
|
644
|
+
* Retrieve info about all available marketplaces
|
|
645
|
+
*
|
|
646
|
+
* @methodGroup Marketplaces
|
|
647
|
+
* @namedParams
|
|
648
|
+
* @param {boolean=} organizeById - By default, the returned marketplace info is organized by tenant and marketplace slug. If this option is enabled, the marketplaces will be organized by marketplace ID instead.
|
|
649
|
+
* @param {boolean=} forceReload=false - If specified, a new request will be made to check the currently available marketplaces instead of returning cached info
|
|
650
|
+
*
|
|
651
|
+
* @returns {Promise<{Object}>} - Info about available marketplaces
|
|
652
|
+
*/
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
exports.AvailableMarketplaces = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
656
|
+
var _ref17,
|
|
657
|
+
organizeById,
|
|
658
|
+
_ref17$forceReload,
|
|
659
|
+
forceReload,
|
|
660
|
+
_args9 = arguments;
|
|
661
|
+
|
|
662
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
663
|
+
while (1) {
|
|
664
|
+
switch (_context9.prev = _context9.next) {
|
|
665
|
+
case 0:
|
|
666
|
+
_ref17 = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {}, organizeById = _ref17.organizeById, _ref17$forceReload = _ref17.forceReload, forceReload = _ref17$forceReload === void 0 ? false : _ref17$forceReload;
|
|
667
|
+
|
|
668
|
+
if (!forceReload) {
|
|
669
|
+
_context9.next = 4;
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
_context9.next = 4;
|
|
674
|
+
return this.LoadAvailableMarketplaces(true);
|
|
675
|
+
|
|
676
|
+
case 4:
|
|
677
|
+
return _context9.abrupt("return", _objectSpread({}, organizeById ? this.availableMarketplacesById : this.availableMarketplaces));
|
|
678
|
+
|
|
679
|
+
case 5:
|
|
680
|
+
case "end":
|
|
681
|
+
return _context9.stop();
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}, _callee9, this);
|
|
685
|
+
}));
|
|
686
|
+
/**
|
|
687
|
+
* Retrieve full information about the specified marketplace
|
|
688
|
+
*
|
|
689
|
+
* <b><i>Note</i></b> - Upon changing login state, the marketplace should be retrieved again as permission info in marketplace items may be different depending on the current user's permissions.
|
|
690
|
+
*
|
|
691
|
+
* @methodGroup Marketplaces
|
|
692
|
+
* @namedParams
|
|
693
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
694
|
+
*
|
|
695
|
+
* @returns {Promise<Object>} - The full information for the marketplace
|
|
696
|
+
*/
|
|
697
|
+
|
|
698
|
+
exports.Marketplace = /*#__PURE__*/function () {
|
|
699
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref18) {
|
|
700
|
+
var marketplaceParams;
|
|
701
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
702
|
+
while (1) {
|
|
703
|
+
switch (_context10.prev = _context10.next) {
|
|
704
|
+
case 0:
|
|
705
|
+
marketplaceParams = _ref18.marketplaceParams;
|
|
706
|
+
return _context10.abrupt("return", this.LoadMarketplace(marketplaceParams));
|
|
707
|
+
|
|
708
|
+
case 2:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context10.stop();
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}, _callee10, this);
|
|
714
|
+
}));
|
|
715
|
+
|
|
716
|
+
return function (_x4) {
|
|
717
|
+
return _ref19.apply(this, arguments);
|
|
718
|
+
};
|
|
719
|
+
}();
|
|
720
|
+
/* NFTS */
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Load full info for the specified NFT
|
|
724
|
+
*
|
|
725
|
+
* @methodGroup Items
|
|
726
|
+
* @namedParams
|
|
727
|
+
* @param {string} contractAddress - The contract address of the NFT
|
|
728
|
+
* @param {string} tokenId - The token ID of the NFT
|
|
729
|
+
*/
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
exports.NFT = /*#__PURE__*/function () {
|
|
733
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref20) {
|
|
734
|
+
var tokenId, contractAddress, nft;
|
|
735
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
736
|
+
while (1) {
|
|
737
|
+
switch (_context11.prev = _context11.next) {
|
|
738
|
+
case 0:
|
|
739
|
+
tokenId = _ref20.tokenId, contractAddress = _ref20.contractAddress;
|
|
740
|
+
_context11.t0 = FormatNFTDetails;
|
|
741
|
+
_context11.next = 4;
|
|
742
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
743
|
+
path: UrlJoin("as", "nft", "info", contractAddress, tokenId),
|
|
744
|
+
method: "GET"
|
|
745
|
+
}));
|
|
746
|
+
|
|
747
|
+
case 4:
|
|
748
|
+
_context11.t1 = _context11.sent;
|
|
749
|
+
nft = (0, _context11.t0)(_context11.t1);
|
|
750
|
+
_context11.t2 = _objectSpread;
|
|
751
|
+
_context11.t3 = _objectSpread;
|
|
752
|
+
_context11.t4 = {};
|
|
753
|
+
_context11.next = 11;
|
|
754
|
+
return this.client.ContentObjectMetadata({
|
|
755
|
+
versionHash: nft.details.VersionHash,
|
|
756
|
+
metadataSubtree: "public/asset_metadata/nft",
|
|
757
|
+
produceLinkUrls: true
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
case 11:
|
|
761
|
+
_context11.t5 = _context11.sent;
|
|
762
|
+
|
|
763
|
+
if (_context11.t5) {
|
|
764
|
+
_context11.next = 14;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
_context11.t5 = {};
|
|
769
|
+
|
|
770
|
+
case 14:
|
|
771
|
+
_context11.t6 = _context11.t5;
|
|
772
|
+
_context11.t7 = (0, _context11.t3)(_context11.t4, _context11.t6);
|
|
773
|
+
_context11.t8 = nft.metadata || {};
|
|
774
|
+
nft.metadata = (0, _context11.t2)(_context11.t7, _context11.t8);
|
|
775
|
+
_context11.next = 20;
|
|
776
|
+
return this.TenantConfiguration({
|
|
777
|
+
contractAddress: contractAddress
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
case 20:
|
|
781
|
+
nft.config = _context11.sent;
|
|
782
|
+
return _context11.abrupt("return", FormatNFTMetadata(nft));
|
|
783
|
+
|
|
784
|
+
case 22:
|
|
785
|
+
case "end":
|
|
786
|
+
return _context11.stop();
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}, _callee11, this);
|
|
790
|
+
}));
|
|
791
|
+
|
|
792
|
+
return function (_x5) {
|
|
793
|
+
return _ref21.apply(this, arguments);
|
|
794
|
+
};
|
|
795
|
+
}();
|
|
796
|
+
/** LISTINGS */
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Retrieve the status of the specified listing
|
|
800
|
+
*
|
|
801
|
+
* @methodGroup Listings
|
|
802
|
+
* @namedParams
|
|
803
|
+
* @param {string=} listingId - The ID of the listing
|
|
804
|
+
*
|
|
805
|
+
* @returns {Promise<Object>} - The status of the listing
|
|
806
|
+
*/
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
exports.ListingStatus = /*#__PURE__*/function () {
|
|
810
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref22) {
|
|
811
|
+
var listingId;
|
|
812
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
813
|
+
while (1) {
|
|
814
|
+
switch (_context12.prev = _context12.next) {
|
|
815
|
+
case 0:
|
|
816
|
+
listingId = _ref22.listingId;
|
|
817
|
+
_context12.prev = 1;
|
|
818
|
+
_context12.t0 = Utils;
|
|
819
|
+
_context12.next = 5;
|
|
820
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
821
|
+
path: UrlJoin("as", "mkt", "status", listingId),
|
|
822
|
+
method: "GET"
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
case 5:
|
|
826
|
+
_context12.t1 = _context12.sent;
|
|
827
|
+
_context12.next = 8;
|
|
828
|
+
return _context12.t0.ResponseToJson.call(_context12.t0, _context12.t1);
|
|
829
|
+
|
|
830
|
+
case 8:
|
|
831
|
+
return _context12.abrupt("return", _context12.sent);
|
|
832
|
+
|
|
833
|
+
case 11:
|
|
834
|
+
_context12.prev = 11;
|
|
835
|
+
_context12.t2 = _context12["catch"](1);
|
|
836
|
+
|
|
837
|
+
if (!(_context12.t2.status === 404)) {
|
|
838
|
+
_context12.next = 15;
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return _context12.abrupt("return");
|
|
843
|
+
|
|
844
|
+
case 15:
|
|
845
|
+
throw _context12.t2;
|
|
846
|
+
|
|
847
|
+
case 16:
|
|
848
|
+
case "end":
|
|
849
|
+
return _context12.stop();
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}, _callee12, this, [[1, 11]]);
|
|
853
|
+
}));
|
|
854
|
+
|
|
855
|
+
return function (_x6) {
|
|
856
|
+
return _ref23.apply(this, arguments);
|
|
857
|
+
};
|
|
858
|
+
}();
|
|
859
|
+
/**
|
|
860
|
+
* Retrieve a specific listing
|
|
861
|
+
*
|
|
862
|
+
* NOTE: When a listing is sold or deleted, it will no longer be queryable with this API. Use <a href="#.ListingStatus">ListingStatus</a> instead.
|
|
863
|
+
*
|
|
864
|
+
* @methodGroup Listings
|
|
865
|
+
* @namedParams
|
|
866
|
+
* @param {string=} listingId - The ID of the listing
|
|
867
|
+
*
|
|
868
|
+
* @returns {Promise<Object>} - The listing
|
|
869
|
+
*/
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
exports.Listing = /*#__PURE__*/function () {
|
|
873
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref24) {
|
|
874
|
+
var listingId;
|
|
875
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
876
|
+
while (1) {
|
|
877
|
+
switch (_context13.prev = _context13.next) {
|
|
878
|
+
case 0:
|
|
879
|
+
listingId = _ref24.listingId;
|
|
880
|
+
_context13.t0 = FormatNFT;
|
|
881
|
+
_context13.t1 = Utils;
|
|
882
|
+
_context13.next = 5;
|
|
883
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
884
|
+
path: UrlJoin("as", "mkt", "l", listingId),
|
|
885
|
+
method: "GET"
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
case 5:
|
|
889
|
+
_context13.t2 = _context13.sent;
|
|
890
|
+
_context13.next = 8;
|
|
891
|
+
return _context13.t1.ResponseToJson.call(_context13.t1, _context13.t2);
|
|
892
|
+
|
|
893
|
+
case 8:
|
|
894
|
+
_context13.t3 = _context13.sent;
|
|
895
|
+
return _context13.abrupt("return", (0, _context13.t0)(_context13.t3));
|
|
896
|
+
|
|
897
|
+
case 10:
|
|
898
|
+
case "end":
|
|
899
|
+
return _context13.stop();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}, _callee13, this);
|
|
903
|
+
}));
|
|
904
|
+
|
|
905
|
+
return function (_x7) {
|
|
906
|
+
return _ref25.apply(this, arguments);
|
|
907
|
+
};
|
|
908
|
+
}();
|
|
909
|
+
/**
|
|
910
|
+
* Retrieve listings matching the specified parameters.
|
|
911
|
+
*
|
|
912
|
+
* @methodGroup Listings
|
|
913
|
+
* @namedParams
|
|
914
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
915
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
916
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
917
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
918
|
+
* @param {string=} filter - Filter results by item name.
|
|
919
|
+
* <br /><br />
|
|
920
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
921
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
922
|
+
* @param {string=} editionFilter - Filter results by item edition.
|
|
923
|
+
* <br /><br />
|
|
924
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
925
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
926
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
927
|
+
* <br /><br />
|
|
928
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
929
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
930
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
931
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
932
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
933
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
934
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
935
|
+
* @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
|
|
936
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
937
|
+
*
|
|
938
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
939
|
+
*/
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
exports.Listings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
943
|
+
var _args14 = arguments;
|
|
944
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
945
|
+
while (1) {
|
|
946
|
+
switch (_context14.prev = _context14.next) {
|
|
947
|
+
case 0:
|
|
948
|
+
return _context14.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
949
|
+
mode: "listings"
|
|
950
|
+
}, _args14[0] || {})));
|
|
951
|
+
|
|
952
|
+
case 1:
|
|
953
|
+
case "end":
|
|
954
|
+
return _context14.stop();
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}, _callee14, this);
|
|
958
|
+
}));
|
|
959
|
+
/**
|
|
960
|
+
* Retrieve stats for listings matching the specified parameters.
|
|
961
|
+
*
|
|
962
|
+
* @methodGroup Listings
|
|
963
|
+
* @namedParams
|
|
964
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
965
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
966
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `info/token_id`, `info/ordinal`, `price`, `nft/display_name`
|
|
967
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
968
|
+
* @param {string=} filter - Filter results by item name.
|
|
969
|
+
* <br /><br />
|
|
970
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
971
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
972
|
+
* @param {string=} editionFilter - Filter results by item edition.
|
|
973
|
+
* <br /><br />
|
|
974
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
975
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
976
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
977
|
+
* <br /><br />
|
|
978
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
979
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
980
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
981
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
982
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
983
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
984
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
985
|
+
* @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
|
|
986
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
987
|
+
*
|
|
988
|
+
* @returns {Promise<Object>} - Statistics about listings. All prices in USD.
|
|
989
|
+
*/
|
|
990
|
+
|
|
991
|
+
exports.ListingStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
992
|
+
var _args15 = arguments;
|
|
993
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
994
|
+
while (1) {
|
|
995
|
+
switch (_context15.prev = _context15.next) {
|
|
996
|
+
case 0:
|
|
997
|
+
return _context15.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
998
|
+
mode: "listing-stats"
|
|
999
|
+
}, _args15[0] || {})));
|
|
1000
|
+
|
|
1001
|
+
case 1:
|
|
1002
|
+
case "end":
|
|
1003
|
+
return _context15.stop();
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}, _callee15, this);
|
|
1007
|
+
}));
|
|
1008
|
+
/**
|
|
1009
|
+
* Retrieve sales matching the specified parameters.
|
|
1010
|
+
*
|
|
1011
|
+
* @methodGroup Listings
|
|
1012
|
+
* @namedParams
|
|
1013
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1014
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1015
|
+
* @param {string=} sortBy="created" - Sort order. Options: `created`, `price`, `name`
|
|
1016
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1017
|
+
* @param {string=} filter - Filter results by item name.
|
|
1018
|
+
* <br /><br />
|
|
1019
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1020
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1021
|
+
* @param {string=} editionFilter - Filter results by item edition.
|
|
1022
|
+
* <br /><br />
|
|
1023
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1024
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1025
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1026
|
+
* <br /><br />
|
|
1027
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1028
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1029
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1030
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1031
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1032
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1033
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1034
|
+
* @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
|
|
1035
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1036
|
+
*
|
|
1037
|
+
* @returns {Promise<Object>} - Results of the query and pagination info
|
|
1038
|
+
*/
|
|
1039
|
+
|
|
1040
|
+
exports.Sales = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
1041
|
+
var _args16 = arguments;
|
|
1042
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1043
|
+
while (1) {
|
|
1044
|
+
switch (_context16.prev = _context16.next) {
|
|
1045
|
+
case 0:
|
|
1046
|
+
return _context16.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1047
|
+
mode: "sales"
|
|
1048
|
+
}, _args16[0] || {})));
|
|
1049
|
+
|
|
1050
|
+
case 1:
|
|
1051
|
+
case "end":
|
|
1052
|
+
return _context16.stop();
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}, _callee16, this);
|
|
1056
|
+
}));
|
|
1057
|
+
/**
|
|
1058
|
+
* Retrieve stats for listings matching the specified parameters.
|
|
1059
|
+
*
|
|
1060
|
+
* @methodGroup Listings
|
|
1061
|
+
* @namedParams
|
|
1062
|
+
* @param {integer=} start=0 - PAGINATION: Index from which the results should start
|
|
1063
|
+
* @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
|
|
1064
|
+
* @param {string=} sortBy="created" -
|
|
1065
|
+
* @param {boolean=} sortDesc=false - Sort results descending instead of ascending
|
|
1066
|
+
* @param {string=} filter - Filter results by item name.
|
|
1067
|
+
* <br /><br />
|
|
1068
|
+
* NOTE: This string must be an <b>exact match</b> on the item name.
|
|
1069
|
+
* You can retrieve all available item names from the <a href="#.ListingNames">ListingNames method</a>.
|
|
1070
|
+
* @param {string=} editionFilter - Filter results by item edition.
|
|
1071
|
+
* <br /><br />
|
|
1072
|
+
* NOTE: This string must be an <b>exact match</b> on the edition name.
|
|
1073
|
+
* You can retrieve all available item edition names from the <a href="#.ListingEditionNames">ListingEditionNames method</a>.
|
|
1074
|
+
* @param {Array<Object>} attributeFilters - Filter results by item attributes. Each entry should include name and value (e.g. `[{name: "attribute-name", value: "attribute-value"}]`)
|
|
1075
|
+
* <br /><br />
|
|
1076
|
+
* NOTE: These filters must be an <b>exact match</b> on the attribute name and value.
|
|
1077
|
+
* You can retrieve all available item attributes from the <a href="#.ListingAttributes">ListingAttributes method</a>.
|
|
1078
|
+
* @param {string=} sellerAddress - Filter by a specific seller
|
|
1079
|
+
* @param {string=} contractAddress - Filter results by the address of the NFT contract
|
|
1080
|
+
* @param {string=} tokenId - Filter by token ID (if filtering by contract address)
|
|
1081
|
+
* @param {string=} currency - Filter results by purchase currency. Available options: `usdc`
|
|
1082
|
+
* @param {Object=} marketplaceParams - Filter results by marketplace
|
|
1083
|
+
* @param {integer=} collectionIndex - If filtering by marketplace, filter by collection. The index refers to the index in the array `marketplace.collections`
|
|
1084
|
+
* @param {integer=} lastNDays - Filter by results listed in the past N days
|
|
1085
|
+
*
|
|
1086
|
+
* @returns {Promise<Object>} - Statistics about sales. All prices in USD.
|
|
1087
|
+
*/
|
|
1088
|
+
|
|
1089
|
+
exports.SalesStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
1090
|
+
var _args17 = arguments;
|
|
1091
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1092
|
+
while (1) {
|
|
1093
|
+
switch (_context17.prev = _context17.next) {
|
|
1094
|
+
case 0:
|
|
1095
|
+
return _context17.abrupt("return", this.FilteredQuery(_objectSpread({
|
|
1096
|
+
mode: "sales-stats"
|
|
1097
|
+
}, _args17[0] || {})));
|
|
1098
|
+
|
|
1099
|
+
case 1:
|
|
1100
|
+
case "end":
|
|
1101
|
+
return _context17.stop();
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}, _callee17, this);
|
|
1105
|
+
}));
|
|
1106
|
+
/**
|
|
1107
|
+
* <b><i>Requires login</i></b>
|
|
1108
|
+
*
|
|
1109
|
+
* Create or update a listing for the specified item
|
|
1110
|
+
*
|
|
1111
|
+
* @methodGroup Listings
|
|
1112
|
+
* @namedParams
|
|
1113
|
+
* @param {string} contractAddress - The NFT contract address of the item
|
|
1114
|
+
* @param {string} tokenId - The token ID of the item
|
|
1115
|
+
* @param {number} price - The price of the listing, in USD
|
|
1116
|
+
* @param {string=} listingId - (When editing a listing) The ID of the existing listing
|
|
1117
|
+
*
|
|
1118
|
+
* @returns {Promise<string>} - The listing ID of the created listing
|
|
1119
|
+
*/
|
|
1120
|
+
|
|
1121
|
+
exports.CreateListing = /*#__PURE__*/function () {
|
|
1122
|
+
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref30) {
|
|
1123
|
+
var contractAddress, tokenId, price, listingId;
|
|
1124
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1125
|
+
while (1) {
|
|
1126
|
+
switch (_context18.prev = _context18.next) {
|
|
1127
|
+
case 0:
|
|
1128
|
+
contractAddress = _ref30.contractAddress, tokenId = _ref30.tokenId, price = _ref30.price, listingId = _ref30.listingId;
|
|
1129
|
+
contractAddress = Utils.FormatAddress(contractAddress);
|
|
1130
|
+
|
|
1131
|
+
if (!listingId) {
|
|
1132
|
+
_context18.next = 12;
|
|
1133
|
+
break;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
_context18.t0 = Utils;
|
|
1137
|
+
_context18.next = 6;
|
|
1138
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1139
|
+
path: UrlJoin("as", "wlt", "mkt"),
|
|
1140
|
+
method: "PUT",
|
|
1141
|
+
body: {
|
|
1142
|
+
id: listingId,
|
|
1143
|
+
price: parseFloat(price)
|
|
1144
|
+
},
|
|
1145
|
+
headers: {
|
|
1146
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
case 6:
|
|
1151
|
+
_context18.t1 = _context18.sent;
|
|
1152
|
+
_context18.next = 9;
|
|
1153
|
+
return _context18.t0.ResponseToFormat.call(_context18.t0, "text", _context18.t1);
|
|
1154
|
+
|
|
1155
|
+
case 9:
|
|
1156
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1157
|
+
|
|
1158
|
+
case 12:
|
|
1159
|
+
_context18.t2 = Utils;
|
|
1160
|
+
_context18.next = 15;
|
|
1161
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1162
|
+
path: UrlJoin("as", "wlt", "mkt"),
|
|
1163
|
+
method: "POST",
|
|
1164
|
+
body: {
|
|
1165
|
+
contract: contractAddress,
|
|
1166
|
+
token: tokenId,
|
|
1167
|
+
price: parseFloat(price)
|
|
1168
|
+
},
|
|
1169
|
+
headers: {
|
|
1170
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
case 15:
|
|
1175
|
+
_context18.t3 = _context18.sent;
|
|
1176
|
+
_context18.next = 18;
|
|
1177
|
+
return _context18.t2.ResponseToJson.call(_context18.t2, _context18.t3);
|
|
1178
|
+
|
|
1179
|
+
case 18:
|
|
1180
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1181
|
+
|
|
1182
|
+
case 19:
|
|
1183
|
+
case "end":
|
|
1184
|
+
return _context18.stop();
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}, _callee18, this);
|
|
1188
|
+
}));
|
|
1189
|
+
|
|
1190
|
+
return function (_x8) {
|
|
1191
|
+
return _ref31.apply(this, arguments);
|
|
1192
|
+
};
|
|
1193
|
+
}();
|
|
1194
|
+
/**
|
|
1195
|
+
* <b><i>Requires login</i></b>
|
|
1196
|
+
*
|
|
1197
|
+
* Remove the specified listing
|
|
1198
|
+
*
|
|
1199
|
+
* @methodGroup Listings
|
|
1200
|
+
* @namedParams
|
|
1201
|
+
* @param {string} listingId - The ID of the listing to remove
|
|
1202
|
+
*/
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
exports.RemoveListing = /*#__PURE__*/function () {
|
|
1206
|
+
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref32) {
|
|
1207
|
+
var listingId;
|
|
1208
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1209
|
+
while (1) {
|
|
1210
|
+
switch (_context19.prev = _context19.next) {
|
|
1211
|
+
case 0:
|
|
1212
|
+
listingId = _ref32.listingId;
|
|
1213
|
+
_context19.next = 3;
|
|
1214
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1215
|
+
path: UrlJoin("as", "wlt", "mkt", listingId),
|
|
1216
|
+
method: "DELETE",
|
|
1217
|
+
headers: {
|
|
1218
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
|
|
1222
|
+
case 3:
|
|
1223
|
+
case "end":
|
|
1224
|
+
return _context19.stop();
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}, _callee19, this);
|
|
1228
|
+
}));
|
|
1229
|
+
|
|
1230
|
+
return function (_x9) {
|
|
1231
|
+
return _ref33.apply(this, arguments);
|
|
1232
|
+
};
|
|
1233
|
+
}();
|
|
1234
|
+
/**
|
|
1235
|
+
* Retrieve all valid names for filtering listings. Full item names are required for filtering listing results by name.
|
|
1236
|
+
*
|
|
1237
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
1238
|
+
*
|
|
1239
|
+
* @methodGroup Listings
|
|
1240
|
+
* @namedParams
|
|
1241
|
+
* @param {Object} marketplaceParams - Parameters of a marketplace to filter results by
|
|
1242
|
+
*
|
|
1243
|
+
* @returns {Promise<Array<String>>} - A list of item names
|
|
1244
|
+
*/
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
exports.ListingNames = /*#__PURE__*/function () {
|
|
1248
|
+
var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref34) {
|
|
1249
|
+
var marketplaceParams, tenantId;
|
|
1250
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1251
|
+
while (1) {
|
|
1252
|
+
switch (_context20.prev = _context20.next) {
|
|
1253
|
+
case 0:
|
|
1254
|
+
marketplaceParams = _ref34.marketplaceParams;
|
|
1255
|
+
|
|
1256
|
+
if (!marketplaceParams) {
|
|
1257
|
+
_context20.next = 5;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
_context20.next = 4;
|
|
1262
|
+
return this.MarketplaceInfo({
|
|
1263
|
+
marketplaceParams: marketplaceParams
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
case 4:
|
|
1267
|
+
tenantId = _context20.sent.tenantId;
|
|
1268
|
+
|
|
1269
|
+
case 5:
|
|
1270
|
+
_context20.t0 = Utils;
|
|
1271
|
+
_context20.next = 8;
|
|
1272
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1273
|
+
path: UrlJoin("as", "mkt", "names"),
|
|
1274
|
+
method: "GET",
|
|
1275
|
+
queryParams: tenantId ? {
|
|
1276
|
+
filter: "tenant:eq:".concat(tenantId)
|
|
1277
|
+
} : {}
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
case 8:
|
|
1281
|
+
_context20.t1 = _context20.sent;
|
|
1282
|
+
_context20.next = 11;
|
|
1283
|
+
return _context20.t0.ResponseToJson.call(_context20.t0, _context20.t1);
|
|
1284
|
+
|
|
1285
|
+
case 11:
|
|
1286
|
+
return _context20.abrupt("return", _context20.sent);
|
|
1287
|
+
|
|
1288
|
+
case 12:
|
|
1289
|
+
case "end":
|
|
1290
|
+
return _context20.stop();
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}, _callee20, this);
|
|
1294
|
+
}));
|
|
1295
|
+
|
|
1296
|
+
return function (_x10) {
|
|
1297
|
+
return _ref35.apply(this, arguments);
|
|
1298
|
+
};
|
|
1299
|
+
}();
|
|
1300
|
+
/**
|
|
1301
|
+
* Retrieve all valid edition names of the specified item. Full item edition names are required for filtering listing results by edition.
|
|
1302
|
+
*
|
|
1303
|
+
* @methodGroup Listings
|
|
1304
|
+
* @namedParams
|
|
1305
|
+
* @param {string} displayName - Display name of the item from which to request edition names
|
|
1306
|
+
*
|
|
1307
|
+
* @returns {Promise<Array<String>>} - A list of item editions
|
|
1308
|
+
*/
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
exports.ListingEditionNames = /*#__PURE__*/function () {
|
|
1312
|
+
var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref36) {
|
|
1313
|
+
var displayName;
|
|
1314
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1315
|
+
while (1) {
|
|
1316
|
+
switch (_context21.prev = _context21.next) {
|
|
1317
|
+
case 0:
|
|
1318
|
+
displayName = _ref36.displayName;
|
|
1319
|
+
_context21.t0 = Utils;
|
|
1320
|
+
_context21.next = 4;
|
|
1321
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1322
|
+
path: UrlJoin("as", "mkt", "editions"),
|
|
1323
|
+
queryParams: {
|
|
1324
|
+
filter: "nft/display_name:eq:".concat(displayName)
|
|
1325
|
+
},
|
|
1326
|
+
method: "GET"
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
case 4:
|
|
1330
|
+
_context21.t1 = _context21.sent;
|
|
1331
|
+
_context21.next = 7;
|
|
1332
|
+
return _context21.t0.ResponseToJson.call(_context21.t0, _context21.t1);
|
|
1333
|
+
|
|
1334
|
+
case 7:
|
|
1335
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1336
|
+
|
|
1337
|
+
case 8:
|
|
1338
|
+
case "end":
|
|
1339
|
+
return _context21.stop();
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}, _callee21, this);
|
|
1343
|
+
}));
|
|
1344
|
+
|
|
1345
|
+
return function (_x11) {
|
|
1346
|
+
return _ref37.apply(this, arguments);
|
|
1347
|
+
};
|
|
1348
|
+
}();
|
|
1349
|
+
/**
|
|
1350
|
+
* Retrieve names of all valid attributes for listed tiems. Full attribute names and values are required for filtering listing results by attributes.
|
|
1351
|
+
*
|
|
1352
|
+
* Specify marketplace information to filter the results to only items offered in that marketplace.
|
|
1353
|
+
*
|
|
1354
|
+
* @methodGroup Listings
|
|
1355
|
+
* @namedParams
|
|
1356
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to filter results by
|
|
1357
|
+
* @param {string=} displayName - Display name of the item from which to request attributes
|
|
1358
|
+
*
|
|
1359
|
+
* @returns {Promise<Array<String>>} - A list of valid attributes
|
|
1360
|
+
*/
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
exports.ListingAttributes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
1364
|
+
var _ref39,
|
|
1365
|
+
marketplaceParams,
|
|
1366
|
+
displayName,
|
|
1367
|
+
filters,
|
|
1368
|
+
attributes,
|
|
1369
|
+
_args22 = arguments;
|
|
1370
|
+
|
|
1371
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1372
|
+
while (1) {
|
|
1373
|
+
switch (_context22.prev = _context22.next) {
|
|
1374
|
+
case 0:
|
|
1375
|
+
_ref39 = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {}, marketplaceParams = _ref39.marketplaceParams, displayName = _ref39.displayName;
|
|
1376
|
+
filters = [];
|
|
1377
|
+
|
|
1378
|
+
if (!marketplaceParams) {
|
|
1379
|
+
_context22.next = 10;
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
_context22.t0 = filters;
|
|
1384
|
+
_context22.t1 = "tenant:eq:";
|
|
1385
|
+
_context22.next = 7;
|
|
1386
|
+
return this.MarketplaceInfo({
|
|
1387
|
+
marketplaceParams: marketplaceParams
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
case 7:
|
|
1391
|
+
_context22.t2 = _context22.sent.tenantId;
|
|
1392
|
+
_context22.t3 = _context22.t1.concat.call(_context22.t1, _context22.t2);
|
|
1393
|
+
|
|
1394
|
+
_context22.t0.push.call(_context22.t0, _context22.t3);
|
|
1395
|
+
|
|
1396
|
+
case 10:
|
|
1397
|
+
if (displayName) {
|
|
1398
|
+
filters.push("nft/display_name:eq:".concat(displayName));
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
_context22.t4 = Utils;
|
|
1402
|
+
_context22.next = 14;
|
|
1403
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1404
|
+
path: UrlJoin("as", "mkt", "attributes"),
|
|
1405
|
+
method: "GET",
|
|
1406
|
+
queryParams: {
|
|
1407
|
+
filter: filters
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
case 14:
|
|
1412
|
+
_context22.t5 = _context22.sent;
|
|
1413
|
+
_context22.next = 17;
|
|
1414
|
+
return _context22.t4.ResponseToJson.call(_context22.t4, _context22.t5);
|
|
1415
|
+
|
|
1416
|
+
case 17:
|
|
1417
|
+
attributes = _context22.sent;
|
|
1418
|
+
return _context22.abrupt("return", attributes.map(function (_ref40) {
|
|
1419
|
+
var trait_type = _ref40.trait_type,
|
|
1420
|
+
values = _ref40.values;
|
|
1421
|
+
return {
|
|
1422
|
+
name: trait_type,
|
|
1423
|
+
values: values
|
|
1424
|
+
};
|
|
1425
|
+
}).filter(function (_ref41) {
|
|
1426
|
+
var name = _ref41.name;
|
|
1427
|
+
return !["Content Fabric Hash", "Total Minted Supply", "Creator"].includes(name);
|
|
1428
|
+
}));
|
|
1429
|
+
|
|
1430
|
+
case 19:
|
|
1431
|
+
case "end":
|
|
1432
|
+
return _context22.stop();
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
}, _callee22, this);
|
|
1436
|
+
}));
|
|
1437
|
+
/* MINTING STATUS */
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Return status of the specified listing purchase
|
|
1441
|
+
*
|
|
1442
|
+
* @methodGroup Status
|
|
1443
|
+
* @namedParams
|
|
1444
|
+
* @param {string} listingId - The ID of the listing
|
|
1445
|
+
* @param {string} confirmationId - The confirmation ID of the purchase
|
|
1446
|
+
*
|
|
1447
|
+
* @returns {Promise<Object>} - The status of the purchase
|
|
1448
|
+
*/
|
|
1449
|
+
|
|
1450
|
+
exports.ListingPurchaseStatus = /*#__PURE__*/function () {
|
|
1451
|
+
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref42) {
|
|
1452
|
+
var listingId, confirmationId, listingStatus, statuses;
|
|
1453
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1454
|
+
while (1) {
|
|
1455
|
+
switch (_context23.prev = _context23.next) {
|
|
1456
|
+
case 0:
|
|
1457
|
+
listingId = _ref42.listingId, confirmationId = _ref42.confirmationId;
|
|
1458
|
+
_context23.prev = 1;
|
|
1459
|
+
_context23.next = 4;
|
|
1460
|
+
return this.ListingStatus({
|
|
1461
|
+
listingId: listingId
|
|
1462
|
+
});
|
|
1463
|
+
|
|
1464
|
+
case 4:
|
|
1465
|
+
listingStatus = _context23.sent;
|
|
1466
|
+
|
|
1467
|
+
if (listingStatus) {
|
|
1468
|
+
_context23.next = 7;
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
throw Error("Unable to find info for listing " + listingId);
|
|
1473
|
+
|
|
1474
|
+
case 7:
|
|
1475
|
+
_context23.next = 9;
|
|
1476
|
+
return this.MintingStatus({
|
|
1477
|
+
tenantId: listingStatus.tenant
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
case 9:
|
|
1481
|
+
statuses = _context23.sent;
|
|
1482
|
+
return _context23.abrupt("return", statuses.find(function (status) {
|
|
1483
|
+
return status.op === "nft-transfer" && status.extra && status.extra[0] === confirmationId;
|
|
1484
|
+
}) || {
|
|
1485
|
+
status: "none"
|
|
1486
|
+
});
|
|
1487
|
+
|
|
1488
|
+
case 13:
|
|
1489
|
+
_context23.prev = 13;
|
|
1490
|
+
_context23.t0 = _context23["catch"](1);
|
|
1491
|
+
this.Log(_context23.t0, true);
|
|
1492
|
+
return _context23.abrupt("return", {
|
|
1493
|
+
status: "unknown"
|
|
1494
|
+
});
|
|
1495
|
+
|
|
1496
|
+
case 17:
|
|
1497
|
+
case "end":
|
|
1498
|
+
return _context23.stop();
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}, _callee23, this, [[1, 13]]);
|
|
1502
|
+
}));
|
|
1503
|
+
|
|
1504
|
+
return function (_x12) {
|
|
1505
|
+
return _ref43.apply(this, arguments);
|
|
1506
|
+
};
|
|
1507
|
+
}();
|
|
1508
|
+
/**
|
|
1509
|
+
* Return status of the specified marketplace purchase
|
|
1510
|
+
*
|
|
1511
|
+
* @methodGroup Status
|
|
1512
|
+
* @namedParams
|
|
1513
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1514
|
+
* @param {string} confirmationId - The confirmation ID of the purchase
|
|
1515
|
+
*
|
|
1516
|
+
* @returns {Promise<Object>} - The minting status of the purchaseed item(s)
|
|
1517
|
+
*/
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
exports.PurchaseStatus = /*#__PURE__*/function () {
|
|
1521
|
+
var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref44) {
|
|
1522
|
+
var marketplaceParams, confirmationId, marketplaceInfo, statuses;
|
|
1523
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
1524
|
+
while (1) {
|
|
1525
|
+
switch (_context24.prev = _context24.next) {
|
|
1526
|
+
case 0:
|
|
1527
|
+
marketplaceParams = _ref44.marketplaceParams, confirmationId = _ref44.confirmationId;
|
|
1528
|
+
_context24.prev = 1;
|
|
1529
|
+
_context24.next = 4;
|
|
1530
|
+
return this.MarketplaceInfo({
|
|
1531
|
+
marketplaceParams: marketplaceParams
|
|
1532
|
+
});
|
|
1533
|
+
|
|
1534
|
+
case 4:
|
|
1535
|
+
marketplaceInfo = _context24.sent;
|
|
1536
|
+
_context24.next = 7;
|
|
1537
|
+
return this.MintingStatus({
|
|
1538
|
+
tenantId: marketplaceInfo.tenant_id
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1541
|
+
case 7:
|
|
1542
|
+
statuses = _context24.sent;
|
|
1543
|
+
return _context24.abrupt("return", statuses.find(function (status) {
|
|
1544
|
+
return status.op === "nft-buy" && status.confirmationId === confirmationId;
|
|
1545
|
+
}) || {
|
|
1546
|
+
status: "none"
|
|
1547
|
+
});
|
|
1548
|
+
|
|
1549
|
+
case 11:
|
|
1550
|
+
_context24.prev = 11;
|
|
1551
|
+
_context24.t0 = _context24["catch"](1);
|
|
1552
|
+
this.Log(_context24.t0, true);
|
|
1553
|
+
return _context24.abrupt("return", {
|
|
1554
|
+
status: "unknown"
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
case 15:
|
|
1558
|
+
case "end":
|
|
1559
|
+
return _context24.stop();
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}, _callee24, this, [[1, 11]]);
|
|
1563
|
+
}));
|
|
1564
|
+
|
|
1565
|
+
return function (_x13) {
|
|
1566
|
+
return _ref45.apply(this, arguments);
|
|
1567
|
+
};
|
|
1568
|
+
}();
|
|
1569
|
+
/**
|
|
1570
|
+
* Return status of the specified item claim
|
|
1571
|
+
*
|
|
1572
|
+
* @methodGroup Status
|
|
1573
|
+
* @namedParams
|
|
1574
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1575
|
+
* @param {string} sku - The SKU of the item claimed
|
|
1576
|
+
*
|
|
1577
|
+
* @returns {Promise<Object>} - The minting status of the claim
|
|
1578
|
+
*/
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
exports.ClaimStatus = /*#__PURE__*/function () {
|
|
1582
|
+
var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref46) {
|
|
1583
|
+
var marketplaceParams, sku, marketplaceInfo, statuses;
|
|
1584
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
1585
|
+
while (1) {
|
|
1586
|
+
switch (_context25.prev = _context25.next) {
|
|
1587
|
+
case 0:
|
|
1588
|
+
marketplaceParams = _ref46.marketplaceParams, sku = _ref46.sku;
|
|
1589
|
+
_context25.prev = 1;
|
|
1590
|
+
_context25.next = 4;
|
|
1591
|
+
return this.MarketplaceInfo({
|
|
1592
|
+
marketplaceParams: marketplaceParams
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
case 4:
|
|
1596
|
+
marketplaceInfo = _context25.sent;
|
|
1597
|
+
_context25.next = 7;
|
|
1598
|
+
return this.MintingStatus({
|
|
1599
|
+
tenantId: marketplaceInfo.tenantId
|
|
1600
|
+
});
|
|
1601
|
+
|
|
1602
|
+
case 7:
|
|
1603
|
+
statuses = _context25.sent;
|
|
1604
|
+
return _context25.abrupt("return", statuses.find(function (status) {
|
|
1605
|
+
return status.op === "nft-claim" && status.marketplaceId === marketplaceInfo.marketplaceId && status.confirmationId === sku;
|
|
1606
|
+
}) || {
|
|
1607
|
+
status: "none"
|
|
1608
|
+
});
|
|
1609
|
+
|
|
1610
|
+
case 11:
|
|
1611
|
+
_context25.prev = 11;
|
|
1612
|
+
_context25.t0 = _context25["catch"](1);
|
|
1613
|
+
this.Log(_context25.t0, true);
|
|
1614
|
+
return _context25.abrupt("return", {
|
|
1615
|
+
status: "unknown"
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
case 15:
|
|
1619
|
+
case "end":
|
|
1620
|
+
return _context25.stop();
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}, _callee25, this, [[1, 11]]);
|
|
1624
|
+
}));
|
|
1625
|
+
|
|
1626
|
+
return function (_x14) {
|
|
1627
|
+
return _ref47.apply(this, arguments);
|
|
1628
|
+
};
|
|
1629
|
+
}();
|
|
1630
|
+
/**
|
|
1631
|
+
* Return status of the specified pack opening
|
|
1632
|
+
*
|
|
1633
|
+
* @methodGroup Status
|
|
1634
|
+
* @namedParams
|
|
1635
|
+
* @param {string} contractAddress - The NFT contract address of the opened pack
|
|
1636
|
+
* @param {string} tokenId - The token ID of the opened pack
|
|
1637
|
+
*
|
|
1638
|
+
* @returns {Promise<Object>} - The status of the pack opening
|
|
1639
|
+
*/
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
exports.PackOpenStatus = /*#__PURE__*/function () {
|
|
1643
|
+
var _ref49 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref48) {
|
|
1644
|
+
var contractAddress, tokenId, tenantConfig, statuses;
|
|
1645
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
1646
|
+
while (1) {
|
|
1647
|
+
switch (_context26.prev = _context26.next) {
|
|
1648
|
+
case 0:
|
|
1649
|
+
contractAddress = _ref48.contractAddress, tokenId = _ref48.tokenId;
|
|
1650
|
+
_context26.prev = 1;
|
|
1651
|
+
_context26.next = 4;
|
|
1652
|
+
return this.TenantConfiguration({
|
|
1653
|
+
contractAddress: contractAddress
|
|
1654
|
+
});
|
|
1655
|
+
|
|
1656
|
+
case 4:
|
|
1657
|
+
tenantConfig = _context26.sent;
|
|
1658
|
+
_context26.next = 7;
|
|
1659
|
+
return this.MintingStatus({
|
|
1660
|
+
tenantId: tenantConfig.tenant
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
case 7:
|
|
1664
|
+
statuses = _context26.sent;
|
|
1665
|
+
return _context26.abrupt("return", statuses.find(function (status) {
|
|
1666
|
+
return status.op === "nft-open" && Utils.EqualAddress(contractAddress, status.address) && status.tokenId === tokenId;
|
|
1667
|
+
}) || {
|
|
1668
|
+
status: "none"
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1671
|
+
case 11:
|
|
1672
|
+
_context26.prev = 11;
|
|
1673
|
+
_context26.t0 = _context26["catch"](1);
|
|
1674
|
+
this.Log(_context26.t0, true);
|
|
1675
|
+
return _context26.abrupt("return", {
|
|
1676
|
+
status: "unknown"
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
case 15:
|
|
1680
|
+
case "end":
|
|
1681
|
+
return _context26.stop();
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}, _callee26, this, [[1, 11]]);
|
|
1685
|
+
}));
|
|
1686
|
+
|
|
1687
|
+
return function (_x15) {
|
|
1688
|
+
return _ref49.apply(this, arguments);
|
|
1689
|
+
};
|
|
1690
|
+
}();
|
|
1691
|
+
/**
|
|
1692
|
+
* Return status of the specified collection redemption
|
|
1693
|
+
*
|
|
1694
|
+
* @methodGroup Status
|
|
1695
|
+
* @namedParams
|
|
1696
|
+
* @param {Object} marketplaceParams - Parameters of the marketplace
|
|
1697
|
+
* @param {string} confirmationId - The confirmation ID of the redemption
|
|
1698
|
+
*
|
|
1699
|
+
* @returns {Promise<Object>} - The status of the collection redemption
|
|
1700
|
+
*/
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
exports.CollectionRedemptionStatus = /*#__PURE__*/function () {
|
|
1704
|
+
var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref50) {
|
|
1705
|
+
var marketplaceParams, confirmationId, statuses;
|
|
1706
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
1707
|
+
while (1) {
|
|
1708
|
+
switch (_context27.prev = _context27.next) {
|
|
1709
|
+
case 0:
|
|
1710
|
+
marketplaceParams = _ref50.marketplaceParams, confirmationId = _ref50.confirmationId;
|
|
1711
|
+
_context27.prev = 1;
|
|
1712
|
+
_context27.next = 4;
|
|
1713
|
+
return this.MintingStatus({
|
|
1714
|
+
marketplaceParams: marketplaceParams
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
case 4:
|
|
1718
|
+
statuses = _context27.sent;
|
|
1719
|
+
return _context27.abrupt("return", statuses.find(function (status) {
|
|
1720
|
+
return status.op === "nft-redeem" && status.confirmationId === confirmationId;
|
|
1721
|
+
}) || {
|
|
1722
|
+
status: "none"
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
case 8:
|
|
1726
|
+
_context27.prev = 8;
|
|
1727
|
+
_context27.t0 = _context27["catch"](1);
|
|
1728
|
+
this.Log(_context27.t0, true);
|
|
1729
|
+
return _context27.abrupt("return", {
|
|
1730
|
+
status: "unknown"
|
|
1731
|
+
});
|
|
1732
|
+
|
|
1733
|
+
case 12:
|
|
1734
|
+
case "end":
|
|
1735
|
+
return _context27.stop();
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}, _callee27, this, [[1, 8]]);
|
|
1739
|
+
}));
|
|
1740
|
+
|
|
1741
|
+
return function (_x16) {
|
|
1742
|
+
return _ref51.apply(this, arguments);
|
|
1743
|
+
};
|
|
1744
|
+
}();
|
|
1745
|
+
/* EVENTS */
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
exports.LoadDrop = /*#__PURE__*/function () {
|
|
1749
|
+
var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref52) {
|
|
1750
|
+
var _this2 = this;
|
|
1751
|
+
|
|
1752
|
+
var tenantSlug, eventSlug, dropId, mainSiteHash, event, eventId;
|
|
1753
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
1754
|
+
while (1) {
|
|
1755
|
+
switch (_context28.prev = _context28.next) {
|
|
1756
|
+
case 0:
|
|
1757
|
+
tenantSlug = _ref52.tenantSlug, eventSlug = _ref52.eventSlug, dropId = _ref52.dropId;
|
|
1758
|
+
|
|
1759
|
+
if (!this.drops) {
|
|
1760
|
+
this.drops = {};
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
if (!this.drops[tenantSlug]) {
|
|
1764
|
+
this.drops[tenantSlug] = {};
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
if (!this.drops[tenantSlug][eventSlug]) {
|
|
1768
|
+
this.drops[tenantSlug][eventSlug] = {};
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
if (this.drops[tenantSlug][eventSlug][dropId]) {
|
|
1772
|
+
_context28.next = 16;
|
|
1773
|
+
break;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
_context28.next = 7;
|
|
1777
|
+
return this.client.LatestVersionHash({
|
|
1778
|
+
objectId: this.mainSiteId
|
|
1779
|
+
});
|
|
1780
|
+
|
|
1781
|
+
case 7:
|
|
1782
|
+
mainSiteHash = _context28.sent;
|
|
1783
|
+
_context28.next = 10;
|
|
1784
|
+
return this.client.ContentObjectMetadata({
|
|
1785
|
+
versionHash: mainSiteHash,
|
|
1786
|
+
metadataSubtree: UrlJoin("public", "asset_metadata", "tenants", tenantSlug, "sites", eventSlug, "info"),
|
|
1787
|
+
resolveLinks: true,
|
|
1788
|
+
linkDepthLimit: 2,
|
|
1789
|
+
resolveIncludeSource: true,
|
|
1790
|
+
produceLinkUrls: true,
|
|
1791
|
+
select: [".", "drops"],
|
|
1792
|
+
noAuth: true
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
case 10:
|
|
1796
|
+
_context28.t0 = _context28.sent;
|
|
1797
|
+
|
|
1798
|
+
if (_context28.t0) {
|
|
1799
|
+
_context28.next = 13;
|
|
1800
|
+
break;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
_context28.t0 = [];
|
|
1804
|
+
|
|
1805
|
+
case 13:
|
|
1806
|
+
event = _context28.t0;
|
|
1807
|
+
eventId = Utils.DecodeVersionHash(event["."].source).objectId;
|
|
1808
|
+
event.drops.forEach(function (drop) {
|
|
1809
|
+
drop = _objectSpread(_objectSpread({}, drop), {}, {
|
|
1810
|
+
eventId: eventId
|
|
1811
|
+
});
|
|
1812
|
+
_this2.drops[tenantSlug][eventSlug][drop.uuid] = drop;
|
|
1813
|
+
_this2.drops[drop.uuid] = drop;
|
|
1814
|
+
});
|
|
1815
|
+
|
|
1816
|
+
case 16:
|
|
1817
|
+
return _context28.abrupt("return", this.drops[dropId]);
|
|
1818
|
+
|
|
1819
|
+
case 17:
|
|
1820
|
+
case "end":
|
|
1821
|
+
return _context28.stop();
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}, _callee28, this);
|
|
1825
|
+
}));
|
|
1826
|
+
|
|
1827
|
+
return function (_x17) {
|
|
1828
|
+
return _ref53.apply(this, arguments);
|
|
1829
|
+
};
|
|
1830
|
+
}();
|
|
1831
|
+
|
|
1832
|
+
exports.SubmitDropVote = /*#__PURE__*/function () {
|
|
1833
|
+
var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref54) {
|
|
1834
|
+
var marketplaceParams, eventId, dropId, sku, marketplaceInfo;
|
|
1835
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
1836
|
+
while (1) {
|
|
1837
|
+
switch (_context29.prev = _context29.next) {
|
|
1838
|
+
case 0:
|
|
1839
|
+
marketplaceParams = _ref54.marketplaceParams, eventId = _ref54.eventId, dropId = _ref54.dropId, sku = _ref54.sku;
|
|
1840
|
+
_context29.next = 3;
|
|
1841
|
+
return this.MarketplaceInfo({
|
|
1842
|
+
marketplaceParams: marketplaceParams
|
|
1843
|
+
});
|
|
1844
|
+
|
|
1845
|
+
case 3:
|
|
1846
|
+
marketplaceInfo = _context29.sent;
|
|
1847
|
+
_context29.next = 6;
|
|
1848
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1849
|
+
path: UrlJoin("as", "wlt", "act", marketplaceInfo.tenant_id),
|
|
1850
|
+
method: "POST",
|
|
1851
|
+
body: {
|
|
1852
|
+
op: "vote-drop",
|
|
1853
|
+
evt: eventId,
|
|
1854
|
+
id: dropId,
|
|
1855
|
+
itm: sku
|
|
1856
|
+
},
|
|
1857
|
+
headers: {
|
|
1858
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
|
|
1862
|
+
case 6:
|
|
1863
|
+
case "end":
|
|
1864
|
+
return _context29.stop();
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
}, _callee29, this);
|
|
1868
|
+
}));
|
|
1869
|
+
|
|
1870
|
+
return function (_x18) {
|
|
1871
|
+
return _ref55.apply(this, arguments);
|
|
1872
|
+
};
|
|
1873
|
+
}();
|
|
1874
|
+
|
|
1875
|
+
exports.DropStatus = /*#__PURE__*/function () {
|
|
1876
|
+
var _ref57 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref56) {
|
|
1877
|
+
var marketplace, eventId, dropId, response;
|
|
1878
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
1879
|
+
while (1) {
|
|
1880
|
+
switch (_context30.prev = _context30.next) {
|
|
1881
|
+
case 0:
|
|
1882
|
+
marketplace = _ref56.marketplace, eventId = _ref56.eventId, dropId = _ref56.dropId;
|
|
1883
|
+
_context30.prev = 1;
|
|
1884
|
+
_context30.next = 4;
|
|
1885
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1886
|
+
path: UrlJoin("as", "wlt", "act", marketplace.tenant_id, eventId, dropId),
|
|
1887
|
+
method: "GET",
|
|
1888
|
+
headers: {
|
|
1889
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1890
|
+
}
|
|
1891
|
+
}));
|
|
1892
|
+
|
|
1893
|
+
case 4:
|
|
1894
|
+
response = _context30.sent;
|
|
1895
|
+
return _context30.abrupt("return", response.sort(function (a, b) {
|
|
1896
|
+
return a.ts > b.ts ? 1 : -1;
|
|
1897
|
+
})[0] || {
|
|
1898
|
+
status: "none"
|
|
1899
|
+
});
|
|
1900
|
+
|
|
1901
|
+
case 8:
|
|
1902
|
+
_context30.prev = 8;
|
|
1903
|
+
_context30.t0 = _context30["catch"](1);
|
|
1904
|
+
this.Log(_context30.t0, true);
|
|
1905
|
+
return _context30.abrupt("return", "");
|
|
1906
|
+
|
|
1907
|
+
case 12:
|
|
1908
|
+
case "end":
|
|
1909
|
+
return _context30.stop();
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}, _callee30, this, [[1, 8]]);
|
|
1913
|
+
}));
|
|
1914
|
+
|
|
1915
|
+
return function (_x19) {
|
|
1916
|
+
return _ref57.apply(this, arguments);
|
|
1917
|
+
};
|
|
1918
|
+
}();
|