@eluvio/elv-client-js 4.0.38 → 4.0.39
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/ElvWalletClient-min.js +3 -3
- package/dist/ElvWalletClient-node-min.js +9 -9
- package/dist/src/walletClient/ClientMethods.js +715 -568
- package/dist/src/walletClient/Configuration.js +1 -1
- package/dist/src/walletClient/Utils.js +3 -1
- package/dist/src/walletClient/index.js +515 -319
- package/package.json +1 -1
- package/src/walletClient/index.js +6 -2
|
@@ -264,41 +264,21 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
264
264
|
}
|
|
265
265
|
return PersonalSign;
|
|
266
266
|
}()
|
|
267
|
-
/**
|
|
268
|
-
* Direct the user to the Eluvio Media Wallet login page.
|
|
269
|
-
*
|
|
270
|
-
* For redirect login, the authorization token will be included in the URL parameters of the callbackUrl. Simply re-initialize the wallet client and it will authorize with this token,
|
|
271
|
-
* or you can retrieve the parameter (`elvToken`) yourself and use it in the <a href="#Authenticate">Authenticate</a> method.
|
|
272
|
-
*
|
|
273
|
-
* <b>NOTE:</b> The domain of the opening window (popup flow) or domain of the `callbackUrl` (redirect flow) MUST be allowed in the metadata of the specified marketplace.
|
|
274
|
-
*
|
|
275
|
-
* @methodGroup Login
|
|
276
|
-
* @namedParams
|
|
277
|
-
* @param {string=} method=redirect - How to present the login page.
|
|
278
|
-
* - `redirect` - Redirect to the wallet login page. Upon login, the page will be redirected back to the specified `redirectUrl` with the authorization token.
|
|
279
|
-
* - `popup` - Open the wallet login page in a new tab. Upon login, authorization information will be sent back to the client via message and the tab will be closed.
|
|
280
|
-
* @param {string=} provider - If logging in via a specific method, specify the provider and mode. Options: `oauth`, `metamask`
|
|
281
|
-
* @param {string=} mode - If logging in via a specific method, specify the mode. Options `login` (Log In), `create` (Sign Up)
|
|
282
|
-
* @param {string=} callbackUrl - If using the redirect flow, the URL to redirect back to after login.
|
|
283
|
-
* @param {Object=} marketplaceParams - Parameters of a marketplace to associate the login with. If not specified, the marketplace parameters used upon client initialization will be used. A marketplace is required when using the redirect flow.
|
|
284
|
-
* @param {boolean=} clearLogin=false - If specified, the user will be prompted to log in anew even if they are already logged in on the Eluvio Media Wallet app
|
|
285
|
-
*
|
|
286
|
-
* @throws - If using the popup flow and the user closes the popup, this method will throw an error.
|
|
287
|
-
*/
|
|
288
267
|
}, {
|
|
289
|
-
key: "
|
|
268
|
+
key: "LogInURL",
|
|
290
269
|
value: function () {
|
|
291
|
-
var
|
|
292
|
-
var
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
270
|
+
var _LogInURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
|
|
271
|
+
var _ref4$mode, mode, provider, marketplaceParams, clearLogin, loginUrl;
|
|
272
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
273
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
296
274
|
case 0:
|
|
297
|
-
_ref4$
|
|
275
|
+
_ref4$mode = _ref4.mode, mode = _ref4$mode === void 0 ? "login" : _ref4$mode, provider = _ref4.provider, marketplaceParams = _ref4.marketplaceParams, clearLogin = _ref4.clearLogin;
|
|
298
276
|
loginUrl = new URL(this.appUrl);
|
|
299
277
|
loginUrl.hash = "/login";
|
|
300
|
-
loginUrl.searchParams.set("origin", window.location.origin);
|
|
301
278
|
loginUrl.searchParams.set("action", "login");
|
|
279
|
+
if (typeof window !== "undefined") {
|
|
280
|
+
loginUrl.searchParams.set("origin", window.location.origin);
|
|
281
|
+
}
|
|
302
282
|
if (provider) {
|
|
303
283
|
loginUrl.searchParams.set("provider", provider);
|
|
304
284
|
}
|
|
@@ -306,18 +286,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
306
286
|
loginUrl.searchParams.set("mode", mode);
|
|
307
287
|
}
|
|
308
288
|
if (!marketplaceParams) {
|
|
309
|
-
|
|
289
|
+
_context4.next = 15;
|
|
310
290
|
break;
|
|
311
291
|
}
|
|
312
|
-
|
|
313
|
-
|
|
292
|
+
_context4.t0 = loginUrl.searchParams;
|
|
293
|
+
_context4.next = 11;
|
|
314
294
|
return this.MarketplaceInfo({
|
|
315
295
|
marketplaceParams: marketplaceParams
|
|
316
296
|
});
|
|
317
297
|
case 11:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
298
|
+
_context4.t1 = _context4.sent.marketplaceHash;
|
|
299
|
+
_context4.t0.set.call(_context4.t0, "mid", _context4.t1);
|
|
300
|
+
_context4.next = 16;
|
|
321
301
|
break;
|
|
322
302
|
case 15:
|
|
323
303
|
if ((this.selectedMarketplaceInfo || {}).marketplaceHash) {
|
|
@@ -327,26 +307,78 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
327
307
|
if (clearLogin) {
|
|
328
308
|
loginUrl.searchParams.set("clear", "");
|
|
329
309
|
}
|
|
310
|
+
return _context4.abrupt("return", loginUrl);
|
|
311
|
+
case 18:
|
|
312
|
+
case "end":
|
|
313
|
+
return _context4.stop();
|
|
314
|
+
}
|
|
315
|
+
}, _callee4, this);
|
|
316
|
+
}));
|
|
317
|
+
function LogInURL(_x6) {
|
|
318
|
+
return _LogInURL.apply(this, arguments);
|
|
319
|
+
}
|
|
320
|
+
return LogInURL;
|
|
321
|
+
}()
|
|
322
|
+
/**
|
|
323
|
+
* Direct the user to the Eluvio Media Wallet login page.
|
|
324
|
+
*
|
|
325
|
+
* For redirect login, the authorization token will be included in the URL parameters of the callbackUrl. Simply re-initialize the wallet client and it will authorize with this token,
|
|
326
|
+
* or you can retrieve the parameter (`elvToken`) yourself and use it in the <a href="#Authenticate">Authenticate</a> method.
|
|
327
|
+
*
|
|
328
|
+
* <b>NOTE:</b> The domain of the opening window (popup flow) or domain of the `callbackUrl` (redirect flow) MUST be allowed in the metadata of the specified marketplace.
|
|
329
|
+
*
|
|
330
|
+
* @methodGroup Login
|
|
331
|
+
* @namedParams
|
|
332
|
+
* @param {string=} method=redirect - How to present the login page.
|
|
333
|
+
* - `redirect` - Redirect to the wallet login page. Upon login, the page will be redirected back to the specified `redirectUrl` with the authorization token.
|
|
334
|
+
* - `popup` - Open the wallet login page in a new tab. Upon login, authorization information will be sent back to the client via message and the tab will be closed.
|
|
335
|
+
* @param {string=} provider - If logging in via a specific method, specify the provider and mode. Options: `oauth`, `metamask`
|
|
336
|
+
* @param {string=} mode - If logging in via a specific method, specify the mode. Options `login` (Log In), `create` (Sign Up)
|
|
337
|
+
* @param {string=} callbackUrl - If using the redirect flow, the URL to redirect back to after login.
|
|
338
|
+
* @param {Object=} marketplaceParams - Parameters of a marketplace to associate the login with. If not specified, the marketplace parameters used upon client initialization will be used. A marketplace is required when using the redirect flow.
|
|
339
|
+
* @param {boolean=} clearLogin=false - If specified, the user will be prompted to log in anew even if they are already logged in on the Eluvio Media Wallet app
|
|
340
|
+
*
|
|
341
|
+
* @throws - If using the popup flow and the user closes the popup, this method will throw an error.
|
|
342
|
+
*/
|
|
343
|
+
}, {
|
|
344
|
+
key: "LogIn",
|
|
345
|
+
value: function () {
|
|
346
|
+
var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref5) {
|
|
347
|
+
var _this = this;
|
|
348
|
+
var _ref5$method, method, provider, _ref5$mode, mode, callbackUrl, marketplaceParams, _ref5$clearLogin, clearLogin, callback, loginUrl;
|
|
349
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
350
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
351
|
+
case 0:
|
|
352
|
+
_ref5$method = _ref5.method, method = _ref5$method === void 0 ? "redirect" : _ref5$method, provider = _ref5.provider, _ref5$mode = _ref5.mode, mode = _ref5$mode === void 0 ? "login" : _ref5$mode, callbackUrl = _ref5.callbackUrl, marketplaceParams = _ref5.marketplaceParams, _ref5$clearLogin = _ref5.clearLogin, clearLogin = _ref5$clearLogin === void 0 ? false : _ref5$clearLogin, callback = _ref5.callback;
|
|
353
|
+
_context7.next = 3;
|
|
354
|
+
return this.LogInURL({
|
|
355
|
+
mode: mode,
|
|
356
|
+
provider: provider,
|
|
357
|
+
marketplaceParams: marketplaceParams,
|
|
358
|
+
clearLogin: clearLogin
|
|
359
|
+
});
|
|
360
|
+
case 3:
|
|
361
|
+
loginUrl = _context7.sent;
|
|
330
362
|
if (!(method === "redirect")) {
|
|
331
|
-
|
|
363
|
+
_context7.next = 11;
|
|
332
364
|
break;
|
|
333
365
|
}
|
|
334
366
|
loginUrl.searchParams.set("response", "redirect");
|
|
335
367
|
loginUrl.searchParams.set("source", "origin");
|
|
336
368
|
loginUrl.searchParams.set("redirect", callbackUrl);
|
|
337
369
|
window.location = loginUrl;
|
|
338
|
-
|
|
370
|
+
_context7.next = 15;
|
|
339
371
|
break;
|
|
340
|
-
case
|
|
372
|
+
case 11:
|
|
341
373
|
loginUrl.searchParams.set("response", "message");
|
|
342
374
|
loginUrl.searchParams.set("source", "parent");
|
|
343
|
-
|
|
375
|
+
_context7.next = 15;
|
|
344
376
|
return new Promise( /*#__PURE__*/function () {
|
|
345
|
-
var
|
|
346
|
-
return _regeneratorRuntime.wrap(function
|
|
347
|
-
while (1) switch (
|
|
377
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(resolve, reject) {
|
|
378
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
379
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
348
380
|
case 0:
|
|
349
|
-
|
|
381
|
+
_context6.next = 2;
|
|
350
382
|
return ActionPopup({
|
|
351
383
|
mode: "tab",
|
|
352
384
|
url: loginUrl.toString(),
|
|
@@ -354,50 +386,50 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
354
386
|
return reject("User cancelled login");
|
|
355
387
|
},
|
|
356
388
|
onMessage: function () {
|
|
357
|
-
var _onMessage2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
358
|
-
return _regeneratorRuntime.wrap(function
|
|
359
|
-
while (1) switch (
|
|
389
|
+
var _onMessage2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(event, Close) {
|
|
390
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
391
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
360
392
|
case 0:
|
|
361
393
|
if (!(!event || !event.data || event.data.type !== "LoginResponse")) {
|
|
362
|
-
|
|
394
|
+
_context5.next = 2;
|
|
363
395
|
break;
|
|
364
396
|
}
|
|
365
|
-
return
|
|
397
|
+
return _context5.abrupt("return");
|
|
366
398
|
case 2:
|
|
367
|
-
|
|
399
|
+
_context5.prev = 2;
|
|
368
400
|
if (!callback) {
|
|
369
|
-
|
|
401
|
+
_context5.next = 8;
|
|
370
402
|
break;
|
|
371
403
|
}
|
|
372
|
-
|
|
404
|
+
_context5.next = 6;
|
|
373
405
|
return callback(event.data.params);
|
|
374
406
|
case 6:
|
|
375
|
-
|
|
407
|
+
_context5.next = 10;
|
|
376
408
|
break;
|
|
377
409
|
case 8:
|
|
378
|
-
|
|
410
|
+
_context5.next = 10;
|
|
379
411
|
return _this.Authenticate({
|
|
380
412
|
token: event.data.params.clientSigningToken || event.data.params.clientAuthToken
|
|
381
413
|
});
|
|
382
414
|
case 10:
|
|
383
415
|
resolve();
|
|
384
|
-
|
|
416
|
+
_context5.next = 16;
|
|
385
417
|
break;
|
|
386
418
|
case 13:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
reject(
|
|
419
|
+
_context5.prev = 13;
|
|
420
|
+
_context5.t0 = _context5["catch"](2);
|
|
421
|
+
reject(_context5.t0);
|
|
390
422
|
case 16:
|
|
391
|
-
|
|
423
|
+
_context5.prev = 16;
|
|
392
424
|
Close();
|
|
393
|
-
return
|
|
425
|
+
return _context5.finish(16);
|
|
394
426
|
case 19:
|
|
395
427
|
case "end":
|
|
396
|
-
return
|
|
428
|
+
return _context5.stop();
|
|
397
429
|
}
|
|
398
|
-
},
|
|
430
|
+
}, _callee5, null, [[2, 13, 16, 19]]);
|
|
399
431
|
}));
|
|
400
|
-
function onMessage(
|
|
432
|
+
function onMessage(_x10, _x11) {
|
|
401
433
|
return _onMessage2.apply(this, arguments);
|
|
402
434
|
}
|
|
403
435
|
return onMessage;
|
|
@@ -405,21 +437,21 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
405
437
|
});
|
|
406
438
|
case 2:
|
|
407
439
|
case "end":
|
|
408
|
-
return
|
|
440
|
+
return _context6.stop();
|
|
409
441
|
}
|
|
410
|
-
},
|
|
442
|
+
}, _callee6);
|
|
411
443
|
}));
|
|
412
|
-
return function (
|
|
413
|
-
return
|
|
444
|
+
return function (_x8, _x9) {
|
|
445
|
+
return _ref6.apply(this, arguments);
|
|
414
446
|
};
|
|
415
447
|
}());
|
|
416
|
-
case
|
|
448
|
+
case 15:
|
|
417
449
|
case "end":
|
|
418
|
-
return
|
|
450
|
+
return _context7.stop();
|
|
419
451
|
}
|
|
420
|
-
},
|
|
452
|
+
}, _callee7, this);
|
|
421
453
|
}));
|
|
422
|
-
function LogIn(
|
|
454
|
+
function LogIn(_x7) {
|
|
423
455
|
return _LogIn.apply(this, arguments);
|
|
424
456
|
}
|
|
425
457
|
return LogIn;
|
|
@@ -455,32 +487,32 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
455
487
|
}, {
|
|
456
488
|
key: "Authenticate",
|
|
457
489
|
value: function () {
|
|
458
|
-
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
490
|
+
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
|
|
459
491
|
var token, decodedToken;
|
|
460
|
-
return _regeneratorRuntime.wrap(function
|
|
461
|
-
while (1) switch (
|
|
492
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
493
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
462
494
|
case 0:
|
|
463
|
-
token =
|
|
464
|
-
|
|
495
|
+
token = _ref7.token;
|
|
496
|
+
_context8.prev = 1;
|
|
465
497
|
decodedToken = JSON.parse(this.utils.FromB58ToStr(token)) || {};
|
|
466
|
-
|
|
498
|
+
_context8.next = 8;
|
|
467
499
|
break;
|
|
468
500
|
case 5:
|
|
469
|
-
|
|
470
|
-
|
|
501
|
+
_context8.prev = 5;
|
|
502
|
+
_context8.t0 = _context8["catch"](1);
|
|
471
503
|
throw new Error("Invalid authorization token " + token);
|
|
472
504
|
case 8:
|
|
473
505
|
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
474
|
-
|
|
506
|
+
_context8.next = 10;
|
|
475
507
|
break;
|
|
476
508
|
}
|
|
477
509
|
throw Error("ElvWalletClient: Provided authorization token has expired");
|
|
478
510
|
case 10:
|
|
479
511
|
if (!decodedToken.clusterToken) {
|
|
480
|
-
|
|
512
|
+
_context8.next = 13;
|
|
481
513
|
break;
|
|
482
514
|
}
|
|
483
|
-
|
|
515
|
+
_context8.next = 13;
|
|
484
516
|
return this.client.SetRemoteSigner({
|
|
485
517
|
authToken: decodedToken.clusterToken,
|
|
486
518
|
signerURIs: decodedToken.signerURIs
|
|
@@ -489,14 +521,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
489
521
|
this.client.SetStaticToken({
|
|
490
522
|
token: decodedToken.fabricToken
|
|
491
523
|
});
|
|
492
|
-
return
|
|
524
|
+
return _context8.abrupt("return", this.SetAuthorization(_objectSpread({}, decodedToken)));
|
|
493
525
|
case 15:
|
|
494
526
|
case "end":
|
|
495
|
-
return
|
|
527
|
+
return _context8.stop();
|
|
496
528
|
}
|
|
497
|
-
},
|
|
529
|
+
}, _callee8, this, [[1, 5]]);
|
|
498
530
|
}));
|
|
499
|
-
function Authenticate(
|
|
531
|
+
function Authenticate(_x12) {
|
|
500
532
|
return _Authenticate.apply(this, arguments);
|
|
501
533
|
}
|
|
502
534
|
return Authenticate;
|
|
@@ -523,23 +555,23 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
523
555
|
}, {
|
|
524
556
|
key: "AuthenticateOAuth",
|
|
525
557
|
value: function () {
|
|
526
|
-
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
527
|
-
var idToken, tenantId, email, signerURIs,
|
|
528
|
-
return _regeneratorRuntime.wrap(function
|
|
529
|
-
while (1) switch (
|
|
558
|
+
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
|
|
559
|
+
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, tokenDuration, expiresAt, fabricToken, address, decodedToken;
|
|
560
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
561
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
530
562
|
case 0:
|
|
531
|
-
idToken =
|
|
563
|
+
idToken = _ref8.idToken, tenantId = _ref8.tenantId, email = _ref8.email, signerURIs = _ref8.signerURIs, _ref8$shareEmail = _ref8.shareEmail, shareEmail = _ref8$shareEmail === void 0 ? false : _ref8$shareEmail;
|
|
532
564
|
tokenDuration = 24;
|
|
533
565
|
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
534
|
-
|
|
566
|
+
_context9.next = 6;
|
|
535
567
|
break;
|
|
536
568
|
}
|
|
537
|
-
|
|
569
|
+
_context9.next = 5;
|
|
538
570
|
return this.AvailableMarketplaces();
|
|
539
571
|
case 5:
|
|
540
572
|
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
541
573
|
case 6:
|
|
542
|
-
|
|
574
|
+
_context9.next = 8;
|
|
543
575
|
return this.client.SetRemoteSigner({
|
|
544
576
|
idToken: idToken,
|
|
545
577
|
tenantId: tenantId,
|
|
@@ -551,31 +583,31 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
551
583
|
});
|
|
552
584
|
case 8:
|
|
553
585
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
554
|
-
|
|
586
|
+
_context9.next = 11;
|
|
555
587
|
return this.client.CreateFabricToken({
|
|
556
588
|
duration: tokenDuration * 60 * 60 * 1000
|
|
557
589
|
});
|
|
558
590
|
case 11:
|
|
559
|
-
fabricToken =
|
|
591
|
+
fabricToken = _context9.sent;
|
|
560
592
|
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
561
593
|
if (email) {
|
|
562
|
-
|
|
594
|
+
_context9.next = 22;
|
|
563
595
|
break;
|
|
564
596
|
}
|
|
565
|
-
|
|
597
|
+
_context9.prev = 14;
|
|
566
598
|
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
567
599
|
email = decodedToken.email;
|
|
568
|
-
|
|
600
|
+
_context9.next = 22;
|
|
569
601
|
break;
|
|
570
602
|
case 19:
|
|
571
|
-
|
|
572
|
-
|
|
603
|
+
_context9.prev = 19;
|
|
604
|
+
_context9.t0 = _context9["catch"](14);
|
|
573
605
|
throw Error("Failed to decode ID token");
|
|
574
606
|
case 22:
|
|
575
607
|
this.client.SetStaticToken({
|
|
576
608
|
token: fabricToken
|
|
577
609
|
});
|
|
578
|
-
return
|
|
610
|
+
return _context9.abrupt("return", {
|
|
579
611
|
authToken: this.SetAuthorization({
|
|
580
612
|
fabricToken: fabricToken,
|
|
581
613
|
tenantId: tenantId,
|
|
@@ -601,11 +633,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
601
633
|
});
|
|
602
634
|
case 24:
|
|
603
635
|
case "end":
|
|
604
|
-
return
|
|
636
|
+
return _context9.stop();
|
|
605
637
|
}
|
|
606
|
-
},
|
|
638
|
+
}, _callee9, this, [[14, 19]]);
|
|
607
639
|
}));
|
|
608
|
-
function AuthenticateOAuth(
|
|
640
|
+
function AuthenticateOAuth(_x13) {
|
|
609
641
|
return _AuthenticateOAuth.apply(this, arguments);
|
|
610
642
|
}
|
|
611
643
|
return AuthenticateOAuth;
|
|
@@ -626,40 +658,40 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
626
658
|
}, {
|
|
627
659
|
key: "AuthenticateExternalWallet",
|
|
628
660
|
value: function () {
|
|
629
|
-
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
661
|
+
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref9) {
|
|
630
662
|
var _this2 = this;
|
|
631
|
-
var address,
|
|
632
|
-
return _regeneratorRuntime.wrap(function
|
|
633
|
-
while (1) switch (
|
|
663
|
+
var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
664
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
665
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
634
666
|
case 0:
|
|
635
|
-
address =
|
|
667
|
+
address = _ref9.address, _ref9$tokenDuration = _ref9.tokenDuration, tokenDuration = _ref9$tokenDuration === void 0 ? 24 : _ref9$tokenDuration, _ref9$walletName = _ref9.walletName, walletName = _ref9$walletName === void 0 ? "Metamask" : _ref9$walletName, Sign = _ref9.Sign;
|
|
636
668
|
if (!address) {
|
|
637
669
|
address = window.ethereum.selectedAddress;
|
|
638
670
|
}
|
|
639
671
|
address = this.utils.FormatAddress(address);
|
|
640
672
|
if (!Sign) {
|
|
641
673
|
Sign = /*#__PURE__*/function () {
|
|
642
|
-
var
|
|
643
|
-
return _regeneratorRuntime.wrap(function
|
|
644
|
-
while (1) switch (
|
|
674
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(message) {
|
|
675
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
676
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
645
677
|
case 0:
|
|
646
|
-
return
|
|
678
|
+
return _context10.abrupt("return", _this2.SignMetamask({
|
|
647
679
|
message: message,
|
|
648
680
|
address: address
|
|
649
681
|
}));
|
|
650
682
|
case 1:
|
|
651
683
|
case "end":
|
|
652
|
-
return
|
|
684
|
+
return _context10.stop();
|
|
653
685
|
}
|
|
654
|
-
},
|
|
686
|
+
}, _callee10);
|
|
655
687
|
}));
|
|
656
|
-
return function Sign(
|
|
657
|
-
return
|
|
688
|
+
return function Sign(_x15) {
|
|
689
|
+
return _ref10.apply(this, arguments);
|
|
658
690
|
};
|
|
659
691
|
}();
|
|
660
692
|
}
|
|
661
693
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
662
|
-
|
|
694
|
+
_context11.next = 7;
|
|
663
695
|
return this.client.CreateFabricToken({
|
|
664
696
|
address: address,
|
|
665
697
|
duration: tokenDuration * 60 * 60 * 1000,
|
|
@@ -667,8 +699,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
667
699
|
addEthereumPrefix: false
|
|
668
700
|
});
|
|
669
701
|
case 7:
|
|
670
|
-
fabricToken =
|
|
671
|
-
return
|
|
702
|
+
fabricToken = _context11.sent;
|
|
703
|
+
return _context11.abrupt("return", this.SetAuthorization({
|
|
672
704
|
fabricToken: fabricToken,
|
|
673
705
|
address: address,
|
|
674
706
|
expiresAt: expiresAt,
|
|
@@ -678,11 +710,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
678
710
|
}));
|
|
679
711
|
case 9:
|
|
680
712
|
case "end":
|
|
681
|
-
return
|
|
713
|
+
return _context11.stop();
|
|
682
714
|
}
|
|
683
|
-
},
|
|
715
|
+
}, _callee11, this);
|
|
684
716
|
}));
|
|
685
|
-
function AuthenticateExternalWallet(
|
|
717
|
+
function AuthenticateExternalWallet(_x14) {
|
|
686
718
|
return _AuthenticateExternalWallet.apply(this, arguments);
|
|
687
719
|
}
|
|
688
720
|
return AuthenticateExternalWallet;
|
|
@@ -712,19 +744,19 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
712
744
|
}
|
|
713
745
|
}, {
|
|
714
746
|
key: "SetAuthorization",
|
|
715
|
-
value: function SetAuthorization(
|
|
747
|
+
value: function SetAuthorization(_ref11) {
|
|
716
748
|
var _this3 = this;
|
|
717
|
-
var clusterToken =
|
|
718
|
-
fabricToken =
|
|
719
|
-
tenantId =
|
|
720
|
-
address =
|
|
721
|
-
email =
|
|
722
|
-
expiresAt =
|
|
723
|
-
signerURIs =
|
|
724
|
-
walletType =
|
|
725
|
-
walletName =
|
|
726
|
-
|
|
727
|
-
register =
|
|
749
|
+
var clusterToken = _ref11.clusterToken,
|
|
750
|
+
fabricToken = _ref11.fabricToken,
|
|
751
|
+
tenantId = _ref11.tenantId,
|
|
752
|
+
address = _ref11.address,
|
|
753
|
+
email = _ref11.email,
|
|
754
|
+
expiresAt = _ref11.expiresAt,
|
|
755
|
+
signerURIs = _ref11.signerURIs,
|
|
756
|
+
walletType = _ref11.walletType,
|
|
757
|
+
walletName = _ref11.walletName,
|
|
758
|
+
_ref11$register = _ref11.register,
|
|
759
|
+
register = _ref11$register === void 0 ? false : _ref11$register;
|
|
728
760
|
address = this.client.utils.FormatAddress(address);
|
|
729
761
|
this.__authorization = {
|
|
730
762
|
fabricToken: fabricToken,
|
|
@@ -766,53 +798,194 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
766
798
|
}, {
|
|
767
799
|
key: "SignMetamask",
|
|
768
800
|
value: function () {
|
|
769
|
-
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
801
|
+
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref12) {
|
|
770
802
|
var message, address, accounts;
|
|
771
|
-
return _regeneratorRuntime.wrap(function
|
|
772
|
-
while (1) switch (
|
|
803
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
804
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
773
805
|
case 0:
|
|
774
|
-
message =
|
|
806
|
+
message = _ref12.message, address = _ref12.address;
|
|
775
807
|
if (!(!inBrowser || !window.ethereum)) {
|
|
776
|
-
|
|
808
|
+
_context12.next = 3;
|
|
777
809
|
break;
|
|
778
810
|
}
|
|
779
811
|
throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
|
|
780
812
|
case 3:
|
|
781
813
|
address = address || this.UserAddress();
|
|
782
|
-
|
|
814
|
+
_context12.next = 6;
|
|
783
815
|
return window.ethereum.request({
|
|
784
816
|
method: "eth_requestAccounts"
|
|
785
817
|
});
|
|
786
818
|
case 6:
|
|
787
|
-
accounts =
|
|
819
|
+
accounts = _context12.sent;
|
|
788
820
|
if (!(address && !Utils.EqualAddress(accounts[0], address))) {
|
|
789
|
-
|
|
821
|
+
_context12.next = 9;
|
|
790
822
|
break;
|
|
791
823
|
}
|
|
792
824
|
throw Error("ElvWalletClient: Incorrect MetaMask account selected. Expected ".concat(address, ", got ").concat(accounts[0]));
|
|
793
825
|
case 9:
|
|
794
|
-
|
|
826
|
+
_context12.next = 11;
|
|
795
827
|
return window.ethereum.request({
|
|
796
828
|
method: "personal_sign",
|
|
797
829
|
params: [message, address, ""]
|
|
798
830
|
});
|
|
799
831
|
case 11:
|
|
800
|
-
return
|
|
832
|
+
return _context12.abrupt("return", _context12.sent);
|
|
801
833
|
case 12:
|
|
802
834
|
case "end":
|
|
803
|
-
return
|
|
835
|
+
return _context12.stop();
|
|
804
836
|
}
|
|
805
|
-
},
|
|
837
|
+
}, _callee12, this);
|
|
806
838
|
}));
|
|
807
|
-
function SignMetamask(
|
|
839
|
+
function SignMetamask(_x16) {
|
|
808
840
|
return _SignMetamask.apply(this, arguments);
|
|
809
841
|
}
|
|
810
842
|
return SignMetamask;
|
|
843
|
+
}()
|
|
844
|
+
}, {
|
|
845
|
+
key: "FlowURL",
|
|
846
|
+
value: function FlowURL(_ref13) {
|
|
847
|
+
var _ref13$type = _ref13.type,
|
|
848
|
+
type = _ref13$type === void 0 ? "flow" : _ref13$type,
|
|
849
|
+
flow = _ref13.flow,
|
|
850
|
+
marketplaceId = _ref13.marketplaceId,
|
|
851
|
+
_ref13$parameters = _ref13.parameters,
|
|
852
|
+
parameters = _ref13$parameters === void 0 ? {} : _ref13$parameters;
|
|
853
|
+
var url = new URL(this.appUrl);
|
|
854
|
+
if (marketplaceId) {
|
|
855
|
+
url.hash = UrlJoin("/", type, flow, "marketplace", marketplaceId, Utils.B58(JSON.stringify(parameters)));
|
|
856
|
+
} else {
|
|
857
|
+
url.hash = UrlJoin("/", type, flow, Utils.B58(JSON.stringify(parameters)));
|
|
858
|
+
}
|
|
859
|
+
url.searchParams.set("origin", window.location.origin);
|
|
860
|
+
return url.toString();
|
|
861
|
+
}
|
|
862
|
+
}, {
|
|
863
|
+
key: "GenerateCodeAuth",
|
|
864
|
+
value: function () {
|
|
865
|
+
var _GenerateCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
866
|
+
var _ref14,
|
|
867
|
+
url,
|
|
868
|
+
response,
|
|
869
|
+
_args13 = arguments;
|
|
870
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
871
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
872
|
+
case 0:
|
|
873
|
+
_ref14 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, url = _ref14.url;
|
|
874
|
+
if (url) {
|
|
875
|
+
_context13.next = 7;
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
_context13.next = 4;
|
|
879
|
+
return this.LogInURL({
|
|
880
|
+
mode: "login"
|
|
881
|
+
});
|
|
882
|
+
case 4:
|
|
883
|
+
url = _context13.sent;
|
|
884
|
+
url.searchParams.set("response", "code");
|
|
885
|
+
url.searchParams.set("source", "code");
|
|
886
|
+
case 7:
|
|
887
|
+
_context13.next = 9;
|
|
888
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
889
|
+
path: UrlJoin("as", "wlt", "login", "redirect", "metamask"),
|
|
890
|
+
method: "POST",
|
|
891
|
+
body: {
|
|
892
|
+
op: "create",
|
|
893
|
+
dest: url.toString()
|
|
894
|
+
}
|
|
895
|
+
}));
|
|
896
|
+
case 9:
|
|
897
|
+
response = _context13.sent;
|
|
898
|
+
response.code = response.id;
|
|
899
|
+
response.url = response.url.startsWith("https://") ? response.url : "https://".concat(response.url);
|
|
900
|
+
response.metamask_url = response.metamask_url.startsWith("https://") ? response.metamask_url : "https://".concat(response.metamask_url);
|
|
901
|
+
return _context13.abrupt("return", response);
|
|
902
|
+
case 14:
|
|
903
|
+
case "end":
|
|
904
|
+
return _context13.stop();
|
|
905
|
+
}
|
|
906
|
+
}, _callee13, this);
|
|
907
|
+
}));
|
|
908
|
+
function GenerateCodeAuth() {
|
|
909
|
+
return _GenerateCodeAuth.apply(this, arguments);
|
|
910
|
+
}
|
|
911
|
+
return GenerateCodeAuth;
|
|
912
|
+
}()
|
|
913
|
+
}, {
|
|
914
|
+
key: "SetCodeAuth",
|
|
915
|
+
value: function () {
|
|
916
|
+
var _SetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref15) {
|
|
917
|
+
var code, authToken;
|
|
918
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
919
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
920
|
+
case 0:
|
|
921
|
+
code = _ref15.code, authToken = _ref15.authToken;
|
|
922
|
+
_context14.next = 3;
|
|
923
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
924
|
+
path: UrlJoin("as", "wlt", "login", "session", code),
|
|
925
|
+
method: "POST",
|
|
926
|
+
headers: {
|
|
927
|
+
Authorization: "Bearer ".concat(this.AuthToken())
|
|
928
|
+
},
|
|
929
|
+
body: {
|
|
930
|
+
op: "set",
|
|
931
|
+
id: code,
|
|
932
|
+
format: "auth_token",
|
|
933
|
+
payload: authToken
|
|
934
|
+
}
|
|
935
|
+
}));
|
|
936
|
+
case 3:
|
|
937
|
+
case "end":
|
|
938
|
+
return _context14.stop();
|
|
939
|
+
}
|
|
940
|
+
}, _callee14, this);
|
|
941
|
+
}));
|
|
942
|
+
function SetCodeAuth(_x17) {
|
|
943
|
+
return _SetCodeAuth.apply(this, arguments);
|
|
944
|
+
}
|
|
945
|
+
return SetCodeAuth;
|
|
946
|
+
}()
|
|
947
|
+
}, {
|
|
948
|
+
key: "GetCodeAuth",
|
|
949
|
+
value: function () {
|
|
950
|
+
var _GetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref16) {
|
|
951
|
+
var code, passcode;
|
|
952
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
953
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
954
|
+
case 0:
|
|
955
|
+
code = _ref16.code, passcode = _ref16.passcode;
|
|
956
|
+
_context15.prev = 1;
|
|
957
|
+
_context15.next = 4;
|
|
958
|
+
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
959
|
+
path: UrlJoin("as", "wlt", "login", "redirect", "metamask", code, passcode),
|
|
960
|
+
method: "GET"
|
|
961
|
+
}));
|
|
962
|
+
case 4:
|
|
963
|
+
return _context15.abrupt("return", _context15.sent);
|
|
964
|
+
case 7:
|
|
965
|
+
_context15.prev = 7;
|
|
966
|
+
_context15.t0 = _context15["catch"](1);
|
|
967
|
+
if (!(_context15.t0 && _context15.t0.status === 404)) {
|
|
968
|
+
_context15.next = 11;
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
return _context15.abrupt("return", undefined);
|
|
972
|
+
case 11:
|
|
973
|
+
throw _context15.t0;
|
|
974
|
+
case 12:
|
|
975
|
+
case "end":
|
|
976
|
+
return _context15.stop();
|
|
977
|
+
}
|
|
978
|
+
}, _callee15, this, [[1, 7]]);
|
|
979
|
+
}));
|
|
980
|
+
function GetCodeAuth(_x18) {
|
|
981
|
+
return _GetCodeAuth.apply(this, arguments);
|
|
982
|
+
}
|
|
983
|
+
return GetCodeAuth;
|
|
811
984
|
}() // Internal loading methods
|
|
812
985
|
}, {
|
|
813
986
|
key: "LoadAvailableMarketplaces",
|
|
814
987
|
value: function () {
|
|
815
|
-
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
988
|
+
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
816
989
|
var _this4 = this;
|
|
817
990
|
var forceReload,
|
|
818
991
|
metadata,
|
|
@@ -821,18 +994,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
821
994
|
previewMarketplaceMetadata,
|
|
822
995
|
availableMarketplaces,
|
|
823
996
|
availableMarketplacesById,
|
|
824
|
-
|
|
825
|
-
return _regeneratorRuntime.wrap(function
|
|
826
|
-
while (1) switch (
|
|
997
|
+
_args16 = arguments;
|
|
998
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
999
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
827
1000
|
case 0:
|
|
828
|
-
forceReload =
|
|
1001
|
+
forceReload = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : false;
|
|
829
1002
|
if (!(!forceReload && Object.keys(this.availableMarketplaces) > 0)) {
|
|
830
|
-
|
|
1003
|
+
_context16.next = 3;
|
|
831
1004
|
break;
|
|
832
1005
|
}
|
|
833
|
-
return
|
|
1006
|
+
return _context16.abrupt("return");
|
|
834
1007
|
case 3:
|
|
835
|
-
|
|
1008
|
+
_context16.next = 5;
|
|
836
1009
|
return this.client.ContentObjectMetadata({
|
|
837
1010
|
libraryId: this.mainSiteLibraryId,
|
|
838
1011
|
objectId: this.mainSiteId,
|
|
@@ -844,13 +1017,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
844
1017
|
produceLinkUrls: true,
|
|
845
1018
|
authorizationToken: this.publicStaticToken,
|
|
846
1019
|
noAuth: true,
|
|
847
|
-
select: ["*/.", "*/marketplaces/*/.", "*/marketplaces/*/info/tenant_id", "*/marketplaces/*/info/tenant_name", "*/marketplaces/*/info/branding", "*/marketplaces/*/info/storefront/background", "*/marketplaces/*/info/storefront/background_mobile"],
|
|
848
|
-
remove: ["*/marketplaces/*/info/branding/custom_css"]
|
|
1020
|
+
select: ["*/.", "*/info/branding", "*/marketplaces/*/.", "*/marketplaces/*/info/tenant_id", "*/marketplaces/*/info/tenant_name", "*/marketplaces/*/info/branding", "*/marketplaces/*/info/storefront/background", "*/marketplaces/*/info/storefront/background_mobile"],
|
|
1021
|
+
remove: ["*/info/branding/wallet_css", "*/marketplaces/*/info/branding/custom_css"]
|
|
849
1022
|
});
|
|
850
1023
|
case 5:
|
|
851
|
-
metadata =
|
|
1024
|
+
metadata = _context16.sent;
|
|
852
1025
|
if (!this.previewMarketplaceId) {
|
|
853
|
-
|
|
1026
|
+
_context16.next = 21;
|
|
854
1027
|
break;
|
|
855
1028
|
}
|
|
856
1029
|
previewTenantSlug = "PREVIEW";
|
|
@@ -873,10 +1046,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
873
1046
|
|
|
874
1047
|
// Marketplace not present in branch, or preview version is different - Load metadata directly
|
|
875
1048
|
if (previewMarketplaceMetadata) {
|
|
876
|
-
|
|
1049
|
+
_context16.next = 14;
|
|
877
1050
|
break;
|
|
878
1051
|
}
|
|
879
|
-
|
|
1052
|
+
_context16.next = 12;
|
|
880
1053
|
return this.client.ContentObjectMetadata({
|
|
881
1054
|
versionHash: this.previewMarketplaceHash,
|
|
882
1055
|
metadataSubtree: "public/asset_metadata",
|
|
@@ -887,7 +1060,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
887
1060
|
remove: ["info/branding/custom_css"]
|
|
888
1061
|
});
|
|
889
1062
|
case 12:
|
|
890
|
-
previewMarketplaceMetadata =
|
|
1063
|
+
previewMarketplaceMetadata = _context16.sent;
|
|
891
1064
|
if (!previewMarketplaceSlug) {
|
|
892
1065
|
previewMarketplaceSlug = previewMarketplaceMetadata.slug;
|
|
893
1066
|
}
|
|
@@ -922,6 +1095,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
922
1095
|
marketplaceSlug: marketplaceSlug,
|
|
923
1096
|
marketplaceId: objectId,
|
|
924
1097
|
marketplaceHash: versionHash,
|
|
1098
|
+
tenantBranding: (metadata[tenantSlug].info || {}).branding || {},
|
|
925
1099
|
order: Configuration.__MARKETPLACE_ORDER.findIndex(function (slug) {
|
|
926
1100
|
return slug === marketplaceSlug;
|
|
927
1101
|
})
|
|
@@ -947,9 +1121,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
947
1121
|
this.availableMarketplacesById = availableMarketplacesById;
|
|
948
1122
|
case 26:
|
|
949
1123
|
case "end":
|
|
950
|
-
return
|
|
1124
|
+
return _context16.stop();
|
|
951
1125
|
}
|
|
952
|
-
},
|
|
1126
|
+
}, _callee16, this);
|
|
953
1127
|
}));
|
|
954
1128
|
function LoadAvailableMarketplaces() {
|
|
955
1129
|
return _LoadAvailableMarketplaces.apply(this, arguments);
|
|
@@ -959,25 +1133,25 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
959
1133
|
}, {
|
|
960
1134
|
key: "LatestMarketplaceHash",
|
|
961
1135
|
value: function () {
|
|
962
|
-
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1136
|
+
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref17) {
|
|
963
1137
|
var marketplaceParams, marketplaceInfo, marketplaceLink;
|
|
964
|
-
return _regeneratorRuntime.wrap(function
|
|
965
|
-
while (1) switch (
|
|
1138
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1139
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
966
1140
|
case 0:
|
|
967
|
-
marketplaceParams =
|
|
968
|
-
|
|
1141
|
+
marketplaceParams = _ref17.marketplaceParams;
|
|
1142
|
+
_context17.next = 3;
|
|
969
1143
|
return this.MarketplaceInfo({
|
|
970
1144
|
marketplaceParams: marketplaceParams
|
|
971
1145
|
});
|
|
972
1146
|
case 3:
|
|
973
|
-
marketplaceInfo =
|
|
1147
|
+
marketplaceInfo = _context17.sent;
|
|
974
1148
|
if (!(this.previewMarketplaceId && this.previewMarketplaceId === marketplaceInfo.marketplaceId)) {
|
|
975
|
-
|
|
1149
|
+
_context17.next = 6;
|
|
976
1150
|
break;
|
|
977
1151
|
}
|
|
978
|
-
return
|
|
1152
|
+
return _context17.abrupt("return", this.availableMarketplaces[marketplaceInfo.tenantSlug][marketplaceInfo.marketplaceSlug]["."].source);
|
|
979
1153
|
case 6:
|
|
980
|
-
|
|
1154
|
+
_context17.next = 8;
|
|
981
1155
|
return this.client.ContentObjectMetadata({
|
|
982
1156
|
libraryId: this.mainSiteLibraryId,
|
|
983
1157
|
objectId: this.mainSiteId,
|
|
@@ -986,15 +1160,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
986
1160
|
noAuth: true
|
|
987
1161
|
});
|
|
988
1162
|
case 8:
|
|
989
|
-
marketplaceLink =
|
|
990
|
-
return
|
|
1163
|
+
marketplaceLink = _context17.sent;
|
|
1164
|
+
return _context17.abrupt("return", LinkTargetHash(marketplaceLink));
|
|
991
1165
|
case 10:
|
|
992
1166
|
case "end":
|
|
993
|
-
return
|
|
1167
|
+
return _context17.stop();
|
|
994
1168
|
}
|
|
995
|
-
},
|
|
1169
|
+
}, _callee17, this);
|
|
996
1170
|
}));
|
|
997
|
-
function LatestMarketplaceHash(
|
|
1171
|
+
function LatestMarketplaceHash(_x19) {
|
|
998
1172
|
return _LatestMarketplaceHash.apply(this, arguments);
|
|
999
1173
|
}
|
|
1000
1174
|
return LatestMarketplaceHash;
|
|
@@ -1002,30 +1176,30 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1002
1176
|
}, {
|
|
1003
1177
|
key: "LoadMarketplace",
|
|
1004
1178
|
value: function () {
|
|
1005
|
-
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1179
|
+
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(marketplaceParams) {
|
|
1006
1180
|
var _this5 = this;
|
|
1007
1181
|
var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
|
|
1008
|
-
return _regeneratorRuntime.wrap(function
|
|
1009
|
-
while (1) switch (
|
|
1182
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1183
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1010
1184
|
case 0:
|
|
1011
1185
|
marketplaceInfo = this.MarketplaceInfo({
|
|
1012
1186
|
marketplaceParams: marketplaceParams
|
|
1013
1187
|
});
|
|
1014
1188
|
marketplaceId = marketplaceInfo.marketplaceId;
|
|
1015
|
-
|
|
1189
|
+
_context19.next = 4;
|
|
1016
1190
|
return this.LatestMarketplaceHash({
|
|
1017
1191
|
marketplaceParams: marketplaceParams
|
|
1018
1192
|
});
|
|
1019
1193
|
case 4:
|
|
1020
|
-
marketplaceHash =
|
|
1194
|
+
marketplaceHash = _context19.sent;
|
|
1021
1195
|
if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
|
|
1022
1196
|
delete this.cachedMarketplaces[marketplaceId];
|
|
1023
1197
|
}
|
|
1024
1198
|
if (this.cachedMarketplaces[marketplaceId]) {
|
|
1025
|
-
|
|
1199
|
+
_context19.next = 28;
|
|
1026
1200
|
break;
|
|
1027
1201
|
}
|
|
1028
|
-
|
|
1202
|
+
_context19.next = 9;
|
|
1029
1203
|
return this.client.ContentObjectMetadata({
|
|
1030
1204
|
libraryId: this.mainSiteLibraryId,
|
|
1031
1205
|
objectId: this.mainSiteId,
|
|
@@ -1039,29 +1213,51 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1039
1213
|
authorizationToken: this.publicStaticToken
|
|
1040
1214
|
});
|
|
1041
1215
|
case 9:
|
|
1042
|
-
marketplace =
|
|
1043
|
-
|
|
1216
|
+
marketplace = _context19.sent;
|
|
1217
|
+
if (!marketplace.branding.use_tenant_styling) {
|
|
1218
|
+
_context19.next = 17;
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
_context19.next = 13;
|
|
1222
|
+
return this.client.ContentObjectMetadata({
|
|
1223
|
+
libraryId: this.mainSiteLibraryId,
|
|
1224
|
+
objectId: this.mainSiteId,
|
|
1225
|
+
metadataSubtree: UrlJoin("/public", "asset_metadata", "tenants", marketplaceInfo.tenantSlug, "info", "branding"),
|
|
1226
|
+
authorizationToken: this.publicStaticToken,
|
|
1227
|
+
produceLinkUrls: true
|
|
1228
|
+
});
|
|
1229
|
+
case 13:
|
|
1230
|
+
_context19.t0 = _context19.sent;
|
|
1231
|
+
if (_context19.t0) {
|
|
1232
|
+
_context19.next = 16;
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
_context19.t0 = {};
|
|
1236
|
+
case 16:
|
|
1237
|
+
marketplace.tenantBranding = _context19.t0;
|
|
1238
|
+
case 17:
|
|
1239
|
+
_context19.next = 19;
|
|
1044
1240
|
return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
|
|
1045
|
-
var
|
|
1241
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(item, index) {
|
|
1046
1242
|
var authorizationToken;
|
|
1047
|
-
return _regeneratorRuntime.wrap(function
|
|
1048
|
-
while (1) switch (
|
|
1243
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1244
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1049
1245
|
case 0:
|
|
1050
1246
|
if (!item.requires_permissions) {
|
|
1051
|
-
|
|
1247
|
+
_context18.next = 14;
|
|
1052
1248
|
break;
|
|
1053
1249
|
}
|
|
1054
1250
|
if (_this5.loggedIn) {
|
|
1055
|
-
|
|
1251
|
+
_context18.next = 5;
|
|
1056
1252
|
break;
|
|
1057
1253
|
}
|
|
1058
|
-
|
|
1254
|
+
_context18.next = 4;
|
|
1059
1255
|
return _this5.client.CreateFabricToken({});
|
|
1060
1256
|
case 4:
|
|
1061
|
-
authorizationToken =
|
|
1257
|
+
authorizationToken = _context18.sent;
|
|
1062
1258
|
case 5:
|
|
1063
|
-
|
|
1064
|
-
|
|
1259
|
+
_context18.prev = 5;
|
|
1260
|
+
_context18.next = 8;
|
|
1065
1261
|
return _this5.client.ContentObjectMetadata({
|
|
1066
1262
|
versionHash: LinkTargetHash(item.nft_template),
|
|
1067
1263
|
metadataSubtree: "permissioned",
|
|
@@ -1069,29 +1265,29 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1069
1265
|
});
|
|
1070
1266
|
case 8:
|
|
1071
1267
|
item.authorized = true;
|
|
1072
|
-
|
|
1268
|
+
_context18.next = 14;
|
|
1073
1269
|
break;
|
|
1074
1270
|
case 11:
|
|
1075
|
-
|
|
1076
|
-
|
|
1271
|
+
_context18.prev = 11;
|
|
1272
|
+
_context18.t0 = _context18["catch"](5);
|
|
1077
1273
|
item.authorized = false;
|
|
1078
1274
|
case 14:
|
|
1079
1275
|
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
1080
1276
|
item.nftTemplateHash = ((item.nft_template || {})["."] || {}).source;
|
|
1081
1277
|
item.itemIndex = index;
|
|
1082
|
-
return
|
|
1278
|
+
return _context18.abrupt("return", item);
|
|
1083
1279
|
case 18:
|
|
1084
1280
|
case "end":
|
|
1085
|
-
return
|
|
1281
|
+
return _context18.stop();
|
|
1086
1282
|
}
|
|
1087
|
-
},
|
|
1283
|
+
}, _callee18, null, [[5, 11]]);
|
|
1088
1284
|
}));
|
|
1089
|
-
return function (
|
|
1090
|
-
return
|
|
1285
|
+
return function (_x21, _x22) {
|
|
1286
|
+
return _ref18.apply(this, arguments);
|
|
1091
1287
|
};
|
|
1092
1288
|
}()));
|
|
1093
|
-
case
|
|
1094
|
-
marketplace.items =
|
|
1289
|
+
case 19:
|
|
1290
|
+
marketplace.items = _context19.sent;
|
|
1095
1291
|
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
1096
1292
|
return _objectSpread(_objectSpread({}, collection), {}, {
|
|
1097
1293
|
collectionIndex: collectionIndex
|
|
@@ -1126,15 +1322,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1126
1322
|
} catch (error) {}
|
|
1127
1323
|
});
|
|
1128
1324
|
this.cachedMarketplaces[marketplaceId] = marketplace;
|
|
1129
|
-
case
|
|
1130
|
-
return
|
|
1131
|
-
case
|
|
1325
|
+
case 28:
|
|
1326
|
+
return _context19.abrupt("return", this.cachedMarketplaces[marketplaceId]);
|
|
1327
|
+
case 29:
|
|
1132
1328
|
case "end":
|
|
1133
|
-
return
|
|
1329
|
+
return _context19.stop();
|
|
1134
1330
|
}
|
|
1135
|
-
},
|
|
1331
|
+
}, _callee19, this);
|
|
1136
1332
|
}));
|
|
1137
|
-
function LoadMarketplace(
|
|
1333
|
+
function LoadMarketplace(_x20) {
|
|
1138
1334
|
return _LoadMarketplace.apply(this, arguments);
|
|
1139
1335
|
}
|
|
1140
1336
|
return LoadMarketplace;
|
|
@@ -1142,14 +1338,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1142
1338
|
}, {
|
|
1143
1339
|
key: "FilteredQuery",
|
|
1144
1340
|
value: function () {
|
|
1145
|
-
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1341
|
+
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
|
|
1146
1342
|
var _this6 = this;
|
|
1147
|
-
var
|
|
1148
|
-
|
|
1343
|
+
var _ref19,
|
|
1344
|
+
_ref19$mode,
|
|
1149
1345
|
mode,
|
|
1150
|
-
|
|
1346
|
+
_ref19$sortBy,
|
|
1151
1347
|
sortBy,
|
|
1152
|
-
|
|
1348
|
+
_ref19$sortDesc,
|
|
1153
1349
|
sortDesc,
|
|
1154
1350
|
filter,
|
|
1155
1351
|
editionFilters,
|
|
@@ -1165,27 +1361,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1165
1361
|
capLimit,
|
|
1166
1362
|
userAddress,
|
|
1167
1363
|
sellerAddress,
|
|
1168
|
-
|
|
1364
|
+
_ref19$lastNDays,
|
|
1169
1365
|
lastNDays,
|
|
1170
|
-
|
|
1366
|
+
_ref19$includeCheckou,
|
|
1171
1367
|
includeCheckoutLocked,
|
|
1172
|
-
|
|
1368
|
+
_ref19$start,
|
|
1173
1369
|
start,
|
|
1174
|
-
|
|
1370
|
+
_ref19$limit,
|
|
1175
1371
|
limit,
|
|
1176
1372
|
params,
|
|
1177
1373
|
marketplaceInfo,
|
|
1178
1374
|
marketplace,
|
|
1179
1375
|
filters,
|
|
1180
1376
|
path,
|
|
1181
|
-
|
|
1377
|
+
_ref21,
|
|
1182
1378
|
contents,
|
|
1183
1379
|
paging,
|
|
1184
|
-
|
|
1185
|
-
return _regeneratorRuntime.wrap(function
|
|
1186
|
-
while (1) switch (
|
|
1380
|
+
_args20 = arguments;
|
|
1381
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1382
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1187
1383
|
case 0:
|
|
1188
|
-
|
|
1384
|
+
_ref19 = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {}, _ref19$mode = _ref19.mode, mode = _ref19$mode === void 0 ? "listings" : _ref19$mode, _ref19$sortBy = _ref19.sortBy, sortBy = _ref19$sortBy === void 0 ? "created" : _ref19$sortBy, _ref19$sortDesc = _ref19.sortDesc, sortDesc = _ref19$sortDesc === void 0 ? false : _ref19$sortDesc, filter = _ref19.filter, editionFilters = _ref19.editionFilters, attributeFilters = _ref19.attributeFilters, contractAddress = _ref19.contractAddress, tokenId = _ref19.tokenId, currency = _ref19.currency, marketplaceParams = _ref19.marketplaceParams, tenantId = _ref19.tenantId, collectionIndexes = _ref19.collectionIndexes, priceRange = _ref19.priceRange, tokenIdRange = _ref19.tokenIdRange, capLimit = _ref19.capLimit, userAddress = _ref19.userAddress, sellerAddress = _ref19.sellerAddress, _ref19$lastNDays = _ref19.lastNDays, lastNDays = _ref19$lastNDays === void 0 ? -1 : _ref19$lastNDays, _ref19$includeCheckou = _ref19.includeCheckoutLocked, includeCheckoutLocked = _ref19$includeCheckou === void 0 ? false : _ref19$includeCheckou, _ref19$start = _ref19.start, start = _ref19$start === void 0 ? 0 : _ref19$start, _ref19$limit = _ref19.limit, limit = _ref19$limit === void 0 ? 50 : _ref19$limit;
|
|
1189
1385
|
collectionIndexes = (collectionIndexes || []).map(function (i) {
|
|
1190
1386
|
return parseInt(i);
|
|
1191
1387
|
});
|
|
@@ -1204,27 +1400,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1204
1400
|
params.checkout = true;
|
|
1205
1401
|
}
|
|
1206
1402
|
if (!marketplaceParams) {
|
|
1207
|
-
|
|
1403
|
+
_context20.next = 14;
|
|
1208
1404
|
break;
|
|
1209
1405
|
}
|
|
1210
|
-
|
|
1406
|
+
_context20.next = 9;
|
|
1211
1407
|
return this.MarketplaceInfo({
|
|
1212
1408
|
marketplaceParams: marketplaceParams
|
|
1213
1409
|
});
|
|
1214
1410
|
case 9:
|
|
1215
|
-
marketplaceInfo =
|
|
1411
|
+
marketplaceInfo = _context20.sent;
|
|
1216
1412
|
if (!(collectionIndexes.length > 0)) {
|
|
1217
|
-
|
|
1413
|
+
_context20.next = 14;
|
|
1218
1414
|
break;
|
|
1219
1415
|
}
|
|
1220
|
-
|
|
1416
|
+
_context20.next = 13;
|
|
1221
1417
|
return this.Marketplace({
|
|
1222
1418
|
marketplaceParams: marketplaceParams
|
|
1223
1419
|
});
|
|
1224
1420
|
case 13:
|
|
1225
|
-
marketplace =
|
|
1421
|
+
marketplace = _context20.sent;
|
|
1226
1422
|
case 14:
|
|
1227
|
-
|
|
1423
|
+
_context20.prev = 14;
|
|
1228
1424
|
filters = [];
|
|
1229
1425
|
if (sellerAddress) {
|
|
1230
1426
|
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
@@ -1284,9 +1480,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1284
1480
|
});
|
|
1285
1481
|
}
|
|
1286
1482
|
if (attributeFilters) {
|
|
1287
|
-
attributeFilters.map(function (
|
|
1288
|
-
var name =
|
|
1289
|
-
value =
|
|
1483
|
+
attributeFilters.map(function (_ref20) {
|
|
1484
|
+
var name = _ref20.name,
|
|
1485
|
+
value = _ref20.value;
|
|
1290
1486
|
if (!name || !value) {
|
|
1291
1487
|
return;
|
|
1292
1488
|
}
|
|
@@ -1318,75 +1514,75 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1318
1514
|
if (capLimit) {
|
|
1319
1515
|
filters.push("info/cap:le:".concat(parseInt(capLimit)));
|
|
1320
1516
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1517
|
+
_context20.t0 = mode;
|
|
1518
|
+
_context20.next = _context20.t0 === "owned" ? 29 : _context20.t0 === "listings" ? 31 : _context20.t0 === "transfers" ? 33 : _context20.t0 === "sales" ? 37 : _context20.t0 === "listing-stats" ? 41 : _context20.t0 === "sales-stats" ? 43 : _context20.t0 === "leaderboard" ? 46 : 48;
|
|
1323
1519
|
break;
|
|
1324
1520
|
case 29:
|
|
1325
1521
|
path = UrlJoin("as", "wlt", userAddress || this.UserAddress());
|
|
1326
|
-
return
|
|
1522
|
+
return _context20.abrupt("break", 48);
|
|
1327
1523
|
case 31:
|
|
1328
1524
|
path = UrlJoin("as", "mkt", "f");
|
|
1329
|
-
return
|
|
1525
|
+
return _context20.abrupt("break", 48);
|
|
1330
1526
|
case 33:
|
|
1331
1527
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1332
1528
|
filters.push("action:eq:TRANSFERRED");
|
|
1333
1529
|
filters.push("action:eq:SOLD");
|
|
1334
|
-
return
|
|
1530
|
+
return _context20.abrupt("break", 48);
|
|
1335
1531
|
case 37:
|
|
1336
1532
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1337
1533
|
filters.push("action:eq:SOLD");
|
|
1338
1534
|
filters.push("seller:co:0x");
|
|
1339
|
-
return
|
|
1535
|
+
return _context20.abrupt("break", 48);
|
|
1340
1536
|
case 41:
|
|
1341
1537
|
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1342
|
-
return
|
|
1538
|
+
return _context20.abrupt("break", 48);
|
|
1343
1539
|
case 43:
|
|
1344
1540
|
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1345
1541
|
filters.push("seller:co:0x");
|
|
1346
|
-
return
|
|
1542
|
+
return _context20.abrupt("break", 48);
|
|
1347
1543
|
case 46:
|
|
1348
1544
|
path = UrlJoin("as", "wlt", "leaders");
|
|
1349
|
-
return
|
|
1545
|
+
return _context20.abrupt("break", 48);
|
|
1350
1546
|
case 48:
|
|
1351
1547
|
if (filters.length > 0) {
|
|
1352
1548
|
params.filter = filters;
|
|
1353
1549
|
}
|
|
1354
1550
|
if (!mode.includes("stats")) {
|
|
1355
|
-
|
|
1551
|
+
_context20.next = 53;
|
|
1356
1552
|
break;
|
|
1357
1553
|
}
|
|
1358
|
-
|
|
1554
|
+
_context20.next = 52;
|
|
1359
1555
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1360
1556
|
path: path,
|
|
1361
1557
|
method: "GET",
|
|
1362
1558
|
queryParams: params
|
|
1363
1559
|
}));
|
|
1364
1560
|
case 52:
|
|
1365
|
-
return
|
|
1561
|
+
return _context20.abrupt("return", _context20.sent);
|
|
1366
1562
|
case 53:
|
|
1367
|
-
|
|
1368
|
-
|
|
1563
|
+
_context20.t2 = Utils;
|
|
1564
|
+
_context20.next = 56;
|
|
1369
1565
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1370
1566
|
path: path,
|
|
1371
1567
|
method: "GET",
|
|
1372
1568
|
queryParams: params
|
|
1373
1569
|
});
|
|
1374
1570
|
case 56:
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
return
|
|
1571
|
+
_context20.t3 = _context20.sent;
|
|
1572
|
+
_context20.next = 59;
|
|
1573
|
+
return _context20.t2.ResponseToJson.call(_context20.t2, _context20.t3);
|
|
1378
1574
|
case 59:
|
|
1379
|
-
|
|
1380
|
-
if (
|
|
1381
|
-
|
|
1575
|
+
_context20.t1 = _context20.sent;
|
|
1576
|
+
if (_context20.t1) {
|
|
1577
|
+
_context20.next = 62;
|
|
1382
1578
|
break;
|
|
1383
1579
|
}
|
|
1384
|
-
|
|
1580
|
+
_context20.t1 = [];
|
|
1385
1581
|
case 62:
|
|
1386
|
-
|
|
1387
|
-
contents =
|
|
1388
|
-
paging =
|
|
1389
|
-
return
|
|
1582
|
+
_ref21 = _context20.t1;
|
|
1583
|
+
contents = _ref21.contents;
|
|
1584
|
+
paging = _ref21.paging;
|
|
1585
|
+
return _context20.abrupt("return", {
|
|
1390
1586
|
paging: {
|
|
1391
1587
|
start: params.start,
|
|
1392
1588
|
limit: params.limit,
|
|
@@ -1398,13 +1594,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1398
1594
|
})
|
|
1399
1595
|
});
|
|
1400
1596
|
case 68:
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
if (!(
|
|
1404
|
-
|
|
1597
|
+
_context20.prev = 68;
|
|
1598
|
+
_context20.t4 = _context20["catch"](14);
|
|
1599
|
+
if (!(_context20.t4.status && _context20.t4.status.toString() === "404")) {
|
|
1600
|
+
_context20.next = 72;
|
|
1405
1601
|
break;
|
|
1406
1602
|
}
|
|
1407
|
-
return
|
|
1603
|
+
return _context20.abrupt("return", {
|
|
1408
1604
|
paging: {
|
|
1409
1605
|
start: params.start,
|
|
1410
1606
|
limit: params.limit,
|
|
@@ -1414,12 +1610,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1414
1610
|
results: []
|
|
1415
1611
|
});
|
|
1416
1612
|
case 72:
|
|
1417
|
-
throw
|
|
1613
|
+
throw _context20.t4;
|
|
1418
1614
|
case 73:
|
|
1419
1615
|
case "end":
|
|
1420
|
-
return
|
|
1616
|
+
return _context20.stop();
|
|
1421
1617
|
}
|
|
1422
|
-
},
|
|
1618
|
+
}, _callee20, this, [[14, 68]]);
|
|
1423
1619
|
}));
|
|
1424
1620
|
function FilteredQuery() {
|
|
1425
1621
|
return _FilteredQuery.apply(this, arguments);
|
|
@@ -1429,26 +1625,26 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1429
1625
|
}, {
|
|
1430
1626
|
key: "MintingStatus",
|
|
1431
1627
|
value: function () {
|
|
1432
|
-
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1628
|
+
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
|
|
1433
1629
|
var marketplaceParams, tenantId, marketplaceInfo, response;
|
|
1434
|
-
return _regeneratorRuntime.wrap(function
|
|
1435
|
-
while (1) switch (
|
|
1630
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1631
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1436
1632
|
case 0:
|
|
1437
|
-
marketplaceParams =
|
|
1633
|
+
marketplaceParams = _ref22.marketplaceParams, tenantId = _ref22.tenantId;
|
|
1438
1634
|
if (tenantId) {
|
|
1439
|
-
|
|
1635
|
+
_context21.next = 6;
|
|
1440
1636
|
break;
|
|
1441
1637
|
}
|
|
1442
|
-
|
|
1638
|
+
_context21.next = 4;
|
|
1443
1639
|
return this.MarketplaceInfo({
|
|
1444
1640
|
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1445
1641
|
});
|
|
1446
1642
|
case 4:
|
|
1447
|
-
marketplaceInfo =
|
|
1643
|
+
marketplaceInfo = _context21.sent;
|
|
1448
1644
|
tenantId = marketplaceInfo.tenantId;
|
|
1449
1645
|
case 6:
|
|
1450
|
-
|
|
1451
|
-
|
|
1646
|
+
_context21.prev = 6;
|
|
1647
|
+
_context21.next = 9;
|
|
1452
1648
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1453
1649
|
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1454
1650
|
method: "GET",
|
|
@@ -1457,8 +1653,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1457
1653
|
}
|
|
1458
1654
|
}));
|
|
1459
1655
|
case 9:
|
|
1460
|
-
response =
|
|
1461
|
-
return
|
|
1656
|
+
response = _context21.sent;
|
|
1657
|
+
return _context21.abrupt("return", response.map(function (status) {
|
|
1462
1658
|
var _status$op$split = status.op.split(":"),
|
|
1463
1659
|
_status$op$split2 = _slicedToArray(_status$op$split, 3),
|
|
1464
1660
|
op = _status$op$split2[0],
|
|
@@ -1496,17 +1692,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1496
1692
|
return a.ts < b.ts ? 1 : -1;
|
|
1497
1693
|
}));
|
|
1498
1694
|
case 13:
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
this.Log("Failed to retrieve minting status", true,
|
|
1502
|
-
return
|
|
1695
|
+
_context21.prev = 13;
|
|
1696
|
+
_context21.t0 = _context21["catch"](6);
|
|
1697
|
+
this.Log("Failed to retrieve minting status", true, _context21.t0);
|
|
1698
|
+
return _context21.abrupt("return", []);
|
|
1503
1699
|
case 17:
|
|
1504
1700
|
case "end":
|
|
1505
|
-
return
|
|
1701
|
+
return _context21.stop();
|
|
1506
1702
|
}
|
|
1507
|
-
},
|
|
1703
|
+
}, _callee21, this, [[6, 13]]);
|
|
1508
1704
|
}));
|
|
1509
|
-
function MintingStatus(
|
|
1705
|
+
function MintingStatus(_x23) {
|
|
1510
1706
|
return _MintingStatus.apply(this, arguments);
|
|
1511
1707
|
}
|
|
1512
1708
|
return MintingStatus;
|
|
@@ -1547,48 +1743,48 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1547
1743
|
}, {
|
|
1548
1744
|
key: "Initialize",
|
|
1549
1745
|
value: function () {
|
|
1550
|
-
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1551
|
-
var client,
|
|
1552
|
-
return _regeneratorRuntime.wrap(function
|
|
1553
|
-
while (1) switch (
|
|
1746
|
+
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref23) {
|
|
1747
|
+
var client, _ref23$appId, appId, _ref23$network, network, _ref23$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref23$storeAuthToken, storeAuthToken, _ref23$skipMarketplac, skipMarketplaceLoad, _ref24, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
|
|
1748
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1749
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1554
1750
|
case 0:
|
|
1555
|
-
client =
|
|
1556
|
-
|
|
1751
|
+
client = _ref23.client, _ref23$appId = _ref23.appId, appId = _ref23$appId === void 0 ? "general" : _ref23$appId, _ref23$network = _ref23.network, network = _ref23$network === void 0 ? "main" : _ref23$network, _ref23$mode = _ref23.mode, mode = _ref23$mode === void 0 ? "production" : _ref23$mode, localization = _ref23.localization, marketplaceParams = _ref23.marketplaceParams, previewMarketplaceId = _ref23.previewMarketplaceId, _ref23$storeAuthToken = _ref23.storeAuthToken, storeAuthToken = _ref23$storeAuthToken === void 0 ? true : _ref23$storeAuthToken, _ref23$skipMarketplac = _ref23.skipMarketplaceLoad, skipMarketplaceLoad = _ref23$skipMarketplac === void 0 ? false : _ref23$skipMarketplac;
|
|
1752
|
+
_ref24 = marketplaceParams || {}, tenantSlug = _ref24.tenantSlug, marketplaceSlug = _ref24.marketplaceSlug, marketplaceId = _ref24.marketplaceId, marketplaceHash = _ref24.marketplaceHash;
|
|
1557
1753
|
if (Configuration[network]) {
|
|
1558
|
-
|
|
1754
|
+
_context22.next = 6;
|
|
1559
1755
|
break;
|
|
1560
1756
|
}
|
|
1561
1757
|
throw Error("ElvWalletClient: Invalid network ".concat(network));
|
|
1562
1758
|
case 6:
|
|
1563
1759
|
if (Configuration[network][mode]) {
|
|
1564
|
-
|
|
1760
|
+
_context22.next = 8;
|
|
1565
1761
|
break;
|
|
1566
1762
|
}
|
|
1567
1763
|
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1568
1764
|
case 8:
|
|
1569
1765
|
if (client) {
|
|
1570
|
-
|
|
1766
|
+
_context22.next = 12;
|
|
1571
1767
|
break;
|
|
1572
1768
|
}
|
|
1573
|
-
|
|
1769
|
+
_context22.next = 11;
|
|
1574
1770
|
return ElvClient.FromNetworkName({
|
|
1575
1771
|
networkName: network,
|
|
1576
1772
|
assumeV3: true
|
|
1577
1773
|
});
|
|
1578
1774
|
case 11:
|
|
1579
|
-
client =
|
|
1775
|
+
client = _context22.sent;
|
|
1580
1776
|
case 12:
|
|
1581
1777
|
previewMarketplaceHash = previewMarketplaceId;
|
|
1582
1778
|
if (!(previewMarketplaceHash && !previewMarketplaceHash.startsWith("hq__"))) {
|
|
1583
|
-
|
|
1779
|
+
_context22.next = 17;
|
|
1584
1780
|
break;
|
|
1585
1781
|
}
|
|
1586
|
-
|
|
1782
|
+
_context22.next = 16;
|
|
1587
1783
|
return client.LatestVersionHash({
|
|
1588
1784
|
objectId: previewMarketplaceId
|
|
1589
1785
|
});
|
|
1590
1786
|
case 16:
|
|
1591
|
-
previewMarketplaceHash =
|
|
1787
|
+
previewMarketplaceHash = _context22.sent;
|
|
1592
1788
|
case 17:
|
|
1593
1789
|
walletClient = new ElvWalletClient({
|
|
1594
1790
|
appId: appId,
|
|
@@ -1606,61 +1802,61 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1606
1802
|
storeAuthToken: storeAuthToken
|
|
1607
1803
|
});
|
|
1608
1804
|
if (!(inBrowser && window.location && window.location.href)) {
|
|
1609
|
-
|
|
1805
|
+
_context22.next = 37;
|
|
1610
1806
|
break;
|
|
1611
1807
|
}
|
|
1612
1808
|
url = new URL(window.location.href);
|
|
1613
1809
|
if (!url.searchParams.get("elvToken")) {
|
|
1614
|
-
|
|
1810
|
+
_context22.next = 27;
|
|
1615
1811
|
break;
|
|
1616
1812
|
}
|
|
1617
|
-
|
|
1813
|
+
_context22.next = 23;
|
|
1618
1814
|
return walletClient.Authenticate({
|
|
1619
1815
|
token: url.searchParams.get("elvToken")
|
|
1620
1816
|
});
|
|
1621
1817
|
case 23:
|
|
1622
1818
|
url.searchParams["delete"]("elvToken");
|
|
1623
1819
|
window.history.replaceState("", "", url);
|
|
1624
|
-
|
|
1820
|
+
_context22.next = 37;
|
|
1625
1821
|
break;
|
|
1626
1822
|
case 27:
|
|
1627
1823
|
if (!(storeAuthToken && localStorageAvailable)) {
|
|
1628
|
-
|
|
1824
|
+
_context22.next = 37;
|
|
1629
1825
|
break;
|
|
1630
1826
|
}
|
|
1631
|
-
|
|
1827
|
+
_context22.prev = 28;
|
|
1632
1828
|
// Load saved auth token
|
|
1633
1829
|
savedToken = localStorage.getItem("__elv-token-".concat(network));
|
|
1634
1830
|
if (!savedToken) {
|
|
1635
|
-
|
|
1831
|
+
_context22.next = 33;
|
|
1636
1832
|
break;
|
|
1637
1833
|
}
|
|
1638
|
-
|
|
1834
|
+
_context22.next = 33;
|
|
1639
1835
|
return walletClient.Authenticate({
|
|
1640
1836
|
token: savedToken
|
|
1641
1837
|
});
|
|
1642
1838
|
case 33:
|
|
1643
|
-
|
|
1839
|
+
_context22.next = 37;
|
|
1644
1840
|
break;
|
|
1645
1841
|
case 35:
|
|
1646
|
-
|
|
1647
|
-
|
|
1842
|
+
_context22.prev = 35;
|
|
1843
|
+
_context22.t0 = _context22["catch"](28);
|
|
1648
1844
|
case 37:
|
|
1649
1845
|
if (skipMarketplaceLoad) {
|
|
1650
|
-
|
|
1846
|
+
_context22.next = 40;
|
|
1651
1847
|
break;
|
|
1652
1848
|
}
|
|
1653
|
-
|
|
1849
|
+
_context22.next = 40;
|
|
1654
1850
|
return walletClient.LoadAvailableMarketplaces();
|
|
1655
1851
|
case 40:
|
|
1656
|
-
return
|
|
1852
|
+
return _context22.abrupt("return", walletClient);
|
|
1657
1853
|
case 41:
|
|
1658
1854
|
case "end":
|
|
1659
|
-
return
|
|
1855
|
+
return _context22.stop();
|
|
1660
1856
|
}
|
|
1661
|
-
},
|
|
1857
|
+
}, _callee22, null, [[28, 35]]);
|
|
1662
1858
|
}));
|
|
1663
|
-
function Initialize(
|
|
1859
|
+
function Initialize(_x24) {
|
|
1664
1860
|
return _Initialize.apply(this, arguments);
|
|
1665
1861
|
}
|
|
1666
1862
|
return Initialize;
|