@eluvio/elv-client-js 3.2.2 → 3.2.6
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 +15 -11
- package/dist/ElvClient-node-min.js +17 -13
- package/dist/ElvFrameClient-min.js +12 -8
- package/dist/ElvPermissionsClient-min.js +13 -9
- package/dist/ElvWalletClient-min.js +58 -0
- package/dist/ElvWalletClient-node-min.js +78 -0
- package/dist/src/AuthorizationClient.js +2248 -1990
- package/dist/src/ContentObjectVerification.js +164 -173
- package/dist/src/Crypto.js +376 -324
- package/dist/src/ElvClient.js +1182 -1019
- package/dist/src/ElvWallet.js +119 -95
- package/dist/src/EthClient.js +1040 -896
- package/dist/src/FrameClient.js +331 -300
- package/dist/src/HttpClient.js +153 -147
- package/dist/src/Id.js +1 -3
- package/dist/src/PermissionsClient.js +1294 -1168
- package/dist/src/RemoteSigner.js +263 -211
- package/dist/src/UserProfileClient.js +1164 -1023
- package/dist/src/Utils.js +209 -181
- package/dist/src/client/ABRPublishing.js +895 -858
- package/dist/src/client/AccessGroups.js +1102 -959
- package/dist/src/client/ContentAccess.js +3724 -3431
- package/dist/src/client/ContentManagement.js +2252 -2068
- package/dist/src/client/Contracts.js +647 -563
- package/dist/src/client/Files.js +1886 -1757
- package/dist/src/client/NFT.js +126 -112
- package/dist/src/client/NTP.js +478 -422
- package/dist/src/walletClient/ClientMethods.js +1029 -879
- package/dist/src/walletClient/Utils.js +84 -70
- package/dist/src/walletClient/index.js +1203 -1087
- package/package.json +4 -2
- package/src/Utils.js +0 -1
- package/src/walletClient/ClientMethods.js +34 -2
- package/src/walletClient/index.js +3 -3
- package/utilities/ProductionMasterCreate.js +2 -2
|
@@ -6,13 +6,15 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
|
6
6
|
|
|
7
7
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
8
8
|
|
|
9
|
+
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
10
|
+
|
|
9
11
|
var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
|
|
10
12
|
|
|
11
13
|
var _createClass = require("@babel/runtime/helpers/createClass");
|
|
12
14
|
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
15
|
+
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; }
|
|
14
16
|
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
17
|
+
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; }
|
|
16
18
|
|
|
17
19
|
var _require = require("../ElvClient"),
|
|
18
20
|
ElvClient = _require.ElvClient;
|
|
@@ -35,9 +37,7 @@ var Utils = require("../Utils");
|
|
|
35
37
|
*/
|
|
36
38
|
|
|
37
39
|
|
|
38
|
-
var ElvWalletClient =
|
|
39
|
-
/*#__PURE__*/
|
|
40
|
-
function () {
|
|
40
|
+
var ElvWalletClient = /*#__PURE__*/function () {
|
|
41
41
|
"use strict";
|
|
42
42
|
|
|
43
43
|
function ElvWalletClient(_ref) {
|
|
@@ -98,7 +98,7 @@ function () {
|
|
|
98
98
|
|
|
99
99
|
}, {
|
|
100
100
|
key: "LogIn",
|
|
101
|
-
|
|
101
|
+
value:
|
|
102
102
|
/* Login and authorization */
|
|
103
103
|
|
|
104
104
|
/**
|
|
@@ -119,158 +119,180 @@ function () {
|
|
|
119
119
|
*
|
|
120
120
|
* @throws - If using the popup flow and the user closes the popup, this method will throw an error.
|
|
121
121
|
*/
|
|
122
|
-
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (mode) {
|
|
142
|
-
loginUrl.searchParams.set("mode", mode);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (!marketplaceParams) {
|
|
146
|
-
_context3.next = 15;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
_context3.t0 = loginUrl.searchParams;
|
|
151
|
-
_context3.next = 11;
|
|
152
|
-
return _regeneratorRuntime.awrap(this.MarketplaceInfo({
|
|
153
|
-
marketplaceParams: marketplaceParams
|
|
154
|
-
}));
|
|
122
|
+
function () {
|
|
123
|
+
var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
124
|
+
var _this = this;
|
|
125
|
+
|
|
126
|
+
var _ref2$method, method, provider, _ref2$mode, mode, callbackUrl, marketplaceParams, _ref2$clearLogin, clearLogin, callback, loginUrl;
|
|
127
|
+
|
|
128
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
129
|
+
while (1) {
|
|
130
|
+
switch (_context3.prev = _context3.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
_ref2$method = _ref2.method, method = _ref2$method === void 0 ? "redirect" : _ref2$method, provider = _ref2.provider, _ref2$mode = _ref2.mode, mode = _ref2$mode === void 0 ? "login" : _ref2$mode, callbackUrl = _ref2.callbackUrl, marketplaceParams = _ref2.marketplaceParams, _ref2$clearLogin = _ref2.clearLogin, clearLogin = _ref2$clearLogin === void 0 ? false : _ref2$clearLogin, callback = _ref2.callback;
|
|
133
|
+
loginUrl = new URL(this.appUrl);
|
|
134
|
+
loginUrl.hash = "/login";
|
|
135
|
+
loginUrl.searchParams.set("origin", window.location.origin);
|
|
136
|
+
loginUrl.searchParams.set("action", "login");
|
|
137
|
+
|
|
138
|
+
if (provider) {
|
|
139
|
+
loginUrl.searchParams.set("provider", provider);
|
|
140
|
+
}
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
if (mode) {
|
|
143
|
+
loginUrl.searchParams.set("mode", mode);
|
|
144
|
+
}
|
|
158
145
|
|
|
159
|
-
|
|
146
|
+
if (!marketplaceParams) {
|
|
147
|
+
_context3.next = 15;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
160
150
|
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
_context3.t0 = loginUrl.searchParams;
|
|
152
|
+
_context3.next = 11;
|
|
153
|
+
return this.MarketplaceInfo({
|
|
154
|
+
marketplaceParams: marketplaceParams
|
|
155
|
+
});
|
|
163
156
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
loginUrl.searchParams.set("mid", this.selectedMarketplaceInfo.marketplaceHash);
|
|
167
|
-
}
|
|
157
|
+
case 11:
|
|
158
|
+
_context3.t1 = _context3.sent.marketplaceHash;
|
|
168
159
|
|
|
169
|
-
|
|
170
|
-
if (clearLogin) {
|
|
171
|
-
loginUrl.searchParams.set("clear", "");
|
|
172
|
-
}
|
|
160
|
+
_context3.t0.set.call(_context3.t0, "mid", _context3.t1);
|
|
173
161
|
|
|
174
|
-
|
|
175
|
-
_context3.next = 24;
|
|
162
|
+
_context3.next = 16;
|
|
176
163
|
break;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
loginUrl.searchParams.set("response", "redirect");
|
|
180
|
-
loginUrl.searchParams.set("source", "origin");
|
|
181
|
-
loginUrl.searchParams.set("redirect", callbackUrl);
|
|
182
|
-
window.location = loginUrl;
|
|
183
|
-
_context3.next = 28;
|
|
184
|
-
break;
|
|
185
|
-
|
|
186
|
-
case 24:
|
|
187
|
-
loginUrl.searchParams.set("response", "message");
|
|
188
|
-
loginUrl.searchParams.set("source", "parent");
|
|
189
|
-
_context3.next = 28;
|
|
190
|
-
return _regeneratorRuntime.awrap(new Promise(function _callee(resolve, reject) {
|
|
191
|
-
return _regeneratorRuntime.async(function _callee$(_context2) {
|
|
192
|
-
while (1) {
|
|
193
|
-
switch (_context2.prev = _context2.next) {
|
|
194
|
-
case 0:
|
|
195
|
-
_context2.next = 2;
|
|
196
|
-
return _regeneratorRuntime.awrap(ActionPopup({
|
|
197
|
-
mode: "tab",
|
|
198
|
-
url: loginUrl.toString(),
|
|
199
|
-
onCancel: function onCancel() {
|
|
200
|
-
return reject("User cancelled login");
|
|
201
|
-
},
|
|
202
|
-
onMessage: function onMessage(event, Close) {
|
|
203
|
-
return _regeneratorRuntime.async(function onMessage$(_context) {
|
|
204
|
-
while (1) {
|
|
205
|
-
switch (_context.prev = _context.next) {
|
|
206
|
-
case 0:
|
|
207
|
-
if (!(!event || !event.data || event.data.type !== "LoginResponse")) {
|
|
208
|
-
_context.next = 2;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
164
|
|
|
212
|
-
|
|
165
|
+
case 15:
|
|
166
|
+
if ((this.selectedMarketplaceInfo || {}).marketplaceHash) {
|
|
167
|
+
loginUrl.searchParams.set("mid", this.selectedMarketplaceInfo.marketplaceHash);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
case 16:
|
|
171
|
+
if (clearLogin) {
|
|
172
|
+
loginUrl.searchParams.set("clear", "");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!(method === "redirect")) {
|
|
176
|
+
_context3.next = 24;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
213
179
|
|
|
214
|
-
|
|
215
|
-
|
|
180
|
+
loginUrl.searchParams.set("response", "redirect");
|
|
181
|
+
loginUrl.searchParams.set("source", "origin");
|
|
182
|
+
loginUrl.searchParams.set("redirect", callbackUrl);
|
|
183
|
+
window.location = loginUrl;
|
|
184
|
+
_context3.next = 28;
|
|
185
|
+
break;
|
|
216
186
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
187
|
+
case 24:
|
|
188
|
+
loginUrl.searchParams.set("response", "message");
|
|
189
|
+
loginUrl.searchParams.set("source", "parent");
|
|
190
|
+
_context3.next = 28;
|
|
191
|
+
return new Promise( /*#__PURE__*/function () {
|
|
192
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
193
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
194
|
+
while (1) {
|
|
195
|
+
switch (_context2.prev = _context2.next) {
|
|
196
|
+
case 0:
|
|
197
|
+
_context2.next = 2;
|
|
198
|
+
return ActionPopup({
|
|
199
|
+
mode: "tab",
|
|
200
|
+
url: loginUrl.toString(),
|
|
201
|
+
onCancel: function onCancel() {
|
|
202
|
+
return reject("User cancelled login");
|
|
203
|
+
},
|
|
204
|
+
onMessage: function () {
|
|
205
|
+
var _onMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event, Close) {
|
|
206
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
207
|
+
while (1) {
|
|
208
|
+
switch (_context.prev = _context.next) {
|
|
209
|
+
case 0:
|
|
210
|
+
if (!(!event || !event.data || event.data.type !== "LoginResponse")) {
|
|
211
|
+
_context.next = 2;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return _context.abrupt("return");
|
|
216
|
+
|
|
217
|
+
case 2:
|
|
218
|
+
_context.prev = 2;
|
|
219
|
+
|
|
220
|
+
if (!callback) {
|
|
221
|
+
_context.next = 8;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
_context.next = 6;
|
|
226
|
+
return callback(event.data.params);
|
|
227
|
+
|
|
228
|
+
case 6:
|
|
229
|
+
_context.next = 10;
|
|
230
|
+
break;
|
|
231
|
+
|
|
232
|
+
case 8:
|
|
233
|
+
_context.next = 10;
|
|
234
|
+
return _this.Authenticate({
|
|
235
|
+
token: event.data.params.clientSigningToken || event.data.params.clientAuthToken
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
case 10:
|
|
239
|
+
resolve();
|
|
240
|
+
_context.next = 16;
|
|
241
|
+
break;
|
|
242
|
+
|
|
243
|
+
case 13:
|
|
244
|
+
_context.prev = 13;
|
|
245
|
+
_context.t0 = _context["catch"](2);
|
|
246
|
+
reject(_context.t0);
|
|
247
|
+
|
|
248
|
+
case 16:
|
|
249
|
+
_context.prev = 16;
|
|
250
|
+
Close();
|
|
251
|
+
return _context.finish(16);
|
|
252
|
+
|
|
253
|
+
case 19:
|
|
254
|
+
case "end":
|
|
255
|
+
return _context.stop();
|
|
256
|
+
}
|
|
220
257
|
}
|
|
258
|
+
}, _callee, null, [[2, 13, 16, 19]]);
|
|
259
|
+
}));
|
|
221
260
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
case 6:
|
|
226
|
-
_context.next = 10;
|
|
227
|
-
break;
|
|
228
|
-
|
|
229
|
-
case 8:
|
|
230
|
-
_context.next = 10;
|
|
231
|
-
return _regeneratorRuntime.awrap(_this.Authenticate({
|
|
232
|
-
token: event.data.params.clientSigningToken || event.data.params.clientAuthToken
|
|
233
|
-
}));
|
|
234
|
-
|
|
235
|
-
case 10:
|
|
236
|
-
resolve();
|
|
237
|
-
_context.next = 16;
|
|
238
|
-
break;
|
|
239
|
-
|
|
240
|
-
case 13:
|
|
241
|
-
_context.prev = 13;
|
|
242
|
-
_context.t0 = _context["catch"](2);
|
|
243
|
-
reject(_context.t0);
|
|
244
|
-
|
|
245
|
-
case 16:
|
|
246
|
-
_context.prev = 16;
|
|
247
|
-
Close();
|
|
248
|
-
return _context.finish(16);
|
|
249
|
-
|
|
250
|
-
case 19:
|
|
251
|
-
case "end":
|
|
252
|
-
return _context.stop();
|
|
261
|
+
function onMessage(_x4, _x5) {
|
|
262
|
+
return _onMessage.apply(this, arguments);
|
|
253
263
|
}
|
|
254
|
-
}
|
|
255
|
-
}, null, null, [[2, 13, 16, 19]]);
|
|
256
|
-
}
|
|
257
|
-
}));
|
|
258
264
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
265
|
+
return onMessage;
|
|
266
|
+
}()
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
case 2:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context2.stop();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, _callee2);
|
|
275
|
+
}));
|
|
276
|
+
|
|
277
|
+
return function (_x2, _x3) {
|
|
278
|
+
return _ref3.apply(this, arguments);
|
|
279
|
+
};
|
|
280
|
+
}());
|
|
266
281
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
282
|
+
case 28:
|
|
283
|
+
case "end":
|
|
284
|
+
return _context3.stop();
|
|
285
|
+
}
|
|
270
286
|
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
287
|
+
}, _callee3, this);
|
|
288
|
+
}));
|
|
289
|
+
|
|
290
|
+
function LogIn(_x) {
|
|
291
|
+
return _LogIn.apply(this, arguments);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return LogIn;
|
|
295
|
+
}()
|
|
274
296
|
/**
|
|
275
297
|
* Remove authorization for the current user.
|
|
276
298
|
*
|
|
@@ -300,51 +322,63 @@ function () {
|
|
|
300
322
|
|
|
301
323
|
}, {
|
|
302
324
|
key: "Authenticate",
|
|
303
|
-
value: function
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
case 5:
|
|
316
|
-
_context4.prev = 5;
|
|
317
|
-
_context4.t0 = _context4["catch"](1);
|
|
318
|
-
throw new Error("Invalid authorization token " + token);
|
|
319
|
-
|
|
320
|
-
case 8:
|
|
321
|
-
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
322
|
-
_context4.next = 10;
|
|
325
|
+
value: function () {
|
|
326
|
+
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
|
|
327
|
+
var token, decodedToken;
|
|
328
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
329
|
+
while (1) {
|
|
330
|
+
switch (_context4.prev = _context4.next) {
|
|
331
|
+
case 0:
|
|
332
|
+
token = _ref4.token;
|
|
333
|
+
_context4.prev = 1;
|
|
334
|
+
decodedToken = JSON.parse(this.utils.FromB58ToStr(token)) || {};
|
|
335
|
+
_context4.next = 8;
|
|
323
336
|
break;
|
|
324
|
-
}
|
|
325
337
|
|
|
326
|
-
|
|
338
|
+
case 5:
|
|
339
|
+
_context4.prev = 5;
|
|
340
|
+
_context4.t0 = _context4["catch"](1);
|
|
341
|
+
throw new Error("Invalid authorization token " + token);
|
|
327
342
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
343
|
+
case 8:
|
|
344
|
+
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
345
|
+
_context4.next = 10;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
throw Error("ElvWalletClient: Provided authorization token has expired");
|
|
350
|
+
|
|
351
|
+
case 10:
|
|
352
|
+
if (!decodedToken.clusterToken) {
|
|
353
|
+
_context4.next = 13;
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
332
356
|
|
|
333
|
-
|
|
334
|
-
this.client.SetRemoteSigner({
|
|
357
|
+
_context4.next = 13;
|
|
358
|
+
return this.client.SetRemoteSigner({
|
|
335
359
|
authToken: decodedToken.clusterToken
|
|
336
360
|
});
|
|
337
|
-
}
|
|
338
361
|
|
|
339
|
-
|
|
362
|
+
case 13:
|
|
363
|
+
this.client.SetStaticToken({
|
|
364
|
+
token: decodedToken.fabricToken
|
|
365
|
+
});
|
|
366
|
+
return _context4.abrupt("return", this.SetAuthorization(decodedToken));
|
|
340
367
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
368
|
+
case 15:
|
|
369
|
+
case "end":
|
|
370
|
+
return _context4.stop();
|
|
371
|
+
}
|
|
344
372
|
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
373
|
+
}, _callee4, this, [[1, 5]]);
|
|
374
|
+
}));
|
|
375
|
+
|
|
376
|
+
function Authenticate(_x6) {
|
|
377
|
+
return _Authenticate.apply(this, arguments);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return Authenticate;
|
|
381
|
+
}()
|
|
348
382
|
/**
|
|
349
383
|
* Authenticate with an OAuth ID token
|
|
350
384
|
*
|
|
@@ -367,97 +401,105 @@ function () {
|
|
|
367
401
|
|
|
368
402
|
}, {
|
|
369
403
|
key: "AuthenticateOAuth",
|
|
370
|
-
value: function
|
|
371
|
-
var
|
|
404
|
+
value: function () {
|
|
405
|
+
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
|
|
406
|
+
var idToken, tenantId, email, _ref5$shareEmail, shareEmail, _ref5$tokenDuration, tokenDuration, expiresAt, fabricToken, address, decodedToken;
|
|
407
|
+
|
|
408
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
409
|
+
while (1) {
|
|
410
|
+
switch (_context5.prev = _context5.next) {
|
|
411
|
+
case 0:
|
|
412
|
+
idToken = _ref5.idToken, tenantId = _ref5.tenantId, email = _ref5.email, _ref5$shareEmail = _ref5.shareEmail, shareEmail = _ref5$shareEmail === void 0 ? false : _ref5$shareEmail, _ref5$tokenDuration = _ref5.tokenDuration, tokenDuration = _ref5$tokenDuration === void 0 ? 24 : _ref5$tokenDuration;
|
|
413
|
+
|
|
414
|
+
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
415
|
+
_context5.next = 5;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
372
418
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
switch (_context5.prev = _context5.next) {
|
|
376
|
-
case 0:
|
|
377
|
-
idToken = _ref4.idToken, tenantId = _ref4.tenantId, email = _ref4.email, _ref4$shareEmail = _ref4.shareEmail, shareEmail = _ref4$shareEmail === void 0 ? false : _ref4$shareEmail, _ref4$tokenDuration = _ref4.tokenDuration, tokenDuration = _ref4$tokenDuration === void 0 ? 24 : _ref4$tokenDuration;
|
|
419
|
+
_context5.next = 4;
|
|
420
|
+
return this.AvailableMarketplaces();
|
|
378
421
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (email) {
|
|
422
|
+
case 4:
|
|
423
|
+
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
424
|
+
|
|
425
|
+
case 5:
|
|
426
|
+
_context5.next = 7;
|
|
427
|
+
return this.client.SetRemoteSigner({
|
|
428
|
+
idToken: idToken,
|
|
429
|
+
tenantId: tenantId,
|
|
430
|
+
extraData: {
|
|
431
|
+
share_email: shareEmail
|
|
432
|
+
},
|
|
433
|
+
unsignedPublicAuth: true
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
case 7:
|
|
437
|
+
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
438
|
+
_context5.next = 10;
|
|
439
|
+
return this.client.CreateFabricToken({
|
|
440
|
+
duration: tokenDuration * 60 * 60 * 1000
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
case 10:
|
|
444
|
+
fabricToken = _context5.sent;
|
|
445
|
+
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
446
|
+
|
|
447
|
+
if (email) {
|
|
448
|
+
_context5.next = 21;
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
_context5.prev = 13;
|
|
453
|
+
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
454
|
+
email = decodedToken.email;
|
|
413
455
|
_context5.next = 21;
|
|
414
456
|
break;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
})
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
case 23:
|
|
455
|
-
case "end":
|
|
456
|
-
return _context5.stop();
|
|
457
|
+
|
|
458
|
+
case 18:
|
|
459
|
+
_context5.prev = 18;
|
|
460
|
+
_context5.t0 = _context5["catch"](13);
|
|
461
|
+
throw Error("Failed to decode ID token");
|
|
462
|
+
|
|
463
|
+
case 21:
|
|
464
|
+
this.client.SetStaticToken({
|
|
465
|
+
token: fabricToken
|
|
466
|
+
});
|
|
467
|
+
return _context5.abrupt("return", {
|
|
468
|
+
authToken: this.SetAuthorization({
|
|
469
|
+
fabricToken: fabricToken,
|
|
470
|
+
tenantId: tenantId,
|
|
471
|
+
address: address,
|
|
472
|
+
email: email,
|
|
473
|
+
expiresAt: expiresAt,
|
|
474
|
+
walletType: "Custodial",
|
|
475
|
+
walletName: "Eluvio"
|
|
476
|
+
}),
|
|
477
|
+
signingToken: this.SetAuthorization({
|
|
478
|
+
clusterToken: this.client.signer.authToken,
|
|
479
|
+
fabricToken: fabricToken,
|
|
480
|
+
tenantId: tenantId,
|
|
481
|
+
address: address,
|
|
482
|
+
email: email,
|
|
483
|
+
expiresAt: expiresAt,
|
|
484
|
+
walletType: "Custodial",
|
|
485
|
+
walletName: "Eluvio"
|
|
486
|
+
})
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
case 23:
|
|
490
|
+
case "end":
|
|
491
|
+
return _context5.stop();
|
|
492
|
+
}
|
|
457
493
|
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
494
|
+
}, _callee5, this, [[13, 18]]);
|
|
495
|
+
}));
|
|
496
|
+
|
|
497
|
+
function AuthenticateOAuth(_x7) {
|
|
498
|
+
return _AuthenticateOAuth.apply(this, arguments);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return AuthenticateOAuth;
|
|
502
|
+
}()
|
|
461
503
|
/**
|
|
462
504
|
* Authenticate with an external Ethereum compatible wallet, like Metamask.
|
|
463
505
|
*
|
|
@@ -474,69 +516,83 @@ function () {
|
|
|
474
516
|
|
|
475
517
|
}, {
|
|
476
518
|
key: "AuthenticateExternalWallet",
|
|
477
|
-
value: function
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
address
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
519
|
+
value: function () {
|
|
520
|
+
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
|
|
521
|
+
var _this2 = this;
|
|
522
|
+
|
|
523
|
+
var address, _ref6$tokenDuration, tokenDuration, _ref6$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
524
|
+
|
|
525
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
526
|
+
while (1) {
|
|
527
|
+
switch (_context7.prev = _context7.next) {
|
|
528
|
+
case 0:
|
|
529
|
+
address = _ref6.address, _ref6$tokenDuration = _ref6.tokenDuration, tokenDuration = _ref6$tokenDuration === void 0 ? 24 : _ref6$tokenDuration, _ref6$walletName = _ref6.walletName, walletName = _ref6$walletName === void 0 ? "Metamask" : _ref6$walletName, Sign = _ref6.Sign;
|
|
530
|
+
|
|
531
|
+
if (!address) {
|
|
532
|
+
address = window.ethereum.selectedAddress;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
address = this.utils.FormatAddress(address);
|
|
536
|
+
|
|
537
|
+
if (!Sign) {
|
|
538
|
+
Sign = /*#__PURE__*/function () {
|
|
539
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(message) {
|
|
540
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
541
|
+
while (1) {
|
|
542
|
+
switch (_context6.prev = _context6.next) {
|
|
543
|
+
case 0:
|
|
544
|
+
return _context6.abrupt("return", _this2.SignMetamask({
|
|
545
|
+
message: message,
|
|
546
|
+
address: address
|
|
547
|
+
}));
|
|
548
|
+
|
|
549
|
+
case 1:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context6.stop();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}, _callee6);
|
|
555
|
+
}));
|
|
556
|
+
|
|
557
|
+
return function Sign(_x9) {
|
|
558
|
+
return _ref7.apply(this, arguments);
|
|
559
|
+
};
|
|
560
|
+
}();
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
564
|
+
_context7.next = 7;
|
|
565
|
+
return this.client.CreateFabricToken({
|
|
566
|
+
address: address,
|
|
567
|
+
duration: tokenDuration * 60 * 60 * 1000,
|
|
568
|
+
Sign: Sign,
|
|
569
|
+
addEthereumPrefix: false
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
case 7:
|
|
573
|
+
fabricToken = _context7.sent;
|
|
574
|
+
return _context7.abrupt("return", this.SetAuthorization({
|
|
575
|
+
fabricToken: fabricToken,
|
|
576
|
+
address: address,
|
|
577
|
+
expiresAt: expiresAt,
|
|
578
|
+
walletType: "External",
|
|
579
|
+
walletName: walletName
|
|
580
|
+
}));
|
|
581
|
+
|
|
582
|
+
case 9:
|
|
583
|
+
case "end":
|
|
584
|
+
return _context7.stop();
|
|
585
|
+
}
|
|
536
586
|
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
|
|
587
|
+
}, _callee7, this);
|
|
588
|
+
}));
|
|
589
|
+
|
|
590
|
+
function AuthenticateExternalWallet(_x8) {
|
|
591
|
+
return _AuthenticateExternalWallet.apply(this, arguments);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
return AuthenticateExternalWallet;
|
|
595
|
+
}()
|
|
540
596
|
/**
|
|
541
597
|
* <b><i>Requires login</i></b>
|
|
542
598
|
*
|
|
@@ -565,15 +621,15 @@ function () {
|
|
|
565
621
|
}
|
|
566
622
|
}, {
|
|
567
623
|
key: "SetAuthorization",
|
|
568
|
-
value: function SetAuthorization(
|
|
569
|
-
var clusterToken =
|
|
570
|
-
fabricToken =
|
|
571
|
-
tenantId =
|
|
572
|
-
address =
|
|
573
|
-
email =
|
|
574
|
-
expiresAt =
|
|
575
|
-
walletType =
|
|
576
|
-
walletName =
|
|
624
|
+
value: function SetAuthorization(_ref8) {
|
|
625
|
+
var clusterToken = _ref8.clusterToken,
|
|
626
|
+
fabricToken = _ref8.fabricToken,
|
|
627
|
+
tenantId = _ref8.tenantId,
|
|
628
|
+
address = _ref8.address,
|
|
629
|
+
email = _ref8.email,
|
|
630
|
+
expiresAt = _ref8.expiresAt,
|
|
631
|
+
walletType = _ref8.walletType,
|
|
632
|
+
walletName = _ref8.walletName;
|
|
577
633
|
address = this.client.utils.FormatAddress(address);
|
|
578
634
|
this.__authorization = {
|
|
579
635
|
fabricToken: fabricToken,
|
|
@@ -603,853 +659,913 @@ function () {
|
|
|
603
659
|
}
|
|
604
660
|
}, {
|
|
605
661
|
key: "SignMetamask",
|
|
606
|
-
value: function
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
662
|
+
value: function () {
|
|
663
|
+
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref9) {
|
|
664
|
+
var message, address, from;
|
|
665
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
666
|
+
while (1) {
|
|
667
|
+
switch (_context8.prev = _context8.next) {
|
|
668
|
+
case 0:
|
|
669
|
+
message = _ref9.message, address = _ref9.address;
|
|
670
|
+
|
|
671
|
+
if (window.ethereum) {
|
|
672
|
+
_context8.next = 3;
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
|
|
677
|
+
|
|
678
|
+
case 3:
|
|
679
|
+
_context8.next = 5;
|
|
680
|
+
return window.ethereum.request({
|
|
681
|
+
method: "eth_requestAccounts"
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
case 5:
|
|
685
|
+
from = address || window.ethereum.selectedAddress;
|
|
686
|
+
_context8.next = 8;
|
|
687
|
+
return window.ethereum.request({
|
|
688
|
+
method: "personal_sign",
|
|
689
|
+
params: [message, from, ""]
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
case 8:
|
|
693
|
+
return _context8.abrupt("return", _context8.sent);
|
|
694
|
+
|
|
695
|
+
case 9:
|
|
696
|
+
case "end":
|
|
697
|
+
return _context8.stop();
|
|
698
|
+
}
|
|
641
699
|
}
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
|
|
700
|
+
}, _callee8);
|
|
701
|
+
}));
|
|
702
|
+
|
|
703
|
+
function SignMetamask(_x10) {
|
|
704
|
+
return _SignMetamask.apply(this, arguments);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return SignMetamask;
|
|
708
|
+
}() // Internal loading methods
|
|
645
709
|
// If marketplace slug is specified, load only that marketplace. Otherwise load all
|
|
646
710
|
|
|
647
711
|
}, {
|
|
648
712
|
key: "LoadAvailableMarketplaces",
|
|
649
|
-
value: function
|
|
650
|
-
var
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
if (_this3.selectedMarketplaceInfo
|
|
725
|
-
_this3.selectedMarketplaceInfo
|
|
713
|
+
value: function () {
|
|
714
|
+
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
715
|
+
var _this3 = this;
|
|
716
|
+
|
|
717
|
+
var forceReload,
|
|
718
|
+
mainSiteHash,
|
|
719
|
+
metadata,
|
|
720
|
+
availableMarketplaces,
|
|
721
|
+
availableMarketplacesById,
|
|
722
|
+
_args9 = arguments;
|
|
723
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
724
|
+
while (1) {
|
|
725
|
+
switch (_context9.prev = _context9.next) {
|
|
726
|
+
case 0:
|
|
727
|
+
forceReload = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
728
|
+
|
|
729
|
+
if (!(!forceReload && Object.keys(this.availableMarketplaces) > 0)) {
|
|
730
|
+
_context9.next = 3;
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
return _context9.abrupt("return");
|
|
735
|
+
|
|
736
|
+
case 3:
|
|
737
|
+
_context9.next = 5;
|
|
738
|
+
return this.client.LatestVersionHash({
|
|
739
|
+
objectId: this.mainSiteId
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
case 5:
|
|
743
|
+
mainSiteHash = _context9.sent;
|
|
744
|
+
_context9.next = 8;
|
|
745
|
+
return this.client.ContentObjectMetadata({
|
|
746
|
+
versionHash: mainSiteHash,
|
|
747
|
+
metadataSubtree: "public/asset_metadata/tenants",
|
|
748
|
+
resolveLinks: true,
|
|
749
|
+
linkDepthLimit: 2,
|
|
750
|
+
resolveIncludeSource: true,
|
|
751
|
+
resolveIgnoreErrors: true,
|
|
752
|
+
produceLinkUrls: true,
|
|
753
|
+
authorizationToken: this.publicStaticToken,
|
|
754
|
+
noAuth: true,
|
|
755
|
+
select: ["*/.", "*/marketplaces/*/.", "*/marketplaces/*/info/tenant_id", "*/marketplaces/*/info/tenant_name", "*/marketplaces/*/info/branding"],
|
|
756
|
+
remove: ["*/marketplaces/*/info/branding/custom_css"]
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
case 8:
|
|
760
|
+
metadata = _context9.sent;
|
|
761
|
+
availableMarketplaces = _objectSpread({}, this.availableMarketplaces || {});
|
|
762
|
+
availableMarketplacesById = _objectSpread({}, this.availableMarketplacesById || {});
|
|
763
|
+
Object.keys(metadata || {}).forEach(function (tenantSlug) {
|
|
764
|
+
try {
|
|
765
|
+
availableMarketplaces[tenantSlug] = {
|
|
766
|
+
versionHash: metadata[tenantSlug]["."].source
|
|
767
|
+
};
|
|
768
|
+
Object.keys(metadata[tenantSlug].marketplaces || {}).forEach(function (marketplaceSlug) {
|
|
769
|
+
try {
|
|
770
|
+
var versionHash = metadata[tenantSlug].marketplaces[marketplaceSlug]["."].source;
|
|
771
|
+
|
|
772
|
+
var objectId = _this3.utils.DecodeVersionHash(versionHash).objectId;
|
|
773
|
+
|
|
774
|
+
availableMarketplaces[tenantSlug][marketplaceSlug] = _objectSpread(_objectSpread({}, metadata[tenantSlug].marketplaces[marketplaceSlug].info || {}), {}, {
|
|
775
|
+
tenantName: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_name,
|
|
776
|
+
tenantId: metadata[tenantSlug].marketplaces[marketplaceSlug].info.tenant_id,
|
|
777
|
+
tenantSlug: tenantSlug,
|
|
778
|
+
marketplaceSlug: marketplaceSlug,
|
|
779
|
+
marketplaceId: objectId,
|
|
780
|
+
marketplaceHash: versionHash,
|
|
781
|
+
order: Configuration.__MARKETPLACE_ORDER.findIndex(function (slug) {
|
|
782
|
+
return slug === marketplaceSlug;
|
|
783
|
+
})
|
|
784
|
+
});
|
|
785
|
+
availableMarketplacesById[objectId] = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
786
|
+
_this3.marketplaceHashes[objectId] = versionHash; // Fill out selected marketplace info
|
|
787
|
+
|
|
788
|
+
if (_this3.selectedMarketplaceInfo) {
|
|
789
|
+
if (_this3.selectedMarketplaceInfo.tenantSlug === tenantSlug && _this3.selectedMarketplaceInfo.marketplaceSlug === marketplaceSlug || _this3.selectedMarketplaceInfo.marketplaceId === objectId) {
|
|
790
|
+
_this3.selectedMarketplaceInfo = availableMarketplaces[tenantSlug][marketplaceSlug];
|
|
791
|
+
}
|
|
726
792
|
}
|
|
793
|
+
} catch (error) {
|
|
794
|
+
_this3.Log("Eluvio Wallet Client: Unable to load info for marketplace ".concat(tenantSlug, "/").concat(marketplaceSlug), true);
|
|
727
795
|
}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
});
|
|
732
|
-
} catch (error) {
|
|
733
|
-
_this3.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true);
|
|
796
|
+
});
|
|
797
|
+
} catch (error) {
|
|
798
|
+
_this3.Log("Eluvio Wallet Client: Failed to load tenant info ".concat(tenantSlug), true);
|
|
734
799
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
800
|
+
_this3.Log(error, true);
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
this.availableMarketplaces = availableMarketplaces;
|
|
804
|
+
this.availableMarketplacesById = availableMarketplacesById;
|
|
740
805
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
806
|
+
case 14:
|
|
807
|
+
case "end":
|
|
808
|
+
return _context9.stop();
|
|
809
|
+
}
|
|
744
810
|
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
811
|
+
}, _callee9, this);
|
|
812
|
+
}));
|
|
813
|
+
|
|
814
|
+
function LoadAvailableMarketplaces() {
|
|
815
|
+
return _LoadAvailableMarketplaces.apply(this, arguments);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
return LoadAvailableMarketplaces;
|
|
819
|
+
}() // Get the hash of the currently linked marketplace
|
|
748
820
|
|
|
749
821
|
}, {
|
|
750
822
|
key: "LatestMarketplaceHash",
|
|
751
|
-
value: function
|
|
752
|
-
var
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
823
|
+
value: function () {
|
|
824
|
+
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref10) {
|
|
825
|
+
var tenantSlug, marketplaceSlug, mainSiteHash, marketplaceLink;
|
|
826
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
827
|
+
while (1) {
|
|
828
|
+
switch (_context10.prev = _context10.next) {
|
|
829
|
+
case 0:
|
|
830
|
+
tenantSlug = _ref10.tenantSlug, marketplaceSlug = _ref10.marketplaceSlug;
|
|
831
|
+
_context10.next = 3;
|
|
832
|
+
return this.client.LatestVersionHash({
|
|
833
|
+
objectId: this.mainSiteId
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
case 3:
|
|
837
|
+
mainSiteHash = _context10.sent;
|
|
838
|
+
_context10.next = 6;
|
|
839
|
+
return this.client.ContentObjectMetadata({
|
|
840
|
+
versionHash: mainSiteHash,
|
|
841
|
+
metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", tenantSlug, "marketplaces", marketplaceSlug),
|
|
842
|
+
resolveLinks: false
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
case 6:
|
|
846
|
+
marketplaceLink = _context10.sent;
|
|
847
|
+
return _context10.abrupt("return", LinkTargetHash(marketplaceLink));
|
|
848
|
+
|
|
849
|
+
case 8:
|
|
850
|
+
case "end":
|
|
851
|
+
return _context10.stop();
|
|
852
|
+
}
|
|
779
853
|
}
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
854
|
+
}, _callee10, this);
|
|
855
|
+
}));
|
|
856
|
+
|
|
857
|
+
function LatestMarketplaceHash(_x11) {
|
|
858
|
+
return _LatestMarketplaceHash.apply(this, arguments);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
return LatestMarketplaceHash;
|
|
862
|
+
}()
|
|
783
863
|
}, {
|
|
784
864
|
key: "LoadMarketplace",
|
|
785
|
-
value: function
|
|
786
|
-
var
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
case 9:
|
|
828
|
-
marketplace = _context12.sent;
|
|
829
|
-
_context12.next = 12;
|
|
830
|
-
return _regeneratorRuntime.awrap(Promise.all(marketplace.items.map(function _callee2(item, index) {
|
|
831
|
-
return _regeneratorRuntime.async(function _callee2$(_context11) {
|
|
832
|
-
while (1) {
|
|
833
|
-
switch (_context11.prev = _context11.next) {
|
|
834
|
-
case 0:
|
|
835
|
-
if (!item.requires_permissions) {
|
|
836
|
-
_context11.next = 14;
|
|
837
|
-
break;
|
|
838
|
-
}
|
|
865
|
+
value: function () {
|
|
866
|
+
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(marketplaceParams) {
|
|
867
|
+
var _this4 = this;
|
|
868
|
+
|
|
869
|
+
var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
|
|
870
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
871
|
+
while (1) {
|
|
872
|
+
switch (_context12.prev = _context12.next) {
|
|
873
|
+
case 0:
|
|
874
|
+
marketplaceInfo = this.MarketplaceInfo({
|
|
875
|
+
marketplaceParams: marketplaceParams
|
|
876
|
+
});
|
|
877
|
+
marketplaceId = marketplaceInfo.marketplaceId;
|
|
878
|
+
_context12.next = 4;
|
|
879
|
+
return this.LatestMarketplaceHash({
|
|
880
|
+
tenantSlug: marketplaceInfo.tenantSlug,
|
|
881
|
+
marketplaceSlug: marketplaceInfo.marketplaceSlug
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
case 4:
|
|
885
|
+
marketplaceHash = _context12.sent;
|
|
886
|
+
|
|
887
|
+
if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
|
|
888
|
+
delete this.cachedMarketplaces[marketplaceId];
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (this.cachedMarketplaces[marketplaceId]) {
|
|
892
|
+
_context12.next = 19;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
_context12.next = 9;
|
|
897
|
+
return this.client.ContentObjectMetadata({
|
|
898
|
+
versionHash: marketplaceHash,
|
|
899
|
+
metadataSubtree: "public/asset_metadata/info",
|
|
900
|
+
linkDepthLimit: 2,
|
|
901
|
+
resolveLinks: true,
|
|
902
|
+
resolveIgnoreErrors: true,
|
|
903
|
+
resolveIncludeSource: true,
|
|
904
|
+
produceLinkUrls: true,
|
|
905
|
+
authorizationToken: this.publicStaticToken
|
|
906
|
+
});
|
|
839
907
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
908
|
+
case 9:
|
|
909
|
+
marketplace = _context12.sent;
|
|
910
|
+
_context12.next = 12;
|
|
911
|
+
return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
|
|
912
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(item, index) {
|
|
913
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
914
|
+
while (1) {
|
|
915
|
+
switch (_context11.prev = _context11.next) {
|
|
916
|
+
case 0:
|
|
917
|
+
if (!item.requires_permissions) {
|
|
918
|
+
_context11.next = 14;
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
if (_this4.loggedIn) {
|
|
923
|
+
_context11.next = 5;
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
item.authorized = false;
|
|
928
|
+
_context11.next = 14;
|
|
929
|
+
break;
|
|
930
|
+
|
|
931
|
+
case 5:
|
|
932
|
+
_context11.prev = 5;
|
|
933
|
+
_context11.next = 8;
|
|
934
|
+
return _this4.client.ContentObjectMetadata({
|
|
935
|
+
versionHash: LinkTargetHash(item.nft_template),
|
|
936
|
+
metadataSubtree: "permissioned"
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
case 8:
|
|
940
|
+
item.authorized = true;
|
|
941
|
+
_context11.next = 14;
|
|
942
|
+
break;
|
|
943
|
+
|
|
944
|
+
case 11:
|
|
945
|
+
_context11.prev = 11;
|
|
946
|
+
_context11.t0 = _context11["catch"](5);
|
|
947
|
+
item.authorized = false;
|
|
948
|
+
|
|
949
|
+
case 14:
|
|
950
|
+
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
951
|
+
item.itemIndex = index;
|
|
952
|
+
return _context11.abrupt("return", item);
|
|
953
|
+
|
|
954
|
+
case 17:
|
|
955
|
+
case "end":
|
|
956
|
+
return _context11.stop();
|
|
843
957
|
}
|
|
958
|
+
}
|
|
959
|
+
}, _callee11, null, [[5, 11]]);
|
|
960
|
+
}));
|
|
844
961
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
case 8:
|
|
858
|
-
item.authorized = true;
|
|
859
|
-
_context11.next = 14;
|
|
860
|
-
break;
|
|
861
|
-
|
|
862
|
-
case 11:
|
|
863
|
-
_context11.prev = 11;
|
|
864
|
-
_context11.t0 = _context11["catch"](5);
|
|
865
|
-
item.authorized = false;
|
|
866
|
-
|
|
867
|
-
case 14:
|
|
868
|
-
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
869
|
-
item.itemIndex = index;
|
|
870
|
-
return _context11.abrupt("return", item);
|
|
871
|
-
|
|
872
|
-
case 17:
|
|
873
|
-
case "end":
|
|
874
|
-
return _context11.stop();
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
}, null, null, [[5, 11]]);
|
|
878
|
-
})));
|
|
879
|
-
|
|
880
|
-
case 12:
|
|
881
|
-
marketplace.items = _context12.sent;
|
|
882
|
-
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
883
|
-
return _objectSpread({}, collection, {
|
|
884
|
-
collectionIndex: collectionIndex
|
|
962
|
+
return function (_x13, _x14) {
|
|
963
|
+
return _ref11.apply(this, arguments);
|
|
964
|
+
};
|
|
965
|
+
}()));
|
|
966
|
+
|
|
967
|
+
case 12:
|
|
968
|
+
marketplace.items = _context12.sent;
|
|
969
|
+
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
970
|
+
return _objectSpread(_objectSpread({}, collection), {}, {
|
|
971
|
+
collectionIndex: collectionIndex
|
|
972
|
+
});
|
|
885
973
|
});
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
974
|
+
marketplace.retrievedAt = Date.now();
|
|
975
|
+
marketplace.marketplaceId = marketplaceId;
|
|
976
|
+
marketplace.versionHash = marketplaceHash; // Generate embed URLs for pack opening animations
|
|
977
|
+
|
|
978
|
+
["purchase_animation", "purchase_animation__mobile", "reveal_animation", "reveal_animation_mobile"].forEach(function (key) {
|
|
979
|
+
try {
|
|
980
|
+
if (marketplace.storefront[key]) {
|
|
981
|
+
var embedUrl = new URL("https://embed.v3.contentfabric.io");
|
|
982
|
+
var targetHash = LinkTargetHash(marketplace.storefront[key]);
|
|
983
|
+
embedUrl.searchParams.set("p", "");
|
|
984
|
+
embedUrl.searchParams.set("net", _this4.network === "main" ? "main" : "demo");
|
|
985
|
+
embedUrl.searchParams.set("ath", (_this4.__authorization || {}).authToken || _this4.publicStaticToken);
|
|
986
|
+
embedUrl.searchParams.set("vid", targetHash);
|
|
987
|
+
embedUrl.searchParams.set("ap", "");
|
|
988
|
+
|
|
989
|
+
if (!key.startsWith("reveal")) {
|
|
990
|
+
embedUrl.searchParams.set("m", "");
|
|
991
|
+
embedUrl.searchParams.set("lp", "");
|
|
992
|
+
}
|
|
906
993
|
|
|
907
|
-
|
|
908
|
-
|
|
994
|
+
marketplace.storefront["".concat(key, "_embed_url")] = embedUrl.toString();
|
|
995
|
+
} // eslint-disable-next-line no-empty
|
|
909
996
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
997
|
+
} catch (error) {}
|
|
998
|
+
});
|
|
999
|
+
this.cachedMarketplaces[marketplaceId] = marketplace;
|
|
913
1000
|
|
|
914
|
-
|
|
915
|
-
|
|
1001
|
+
case 19:
|
|
1002
|
+
return _context12.abrupt("return", this.cachedMarketplaces[marketplaceId]);
|
|
916
1003
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1004
|
+
case 20:
|
|
1005
|
+
case "end":
|
|
1006
|
+
return _context12.stop();
|
|
1007
|
+
}
|
|
920
1008
|
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
1009
|
+
}, _callee12, this);
|
|
1010
|
+
}));
|
|
1011
|
+
|
|
1012
|
+
function LoadMarketplace(_x12) {
|
|
1013
|
+
return _LoadMarketplace.apply(this, arguments);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
return LoadMarketplace;
|
|
1017
|
+
}()
|
|
924
1018
|
}, {
|
|
925
1019
|
key: "FilteredQuery",
|
|
926
|
-
value: function
|
|
927
|
-
var
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
if (!marketplaceParams) {
|
|
976
|
-
_context13.next = 11;
|
|
977
|
-
break;
|
|
978
|
-
}
|
|
1020
|
+
value: function () {
|
|
1021
|
+
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
1022
|
+
var _ref12,
|
|
1023
|
+
_ref12$mode,
|
|
1024
|
+
mode,
|
|
1025
|
+
_ref12$sortBy,
|
|
1026
|
+
sortBy,
|
|
1027
|
+
_ref12$sortDesc,
|
|
1028
|
+
sortDesc,
|
|
1029
|
+
filter,
|
|
1030
|
+
editionFilter,
|
|
1031
|
+
attributeFilters,
|
|
1032
|
+
contractAddress,
|
|
1033
|
+
tokenId,
|
|
1034
|
+
currency,
|
|
1035
|
+
marketplaceParams,
|
|
1036
|
+
tenantId,
|
|
1037
|
+
_ref12$collectionInde,
|
|
1038
|
+
collectionIndex,
|
|
1039
|
+
sellerAddress,
|
|
1040
|
+
_ref12$lastNDays,
|
|
1041
|
+
lastNDays,
|
|
1042
|
+
_ref12$start,
|
|
1043
|
+
start,
|
|
1044
|
+
_ref12$limit,
|
|
1045
|
+
limit,
|
|
1046
|
+
params,
|
|
1047
|
+
marketplaceInfo,
|
|
1048
|
+
marketplace,
|
|
1049
|
+
filters,
|
|
1050
|
+
collection,
|
|
1051
|
+
path,
|
|
1052
|
+
_ref14,
|
|
1053
|
+
contents,
|
|
1054
|
+
paging,
|
|
1055
|
+
_args13 = arguments;
|
|
1056
|
+
|
|
1057
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1058
|
+
while (1) {
|
|
1059
|
+
switch (_context13.prev = _context13.next) {
|
|
1060
|
+
case 0:
|
|
1061
|
+
_ref12 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, _ref12$mode = _ref12.mode, mode = _ref12$mode === void 0 ? "listings" : _ref12$mode, _ref12$sortBy = _ref12.sortBy, sortBy = _ref12$sortBy === void 0 ? "created" : _ref12$sortBy, _ref12$sortDesc = _ref12.sortDesc, sortDesc = _ref12$sortDesc === void 0 ? false : _ref12$sortDesc, filter = _ref12.filter, editionFilter = _ref12.editionFilter, attributeFilters = _ref12.attributeFilters, contractAddress = _ref12.contractAddress, tokenId = _ref12.tokenId, currency = _ref12.currency, marketplaceParams = _ref12.marketplaceParams, tenantId = _ref12.tenantId, _ref12$collectionInde = _ref12.collectionIndex, collectionIndex = _ref12$collectionInde === void 0 ? -1 : _ref12$collectionInde, sellerAddress = _ref12.sellerAddress, _ref12$lastNDays = _ref12.lastNDays, lastNDays = _ref12$lastNDays === void 0 ? -1 : _ref12$lastNDays, _ref12$start = _ref12.start, start = _ref12$start === void 0 ? 0 : _ref12$start, _ref12$limit = _ref12.limit, limit = _ref12$limit === void 0 ? 50 : _ref12$limit;
|
|
1062
|
+
collectionIndex = parseInt(collectionIndex);
|
|
1063
|
+
params = {
|
|
1064
|
+
sort_by: sortBy,
|
|
1065
|
+
sort_descending: sortDesc,
|
|
1066
|
+
start: start,
|
|
1067
|
+
limit: limit
|
|
1068
|
+
};
|
|
979
1069
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1070
|
+
if (!marketplaceParams) {
|
|
1071
|
+
_context13.next = 11;
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
984
1074
|
|
|
985
|
-
|
|
986
|
-
|
|
1075
|
+
_context13.next = 6;
|
|
1076
|
+
return this.MarketplaceInfo({
|
|
1077
|
+
marketplaceParams: marketplaceParams
|
|
1078
|
+
});
|
|
987
1079
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
1080
|
+
case 6:
|
|
1081
|
+
marketplaceInfo = _context13.sent;
|
|
992
1082
|
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1083
|
+
if (!(collectionIndex >= 0)) {
|
|
1084
|
+
_context13.next = 11;
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
997
1087
|
|
|
998
|
-
|
|
999
|
-
|
|
1088
|
+
_context13.next = 10;
|
|
1089
|
+
return this.Marketplace({
|
|
1090
|
+
marketplaceParams: marketplaceParams
|
|
1091
|
+
});
|
|
1000
1092
|
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
filters = [];
|
|
1093
|
+
case 10:
|
|
1094
|
+
marketplace = _context13.sent;
|
|
1004
1095
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1096
|
+
case 11:
|
|
1097
|
+
_context13.prev = 11;
|
|
1098
|
+
filters = [];
|
|
1008
1099
|
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1100
|
+
if (sellerAddress) {
|
|
1101
|
+
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
if (!(marketplace && collectionIndex >= 0)) {
|
|
1105
|
+
_context13.next = 25;
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
collection = marketplace.collections[collectionIndex];
|
|
1110
|
+
collection.items.forEach(function (sku) {
|
|
1111
|
+
if (!sku) {
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
var item = marketplace.items.find(function (item) {
|
|
1116
|
+
return item.sku === sku;
|
|
1117
|
+
});
|
|
1118
|
+
|
|
1119
|
+
if (!item) {
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
var address = Utils.SafeTraverse(item, "nft_template", "nft", "address");
|
|
1124
|
+
|
|
1125
|
+
if (address) {
|
|
1126
|
+
filters.push("".concat(mode === "owned" ? "contract_addr" : "contract", ":eq:").concat(Utils.FormatAddress(address)));
|
|
1127
|
+
}
|
|
1128
|
+
}); // No valid items, so there must not be anything relevant in the collection
|
|
1129
|
+
|
|
1130
|
+
if (!(filters.length === 0)) {
|
|
1131
|
+
_context13.next = 23;
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1013
1134
|
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
return;
|
|
1135
|
+
if (!mode.includes("stats")) {
|
|
1136
|
+
_context13.next = 22;
|
|
1137
|
+
break;
|
|
1018
1138
|
}
|
|
1019
1139
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1140
|
+
return _context13.abrupt("return", {});
|
|
1141
|
+
|
|
1142
|
+
case 22:
|
|
1143
|
+
return _context13.abrupt("return", {
|
|
1144
|
+
paging: {
|
|
1145
|
+
start: params.start,
|
|
1146
|
+
limit: params.limit,
|
|
1147
|
+
total: 0,
|
|
1148
|
+
more: false
|
|
1149
|
+
},
|
|
1150
|
+
results: []
|
|
1022
1151
|
});
|
|
1023
1152
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1153
|
+
case 23:
|
|
1154
|
+
_context13.next = 26;
|
|
1155
|
+
break;
|
|
1156
|
+
|
|
1157
|
+
case 25:
|
|
1158
|
+
if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1159
|
+
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1026
1160
|
}
|
|
1027
1161
|
|
|
1028
|
-
|
|
1162
|
+
case 26:
|
|
1163
|
+
if (contractAddress) {
|
|
1164
|
+
if (mode === "owned") {
|
|
1165
|
+
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1166
|
+
} else {
|
|
1167
|
+
filters.push("contract:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1168
|
+
}
|
|
1029
1169
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1170
|
+
if (tokenId) {
|
|
1171
|
+
filters.push("token:eq:".concat(tokenId));
|
|
1172
|
+
}
|
|
1173
|
+
} else if (filter) {
|
|
1174
|
+
if (mode.includes("listing")) {
|
|
1175
|
+
filters.push("nft/display_name:eq:".concat(filter));
|
|
1176
|
+
} else if (mode === "owned") {
|
|
1177
|
+
filters.push("meta:@>:{\"display_name\":\"".concat(filter, "\"}"));
|
|
1178
|
+
params.exact = false;
|
|
1179
|
+
} else {
|
|
1180
|
+
filters.push("name:eq:".concat(filter));
|
|
1181
|
+
}
|
|
1032
1182
|
}
|
|
1033
|
-
}); // No valid items, so there must not be anything relevant in the collection
|
|
1034
1183
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1184
|
+
if (editionFilter) {
|
|
1185
|
+
if (mode.includes("listing")) {
|
|
1186
|
+
filters.push("nft/edition_name:eq:".concat(editionFilter));
|
|
1187
|
+
} else if (mode === "owned") {
|
|
1188
|
+
filters.push("meta:@>:{\"edition_name\":\"".concat(editionFilter, "\"}"));
|
|
1189
|
+
params.exact = false;
|
|
1190
|
+
} else {
|
|
1191
|
+
filters.push("edition:eq:".concat(editionFilter));
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1039
1194
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
limit: params.limit,
|
|
1052
|
-
total: 0,
|
|
1053
|
-
more: false
|
|
1054
|
-
},
|
|
1055
|
-
results: []
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
|
-
case 23:
|
|
1059
|
-
_context13.next = 26;
|
|
1060
|
-
break;
|
|
1061
|
-
|
|
1062
|
-
case 25:
|
|
1063
|
-
if (mode !== "owned" && marketplaceInfo || tenantId) {
|
|
1064
|
-
filters.push("tenant:eq:".concat(marketplaceInfo ? marketplaceInfo.tenantId : tenantId));
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
case 26:
|
|
1068
|
-
if (contractAddress) {
|
|
1069
|
-
if (mode === "owned") {
|
|
1070
|
-
filters.push("contract_addr:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1071
|
-
} else {
|
|
1072
|
-
filters.push("contract:eq:".concat(Utils.FormatAddress(contractAddress)));
|
|
1195
|
+
if (attributeFilters) {
|
|
1196
|
+
attributeFilters.map(function (_ref13) {
|
|
1197
|
+
var name = _ref13.name,
|
|
1198
|
+
value = _ref13.value;
|
|
1199
|
+
|
|
1200
|
+
if (!name || !value) {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
filters.push("nft/attributes/".concat(name, ":eq:").concat(value));
|
|
1205
|
+
});
|
|
1073
1206
|
}
|
|
1074
1207
|
|
|
1075
|
-
if (
|
|
1076
|
-
filters.push("
|
|
1208
|
+
if (currency) {
|
|
1209
|
+
filters.push("link_type:eq:sol");
|
|
1077
1210
|
}
|
|
1078
|
-
|
|
1079
|
-
if (
|
|
1080
|
-
filters.push("
|
|
1081
|
-
} else if (mode === "owned") {
|
|
1082
|
-
filters.push("meta:@>:{\"display_name\":\"".concat(filter, "\"}"));
|
|
1083
|
-
params.exact = false;
|
|
1084
|
-
} else {
|
|
1085
|
-
filters.push("name:eq:".concat(filter));
|
|
1211
|
+
|
|
1212
|
+
if (lastNDays && lastNDays > 0) {
|
|
1213
|
+
filters.push("created:gt:".concat((Date.now() / 1000 - lastNDays * 24 * 60 * 60).toFixed(0)));
|
|
1086
1214
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1215
|
+
|
|
1216
|
+
_context13.t0 = mode;
|
|
1217
|
+
_context13.next = _context13.t0 === "owned" ? 34 : _context13.t0 === "listings" ? 37 : _context13.t0 === "sales" ? 39 : _context13.t0 === "listing-stats" ? 42 : _context13.t0 === "sales-stats" ? 44 : 46;
|
|
1218
|
+
break;
|
|
1219
|
+
|
|
1220
|
+
case 34:
|
|
1221
|
+
path = UrlJoin("as", "wlt", "nfts");
|
|
1222
|
+
|
|
1223
|
+
if (marketplaceInfo) {
|
|
1224
|
+
path = UrlJoin("as", "wlt", "nfts", marketplaceInfo.tenantId);
|
|
1097
1225
|
}
|
|
1098
|
-
}
|
|
1099
1226
|
|
|
1100
|
-
|
|
1101
|
-
attributeFilters.map(function (_ref10) {
|
|
1102
|
-
var name = _ref10.name,
|
|
1103
|
-
value = _ref10.value;
|
|
1227
|
+
return _context13.abrupt("break", 46);
|
|
1104
1228
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1229
|
+
case 37:
|
|
1230
|
+
path = UrlJoin("as", "mkt", "f");
|
|
1231
|
+
return _context13.abrupt("break", 46);
|
|
1108
1232
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1233
|
+
case 39:
|
|
1234
|
+
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1235
|
+
filters.push("action:eq:SOLD");
|
|
1236
|
+
return _context13.abrupt("break", 46);
|
|
1237
|
+
|
|
1238
|
+
case 42:
|
|
1239
|
+
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1240
|
+
return _context13.abrupt("break", 46);
|
|
1112
1241
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1242
|
+
case 44:
|
|
1243
|
+
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1244
|
+
return _context13.abrupt("break", 46);
|
|
1116
1245
|
|
|
1117
|
-
|
|
1118
|
-
filters.
|
|
1119
|
-
|
|
1246
|
+
case 46:
|
|
1247
|
+
if (filters.length > 0) {
|
|
1248
|
+
params.filter = filters;
|
|
1249
|
+
}
|
|
1120
1250
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1251
|
+
if (!mode.includes("stats")) {
|
|
1252
|
+
_context13.next = 51;
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1124
1255
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1256
|
+
_context13.next = 50;
|
|
1257
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1258
|
+
path: path,
|
|
1259
|
+
method: "GET",
|
|
1260
|
+
queryParams: params
|
|
1261
|
+
}));
|
|
1262
|
+
|
|
1263
|
+
case 50:
|
|
1264
|
+
return _context13.abrupt("return", _context13.sent);
|
|
1265
|
+
|
|
1266
|
+
case 51:
|
|
1267
|
+
_context13.t2 = Utils;
|
|
1268
|
+
_context13.next = 54;
|
|
1269
|
+
return this.client.authClient.MakeAuthServiceRequest({
|
|
1270
|
+
path: path,
|
|
1271
|
+
method: "GET",
|
|
1272
|
+
queryParams: params,
|
|
1273
|
+
headers: mode === "owned" ? {
|
|
1274
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1275
|
+
} : {}
|
|
1276
|
+
});
|
|
1127
1277
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1278
|
+
case 54:
|
|
1279
|
+
_context13.t3 = _context13.sent;
|
|
1280
|
+
_context13.next = 57;
|
|
1281
|
+
return _context13.t2.ResponseToJson.call(_context13.t2, _context13.t3);
|
|
1131
1282
|
|
|
1132
|
-
|
|
1283
|
+
case 57:
|
|
1284
|
+
_context13.t1 = _context13.sent;
|
|
1133
1285
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1286
|
+
if (_context13.t1) {
|
|
1287
|
+
_context13.next = 60;
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1137
1290
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1291
|
+
_context13.t1 = [];
|
|
1292
|
+
|
|
1293
|
+
case 60:
|
|
1294
|
+
_ref14 = _context13.t1;
|
|
1295
|
+
contents = _ref14.contents;
|
|
1296
|
+
paging = _ref14.paging;
|
|
1297
|
+
return _context13.abrupt("return", {
|
|
1298
|
+
paging: {
|
|
1299
|
+
start: params.start,
|
|
1300
|
+
limit: params.limit,
|
|
1301
|
+
total: paging.total,
|
|
1302
|
+
more: paging.total > start + limit
|
|
1303
|
+
},
|
|
1304
|
+
results: (contents || []).map(function (item) {
|
|
1305
|
+
return ["owned", "listings"].includes(mode) ? FormatNFT(item) : item;
|
|
1306
|
+
})
|
|
1307
|
+
});
|
|
1142
1308
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1309
|
+
case 66:
|
|
1310
|
+
_context13.prev = 66;
|
|
1311
|
+
_context13.t4 = _context13["catch"](11);
|
|
1146
1312
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1313
|
+
if (!(_context13.t4.status && _context13.t4.status.toString() === "404")) {
|
|
1314
|
+
_context13.next = 70;
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1150
1317
|
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1318
|
+
return _context13.abrupt("return", {
|
|
1319
|
+
paging: {
|
|
1320
|
+
start: params.start,
|
|
1321
|
+
limit: params.limit,
|
|
1322
|
+
total: 0,
|
|
1323
|
+
more: false
|
|
1324
|
+
},
|
|
1325
|
+
results: []
|
|
1326
|
+
});
|
|
1155
1327
|
|
|
1156
|
-
|
|
1157
|
-
_context13.
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
path: path,
|
|
1164
|
-
method: "GET",
|
|
1165
|
-
queryParams: params
|
|
1166
|
-
})));
|
|
1167
|
-
|
|
1168
|
-
case 50:
|
|
1169
|
-
return _context13.abrupt("return", _context13.sent);
|
|
1170
|
-
|
|
1171
|
-
case 51:
|
|
1172
|
-
_context13.t2 = _regeneratorRuntime;
|
|
1173
|
-
_context13.t3 = Utils;
|
|
1174
|
-
_context13.next = 55;
|
|
1175
|
-
return _regeneratorRuntime.awrap(this.client.authClient.MakeAuthServiceRequest({
|
|
1176
|
-
path: path,
|
|
1177
|
-
method: "GET",
|
|
1178
|
-
queryParams: params,
|
|
1179
|
-
headers: mode === "owned" ? {
|
|
1180
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1181
|
-
} : {}
|
|
1182
|
-
}));
|
|
1183
|
-
|
|
1184
|
-
case 55:
|
|
1185
|
-
_context13.t4 = _context13.sent;
|
|
1186
|
-
_context13.t5 = _context13.t3.ResponseToJson.call(_context13.t3, _context13.t4);
|
|
1187
|
-
_context13.next = 59;
|
|
1188
|
-
return _context13.t2.awrap.call(_context13.t2, _context13.t5);
|
|
1189
|
-
|
|
1190
|
-
case 59:
|
|
1191
|
-
_context13.t1 = _context13.sent;
|
|
1192
|
-
|
|
1193
|
-
if (_context13.t1) {
|
|
1194
|
-
_context13.next = 62;
|
|
1195
|
-
break;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
_context13.t1 = [];
|
|
1199
|
-
|
|
1200
|
-
case 62:
|
|
1201
|
-
_ref11 = _context13.t1;
|
|
1202
|
-
contents = _ref11.contents;
|
|
1203
|
-
paging = _ref11.paging;
|
|
1204
|
-
return _context13.abrupt("return", {
|
|
1205
|
-
paging: {
|
|
1206
|
-
start: params.start,
|
|
1207
|
-
limit: params.limit,
|
|
1208
|
-
total: paging.total,
|
|
1209
|
-
more: paging.total > start + limit
|
|
1210
|
-
},
|
|
1211
|
-
results: (contents || []).map(function (item) {
|
|
1212
|
-
return ["owned", "listings"].includes(mode) ? FormatNFT(item) : item;
|
|
1213
|
-
})
|
|
1214
|
-
});
|
|
1215
|
-
|
|
1216
|
-
case 68:
|
|
1217
|
-
_context13.prev = 68;
|
|
1218
|
-
_context13.t6 = _context13["catch"](11);
|
|
1219
|
-
|
|
1220
|
-
if (!(_context13.t6.status && _context13.t6.status.toString() === "404")) {
|
|
1221
|
-
_context13.next = 72;
|
|
1222
|
-
break;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
return _context13.abrupt("return", {
|
|
1226
|
-
paging: {
|
|
1227
|
-
start: params.start,
|
|
1228
|
-
limit: params.limit,
|
|
1229
|
-
total: 0,
|
|
1230
|
-
more: false
|
|
1231
|
-
},
|
|
1232
|
-
results: []
|
|
1233
|
-
});
|
|
1234
|
-
|
|
1235
|
-
case 72:
|
|
1236
|
-
throw _context13.t6;
|
|
1237
|
-
|
|
1238
|
-
case 73:
|
|
1239
|
-
case "end":
|
|
1240
|
-
return _context13.stop();
|
|
1328
|
+
case 70:
|
|
1329
|
+
throw _context13.t4;
|
|
1330
|
+
|
|
1331
|
+
case 71:
|
|
1332
|
+
case "end":
|
|
1333
|
+
return _context13.stop();
|
|
1334
|
+
}
|
|
1241
1335
|
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1336
|
+
}, _callee13, this, [[11, 66]]);
|
|
1337
|
+
}));
|
|
1338
|
+
|
|
1339
|
+
function FilteredQuery() {
|
|
1340
|
+
return _FilteredQuery.apply(this, arguments);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
return FilteredQuery;
|
|
1344
|
+
}()
|
|
1245
1345
|
}, {
|
|
1246
1346
|
key: "MintingStatus",
|
|
1247
|
-
value: function
|
|
1248
|
-
var
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
_context14.next = 4;
|
|
1261
|
-
return _regeneratorRuntime.awrap(this.MarketplaceInfo({
|
|
1262
|
-
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1263
|
-
}));
|
|
1264
|
-
|
|
1265
|
-
case 4:
|
|
1266
|
-
marketplaceInfo = _context14.sent;
|
|
1267
|
-
tenantId = marketplaceInfo.tenantId;
|
|
1268
|
-
|
|
1269
|
-
case 6:
|
|
1270
|
-
_context14.prev = 6;
|
|
1271
|
-
_context14.next = 9;
|
|
1272
|
-
return _regeneratorRuntime.awrap(Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1273
|
-
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1274
|
-
method: "GET",
|
|
1275
|
-
headers: {
|
|
1276
|
-
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1347
|
+
value: function () {
|
|
1348
|
+
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref15) {
|
|
1349
|
+
var marketplaceParams, tenantId, marketplaceInfo, response;
|
|
1350
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
1351
|
+
while (1) {
|
|
1352
|
+
switch (_context14.prev = _context14.next) {
|
|
1353
|
+
case 0:
|
|
1354
|
+
marketplaceParams = _ref15.marketplaceParams, tenantId = _ref15.tenantId;
|
|
1355
|
+
|
|
1356
|
+
if (tenantId) {
|
|
1357
|
+
_context14.next = 6;
|
|
1358
|
+
break;
|
|
1277
1359
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1360
|
+
|
|
1361
|
+
_context14.next = 4;
|
|
1362
|
+
return this.MarketplaceInfo({
|
|
1363
|
+
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
case 4:
|
|
1367
|
+
marketplaceInfo = _context14.sent;
|
|
1368
|
+
tenantId = marketplaceInfo.tenantId;
|
|
1369
|
+
|
|
1370
|
+
case 6:
|
|
1371
|
+
_context14.prev = 6;
|
|
1372
|
+
_context14.next = 9;
|
|
1373
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1374
|
+
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1375
|
+
method: "GET",
|
|
1376
|
+
headers: {
|
|
1377
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1378
|
+
}
|
|
1379
|
+
}));
|
|
1380
|
+
|
|
1381
|
+
case 9:
|
|
1382
|
+
response = _context14.sent;
|
|
1383
|
+
return _context14.abrupt("return", response.map(function (status) {
|
|
1384
|
+
var _status$op$split = status.op.split(":"),
|
|
1385
|
+
_status$op$split2 = _slicedToArray(_status$op$split, 3),
|
|
1386
|
+
op = _status$op$split2[0],
|
|
1387
|
+
address = _status$op$split2[1],
|
|
1388
|
+
id = _status$op$split2[2];
|
|
1389
|
+
|
|
1390
|
+
address = address.startsWith("0x") ? Utils.FormatAddress(address) : address;
|
|
1391
|
+
var confirmationId, tokenId;
|
|
1392
|
+
|
|
1393
|
+
if (op === "nft-buy") {
|
|
1394
|
+
confirmationId = id;
|
|
1395
|
+
} else if (op === "nft-claim") {
|
|
1396
|
+
confirmationId = id;
|
|
1397
|
+
status.marketplaceId = address;
|
|
1398
|
+
|
|
1399
|
+
if (status.extra && status.extra["0"]) {
|
|
1400
|
+
address = status.extra.token_addr;
|
|
1401
|
+
tokenId = status.extra.token_id_str;
|
|
1402
|
+
}
|
|
1403
|
+
} else if (op === "nft-redeem") {
|
|
1404
|
+
confirmationId = status.op.split(":").slice(-1)[0];
|
|
1405
|
+
} else {
|
|
1406
|
+
tokenId = id;
|
|
1301
1407
|
}
|
|
1302
|
-
} else if (op === "nft-redeem") {
|
|
1303
|
-
confirmationId = status.op.split(":").slice(-1)[0];
|
|
1304
|
-
} else {
|
|
1305
|
-
tokenId = id;
|
|
1306
|
-
}
|
|
1307
1408
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1409
|
+
if (op === "nft-transfer") {
|
|
1410
|
+
confirmationId = status.extra && status.extra.trans_id;
|
|
1411
|
+
}
|
|
1311
1412
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1413
|
+
return _objectSpread(_objectSpread({}, status), {}, {
|
|
1414
|
+
timestamp: new Date(status.ts),
|
|
1415
|
+
state: status.state && _typeof(status.state) === "object" ? Object.values(status.state) : status.state,
|
|
1416
|
+
extra: status.extra && _typeof(status.extra) === "object" ? Object.values(status.extra) : status.extra,
|
|
1417
|
+
confirmationId: confirmationId,
|
|
1418
|
+
op: op,
|
|
1419
|
+
address: address,
|
|
1420
|
+
tokenId: tokenId
|
|
1421
|
+
});
|
|
1422
|
+
}).sort(function (a, b) {
|
|
1423
|
+
return a.ts < b.ts ? 1 : -1;
|
|
1424
|
+
}));
|
|
1425
|
+
|
|
1426
|
+
case 13:
|
|
1427
|
+
_context14.prev = 13;
|
|
1428
|
+
_context14.t0 = _context14["catch"](6);
|
|
1429
|
+
this.Log("Failed to retrieve minting status", true);
|
|
1430
|
+
this.Log(_context14.t0);
|
|
1431
|
+
return _context14.abrupt("return", []);
|
|
1432
|
+
|
|
1433
|
+
case 18:
|
|
1434
|
+
case "end":
|
|
1435
|
+
return _context14.stop();
|
|
1436
|
+
}
|
|
1335
1437
|
}
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1438
|
+
}, _callee14, this, [[6, 13]]);
|
|
1439
|
+
}));
|
|
1440
|
+
|
|
1441
|
+
function MintingStatus(_x15) {
|
|
1442
|
+
return _MintingStatus.apply(this, arguments);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
return MintingStatus;
|
|
1446
|
+
}()
|
|
1339
1447
|
}], [{
|
|
1340
1448
|
key: "Initialize",
|
|
1341
|
-
value: function
|
|
1342
|
-
var
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1449
|
+
value: function () {
|
|
1450
|
+
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref16) {
|
|
1451
|
+
var _ref16$network, network, _ref16$mode, mode, marketplaceParams, _ref16$storeAuthToken, storeAuthToken, _ref17, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, client, walletClient, url, savedToken;
|
|
1452
|
+
|
|
1453
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
1454
|
+
while (1) {
|
|
1455
|
+
switch (_context15.prev = _context15.next) {
|
|
1456
|
+
case 0:
|
|
1457
|
+
_ref16$network = _ref16.network, network = _ref16$network === void 0 ? "main" : _ref16$network, _ref16$mode = _ref16.mode, mode = _ref16$mode === void 0 ? "production" : _ref16$mode, marketplaceParams = _ref16.marketplaceParams, _ref16$storeAuthToken = _ref16.storeAuthToken, storeAuthToken = _ref16$storeAuthToken === void 0 ? true : _ref16$storeAuthToken;
|
|
1458
|
+
_ref17 = marketplaceParams || {}, tenantSlug = _ref17.tenantSlug, marketplaceSlug = _ref17.marketplaceSlug, marketplaceId = _ref17.marketplaceId, marketplaceHash = _ref17.marketplaceHash;
|
|
1459
|
+
|
|
1460
|
+
if (Configuration[network]) {
|
|
1461
|
+
_context15.next = 6;
|
|
1462
|
+
break;
|
|
1463
|
+
}
|
|
1355
1464
|
|
|
1356
|
-
|
|
1465
|
+
throw Error("ElvWalletClient: Invalid network ".concat(network));
|
|
1357
1466
|
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1365
|
-
|
|
1366
|
-
case 8:
|
|
1367
|
-
_context15.next = 10;
|
|
1368
|
-
return _regeneratorRuntime.awrap(ElvClient.FromNetworkName({
|
|
1369
|
-
networkName: network,
|
|
1370
|
-
assumeV3: true
|
|
1371
|
-
}));
|
|
1372
|
-
|
|
1373
|
-
case 10:
|
|
1374
|
-
client = _context15.sent;
|
|
1375
|
-
walletClient = new ElvWalletClient({
|
|
1376
|
-
client: client,
|
|
1377
|
-
network: network,
|
|
1378
|
-
mode: mode,
|
|
1379
|
-
marketplaceInfo: {
|
|
1380
|
-
tenantSlug: tenantSlug,
|
|
1381
|
-
marketplaceSlug: marketplaceSlug,
|
|
1382
|
-
marketplaceId: marketplaceHash ? client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId,
|
|
1383
|
-
marketplaceHash: marketplaceHash
|
|
1384
|
-
},
|
|
1385
|
-
storeAuthToken: storeAuthToken
|
|
1386
|
-
});
|
|
1387
|
-
|
|
1388
|
-
if (!(window && window.location && window.location.href)) {
|
|
1389
|
-
_context15.next = 31;
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1467
|
+
case 6:
|
|
1468
|
+
if (Configuration[network][mode]) {
|
|
1469
|
+
_context15.next = 8;
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1392
1472
|
|
|
1393
|
-
|
|
1473
|
+
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1394
1474
|
|
|
1395
|
-
|
|
1396
|
-
_context15.next =
|
|
1397
|
-
|
|
1398
|
-
|
|
1475
|
+
case 8:
|
|
1476
|
+
_context15.next = 10;
|
|
1477
|
+
return ElvClient.FromNetworkName({
|
|
1478
|
+
networkName: network,
|
|
1479
|
+
assumeV3: true
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1482
|
+
case 10:
|
|
1483
|
+
client = _context15.sent;
|
|
1484
|
+
walletClient = new ElvWalletClient({
|
|
1485
|
+
client: client,
|
|
1486
|
+
network: network,
|
|
1487
|
+
mode: mode,
|
|
1488
|
+
marketplaceInfo: {
|
|
1489
|
+
tenantSlug: tenantSlug,
|
|
1490
|
+
marketplaceSlug: marketplaceSlug,
|
|
1491
|
+
marketplaceId: marketplaceHash ? client.utils.DecodeVersionHash(marketplaceHash).objectId : marketplaceId,
|
|
1492
|
+
marketplaceHash: marketplaceHash
|
|
1493
|
+
},
|
|
1494
|
+
storeAuthToken: storeAuthToken
|
|
1495
|
+
});
|
|
1399
1496
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1497
|
+
if (!(window && window.location && window.location.href)) {
|
|
1498
|
+
_context15.next = 31;
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1404
1501
|
|
|
1405
|
-
|
|
1406
|
-
url.searchParams["delete"]("elvToken");
|
|
1407
|
-
window.history.replaceState("", "", url);
|
|
1408
|
-
_context15.next = 31;
|
|
1409
|
-
break;
|
|
1502
|
+
url = new URL(window.location.href);
|
|
1410
1503
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1504
|
+
if (!url.searchParams.get("elvToken")) {
|
|
1505
|
+
_context15.next = 21;
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
_context15.next = 17;
|
|
1510
|
+
return walletClient.Authenticate({
|
|
1511
|
+
token: url.searchParams.get("elvToken")
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
case 17:
|
|
1515
|
+
url.searchParams["delete"]("elvToken");
|
|
1516
|
+
window.history.replaceState("", "", url);
|
|
1413
1517
|
_context15.next = 31;
|
|
1414
1518
|
break;
|
|
1415
|
-
}
|
|
1416
1519
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1520
|
+
case 21:
|
|
1521
|
+
if (!(storeAuthToken && typeof localStorage !== "undefined")) {
|
|
1522
|
+
_context15.next = 31;
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
_context15.prev = 22;
|
|
1527
|
+
// Load saved auth token
|
|
1528
|
+
savedToken = localStorage.getItem("__elv-token-".concat(network));
|
|
1529
|
+
|
|
1530
|
+
if (!savedToken) {
|
|
1531
|
+
_context15.next = 27;
|
|
1532
|
+
break;
|
|
1533
|
+
}
|
|
1420
1534
|
|
|
1421
|
-
if (!savedToken) {
|
|
1422
1535
|
_context15.next = 27;
|
|
1536
|
+
return walletClient.Authenticate({
|
|
1537
|
+
token: savedToken
|
|
1538
|
+
});
|
|
1539
|
+
|
|
1540
|
+
case 27:
|
|
1541
|
+
_context15.next = 31;
|
|
1423
1542
|
break;
|
|
1424
|
-
}
|
|
1425
1543
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
}));
|
|
1544
|
+
case 29:
|
|
1545
|
+
_context15.prev = 29;
|
|
1546
|
+
_context15.t0 = _context15["catch"](22);
|
|
1430
1547
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1548
|
+
case 31:
|
|
1549
|
+
_context15.next = 33;
|
|
1550
|
+
return walletClient.LoadAvailableMarketplaces();
|
|
1434
1551
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
_context15.t0 = _context15["catch"](22);
|
|
1552
|
+
case 33:
|
|
1553
|
+
return _context15.abrupt("return", walletClient);
|
|
1438
1554
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1555
|
+
case 34:
|
|
1556
|
+
case "end":
|
|
1557
|
+
return _context15.stop();
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}, _callee15, null, [[22, 29]]);
|
|
1561
|
+
}));
|
|
1442
1562
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1563
|
+
function Initialize(_x16) {
|
|
1564
|
+
return _Initialize.apply(this, arguments);
|
|
1565
|
+
}
|
|
1445
1566
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
return _context15.stop();
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}, null, null, [[22, 29]]);
|
|
1452
|
-
}
|
|
1567
|
+
return Initialize;
|
|
1568
|
+
}()
|
|
1453
1569
|
}]);
|
|
1454
1570
|
|
|
1455
1571
|
return ElvWalletClient;
|