@eluvio/elv-client-js 4.0.37 → 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.
@@ -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: "LogIn",
268
+ key: "LogInURL",
290
269
  value: function () {
291
- var _LogIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref4) {
292
- var _this = this;
293
- var _ref4$method, method, provider, _ref4$mode, mode, callbackUrl, marketplaceParams, _ref4$clearLogin, clearLogin, callback, loginUrl;
294
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
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$method = _ref4.method, method = _ref4$method === void 0 ? "redirect" : _ref4$method, provider = _ref4.provider, _ref4$mode = _ref4.mode, mode = _ref4$mode === void 0 ? "login" : _ref4$mode, callbackUrl = _ref4.callbackUrl, marketplaceParams = _ref4.marketplaceParams, _ref4$clearLogin = _ref4.clearLogin, clearLogin = _ref4$clearLogin === void 0 ? false : _ref4$clearLogin, callback = _ref4.callback;
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
- _context6.next = 15;
289
+ _context4.next = 15;
310
290
  break;
311
291
  }
312
- _context6.t0 = loginUrl.searchParams;
313
- _context6.next = 11;
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
- _context6.t1 = _context6.sent.marketplaceHash;
319
- _context6.t0.set.call(_context6.t0, "mid", _context6.t1);
320
- _context6.next = 16;
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
- _context6.next = 24;
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
- _context6.next = 28;
370
+ _context7.next = 15;
339
371
  break;
340
- case 24:
372
+ case 11:
341
373
  loginUrl.searchParams.set("response", "message");
342
374
  loginUrl.searchParams.set("source", "parent");
343
- _context6.next = 28;
375
+ _context7.next = 15;
344
376
  return new Promise( /*#__PURE__*/function () {
345
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(resolve, reject) {
346
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
347
- while (1) switch (_context5.prev = _context5.next) {
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
- _context5.next = 2;
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 _callee4(event, Close) {
358
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
359
- while (1) switch (_context4.prev = _context4.next) {
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
- _context4.next = 2;
394
+ _context5.next = 2;
363
395
  break;
364
396
  }
365
- return _context4.abrupt("return");
397
+ return _context5.abrupt("return");
366
398
  case 2:
367
- _context4.prev = 2;
399
+ _context5.prev = 2;
368
400
  if (!callback) {
369
- _context4.next = 8;
401
+ _context5.next = 8;
370
402
  break;
371
403
  }
372
- _context4.next = 6;
404
+ _context5.next = 6;
373
405
  return callback(event.data.params);
374
406
  case 6:
375
- _context4.next = 10;
407
+ _context5.next = 10;
376
408
  break;
377
409
  case 8:
378
- _context4.next = 10;
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
- _context4.next = 16;
416
+ _context5.next = 16;
385
417
  break;
386
418
  case 13:
387
- _context4.prev = 13;
388
- _context4.t0 = _context4["catch"](2);
389
- reject(_context4.t0);
419
+ _context5.prev = 13;
420
+ _context5.t0 = _context5["catch"](2);
421
+ reject(_context5.t0);
390
422
  case 16:
391
- _context4.prev = 16;
423
+ _context5.prev = 16;
392
424
  Close();
393
- return _context4.finish(16);
425
+ return _context5.finish(16);
394
426
  case 19:
395
427
  case "end":
396
- return _context4.stop();
428
+ return _context5.stop();
397
429
  }
398
- }, _callee4, null, [[2, 13, 16, 19]]);
430
+ }, _callee5, null, [[2, 13, 16, 19]]);
399
431
  }));
400
- function onMessage(_x9, _x10) {
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 _context5.stop();
440
+ return _context6.stop();
409
441
  }
410
- }, _callee5);
442
+ }, _callee6);
411
443
  }));
412
- return function (_x7, _x8) {
413
- return _ref5.apply(this, arguments);
444
+ return function (_x8, _x9) {
445
+ return _ref6.apply(this, arguments);
414
446
  };
415
447
  }());
416
- case 28:
448
+ case 15:
417
449
  case "end":
418
- return _context6.stop();
450
+ return _context7.stop();
419
451
  }
420
- }, _callee6, this);
452
+ }, _callee7, this);
421
453
  }));
422
- function LogIn(_x6) {
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 _callee7(_ref6) {
490
+ var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
459
491
  var token, decodedToken;
460
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
461
- while (1) switch (_context7.prev = _context7.next) {
492
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
493
+ while (1) switch (_context8.prev = _context8.next) {
462
494
  case 0:
463
- token = _ref6.token;
464
- _context7.prev = 1;
495
+ token = _ref7.token;
496
+ _context8.prev = 1;
465
497
  decodedToken = JSON.parse(this.utils.FromB58ToStr(token)) || {};
466
- _context7.next = 8;
498
+ _context8.next = 8;
467
499
  break;
468
500
  case 5:
469
- _context7.prev = 5;
470
- _context7.t0 = _context7["catch"](1);
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
- _context7.next = 10;
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
- _context7.next = 13;
512
+ _context8.next = 13;
481
513
  break;
482
514
  }
483
- _context7.next = 13;
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 _context7.abrupt("return", this.SetAuthorization(_objectSpread({}, decodedToken)));
524
+ return _context8.abrupt("return", this.SetAuthorization(_objectSpread({}, decodedToken)));
493
525
  case 15:
494
526
  case "end":
495
- return _context7.stop();
527
+ return _context8.stop();
496
528
  }
497
- }, _callee7, this, [[1, 5]]);
529
+ }, _callee8, this, [[1, 5]]);
498
530
  }));
499
- function Authenticate(_x11) {
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 _callee8(_ref7) {
527
- var idToken, tenantId, email, signerURIs, _ref7$shareEmail, shareEmail, tokenDuration, expiresAt, fabricToken, address, decodedToken;
528
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
529
- while (1) switch (_context8.prev = _context8.next) {
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 = _ref7.idToken, tenantId = _ref7.tenantId, email = _ref7.email, signerURIs = _ref7.signerURIs, _ref7$shareEmail = _ref7.shareEmail, shareEmail = _ref7$shareEmail === void 0 ? false : _ref7$shareEmail;
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
- _context8.next = 6;
566
+ _context9.next = 6;
535
567
  break;
536
568
  }
537
- _context8.next = 5;
569
+ _context9.next = 5;
538
570
  return this.AvailableMarketplaces();
539
571
  case 5:
540
572
  tenantId = this.selectedMarketplaceInfo.tenantId;
541
573
  case 6:
542
- _context8.next = 8;
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
- _context8.next = 11;
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 = _context8.sent;
591
+ fabricToken = _context9.sent;
560
592
  address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
561
593
  if (email) {
562
- _context8.next = 22;
594
+ _context9.next = 22;
563
595
  break;
564
596
  }
565
- _context8.prev = 14;
597
+ _context9.prev = 14;
566
598
  decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
567
599
  email = decodedToken.email;
568
- _context8.next = 22;
600
+ _context9.next = 22;
569
601
  break;
570
602
  case 19:
571
- _context8.prev = 19;
572
- _context8.t0 = _context8["catch"](14);
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 _context8.abrupt("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 _context8.stop();
636
+ return _context9.stop();
605
637
  }
606
- }, _callee8, this, [[14, 19]]);
638
+ }, _callee9, this, [[14, 19]]);
607
639
  }));
608
- function AuthenticateOAuth(_x12) {
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 _callee10(_ref8) {
661
+ var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref9) {
630
662
  var _this2 = this;
631
- var address, _ref8$tokenDuration, tokenDuration, _ref8$walletName, walletName, Sign, expiresAt, fabricToken;
632
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
633
- while (1) switch (_context10.prev = _context10.next) {
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 = _ref8.address, _ref8$tokenDuration = _ref8.tokenDuration, tokenDuration = _ref8$tokenDuration === void 0 ? 24 : _ref8$tokenDuration, _ref8$walletName = _ref8.walletName, walletName = _ref8$walletName === void 0 ? "Metamask" : _ref8$walletName, Sign = _ref8.Sign;
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 _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(message) {
643
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
644
- while (1) switch (_context9.prev = _context9.next) {
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 _context9.abrupt("return", _this2.SignMetamask({
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 _context9.stop();
684
+ return _context10.stop();
653
685
  }
654
- }, _callee9);
686
+ }, _callee10);
655
687
  }));
656
- return function Sign(_x14) {
657
- return _ref9.apply(this, arguments);
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
- _context10.next = 7;
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 = _context10.sent;
671
- return _context10.abrupt("return", this.SetAuthorization({
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 _context10.stop();
713
+ return _context11.stop();
682
714
  }
683
- }, _callee10, this);
715
+ }, _callee11, this);
684
716
  }));
685
- function AuthenticateExternalWallet(_x13) {
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(_ref10) {
747
+ value: function SetAuthorization(_ref11) {
716
748
  var _this3 = this;
717
- var clusterToken = _ref10.clusterToken,
718
- fabricToken = _ref10.fabricToken,
719
- tenantId = _ref10.tenantId,
720
- address = _ref10.address,
721
- email = _ref10.email,
722
- expiresAt = _ref10.expiresAt,
723
- signerURIs = _ref10.signerURIs,
724
- walletType = _ref10.walletType,
725
- walletName = _ref10.walletName,
726
- _ref10$register = _ref10.register,
727
- register = _ref10$register === void 0 ? false : _ref10$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,58 +798,58 @@ var ElvWalletClient = /*#__PURE__*/function () {
766
798
  }, {
767
799
  key: "SignMetamask",
768
800
  value: function () {
769
- var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
801
+ var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref12) {
770
802
  var message, address, accounts;
771
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
772
- while (1) switch (_context11.prev = _context11.next) {
803
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
804
+ while (1) switch (_context12.prev = _context12.next) {
773
805
  case 0:
774
- message = _ref11.message, address = _ref11.address;
806
+ message = _ref12.message, address = _ref12.address;
775
807
  if (!(!inBrowser || !window.ethereum)) {
776
- _context11.next = 3;
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
- _context11.next = 6;
814
+ _context12.next = 6;
783
815
  return window.ethereum.request({
784
816
  method: "eth_requestAccounts"
785
817
  });
786
818
  case 6:
787
- accounts = _context11.sent;
819
+ accounts = _context12.sent;
788
820
  if (!(address && !Utils.EqualAddress(accounts[0], address))) {
789
- _context11.next = 9;
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
- _context11.next = 11;
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 _context11.abrupt("return", _context11.sent);
832
+ return _context12.abrupt("return", _context12.sent);
801
833
  case 12:
802
834
  case "end":
803
- return _context11.stop();
835
+ return _context12.stop();
804
836
  }
805
- }, _callee11, this);
837
+ }, _callee12, this);
806
838
  }));
807
- function SignMetamask(_x15) {
839
+ function SignMetamask(_x16) {
808
840
  return _SignMetamask.apply(this, arguments);
809
841
  }
810
842
  return SignMetamask;
811
843
  }()
812
844
  }, {
813
845
  key: "FlowURL",
814
- value: function FlowURL(_ref12) {
815
- var _ref12$type = _ref12.type,
816
- type = _ref12$type === void 0 ? "flow" : _ref12$type,
817
- flow = _ref12.flow,
818
- marketplaceId = _ref12.marketplaceId,
819
- _ref12$parameters = _ref12.parameters,
820
- parameters = _ref12$parameters === void 0 ? {} : _ref12$parameters;
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;
821
853
  var url = new URL(this.appUrl);
822
854
  if (marketplaceId) {
823
855
  url.hash = UrlJoin("/", type, flow, "marketplace", marketplaceId, Utils.B58(JSON.stringify(parameters)));
@@ -827,12 +859,133 @@ var ElvWalletClient = /*#__PURE__*/function () {
827
859
  url.searchParams.set("origin", window.location.origin);
828
860
  return url.toString();
829
861
  }
830
-
831
- // Internal loading methods
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;
984
+ }() // Internal loading methods
832
985
  }, {
833
986
  key: "LoadAvailableMarketplaces",
834
987
  value: function () {
835
- var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
988
+ var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
836
989
  var _this4 = this;
837
990
  var forceReload,
838
991
  metadata,
@@ -841,18 +994,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
841
994
  previewMarketplaceMetadata,
842
995
  availableMarketplaces,
843
996
  availableMarketplacesById,
844
- _args12 = arguments;
845
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
846
- while (1) switch (_context12.prev = _context12.next) {
997
+ _args16 = arguments;
998
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
999
+ while (1) switch (_context16.prev = _context16.next) {
847
1000
  case 0:
848
- forceReload = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : false;
1001
+ forceReload = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : false;
849
1002
  if (!(!forceReload && Object.keys(this.availableMarketplaces) > 0)) {
850
- _context12.next = 3;
1003
+ _context16.next = 3;
851
1004
  break;
852
1005
  }
853
- return _context12.abrupt("return");
1006
+ return _context16.abrupt("return");
854
1007
  case 3:
855
- _context12.next = 5;
1008
+ _context16.next = 5;
856
1009
  return this.client.ContentObjectMetadata({
857
1010
  libraryId: this.mainSiteLibraryId,
858
1011
  objectId: this.mainSiteId,
@@ -868,9 +1021,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
868
1021
  remove: ["*/info/branding/wallet_css", "*/marketplaces/*/info/branding/custom_css"]
869
1022
  });
870
1023
  case 5:
871
- metadata = _context12.sent;
1024
+ metadata = _context16.sent;
872
1025
  if (!this.previewMarketplaceId) {
873
- _context12.next = 21;
1026
+ _context16.next = 21;
874
1027
  break;
875
1028
  }
876
1029
  previewTenantSlug = "PREVIEW";
@@ -893,10 +1046,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
893
1046
 
894
1047
  // Marketplace not present in branch, or preview version is different - Load metadata directly
895
1048
  if (previewMarketplaceMetadata) {
896
- _context12.next = 14;
1049
+ _context16.next = 14;
897
1050
  break;
898
1051
  }
899
- _context12.next = 12;
1052
+ _context16.next = 12;
900
1053
  return this.client.ContentObjectMetadata({
901
1054
  versionHash: this.previewMarketplaceHash,
902
1055
  metadataSubtree: "public/asset_metadata",
@@ -907,7 +1060,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
907
1060
  remove: ["info/branding/custom_css"]
908
1061
  });
909
1062
  case 12:
910
- previewMarketplaceMetadata = _context12.sent;
1063
+ previewMarketplaceMetadata = _context16.sent;
911
1064
  if (!previewMarketplaceSlug) {
912
1065
  previewMarketplaceSlug = previewMarketplaceMetadata.slug;
913
1066
  }
@@ -968,9 +1121,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
968
1121
  this.availableMarketplacesById = availableMarketplacesById;
969
1122
  case 26:
970
1123
  case "end":
971
- return _context12.stop();
1124
+ return _context16.stop();
972
1125
  }
973
- }, _callee12, this);
1126
+ }, _callee16, this);
974
1127
  }));
975
1128
  function LoadAvailableMarketplaces() {
976
1129
  return _LoadAvailableMarketplaces.apply(this, arguments);
@@ -980,25 +1133,25 @@ var ElvWalletClient = /*#__PURE__*/function () {
980
1133
  }, {
981
1134
  key: "LatestMarketplaceHash",
982
1135
  value: function () {
983
- var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
1136
+ var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref17) {
984
1137
  var marketplaceParams, marketplaceInfo, marketplaceLink;
985
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
986
- while (1) switch (_context13.prev = _context13.next) {
1138
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1139
+ while (1) switch (_context17.prev = _context17.next) {
987
1140
  case 0:
988
- marketplaceParams = _ref13.marketplaceParams;
989
- _context13.next = 3;
1141
+ marketplaceParams = _ref17.marketplaceParams;
1142
+ _context17.next = 3;
990
1143
  return this.MarketplaceInfo({
991
1144
  marketplaceParams: marketplaceParams
992
1145
  });
993
1146
  case 3:
994
- marketplaceInfo = _context13.sent;
1147
+ marketplaceInfo = _context17.sent;
995
1148
  if (!(this.previewMarketplaceId && this.previewMarketplaceId === marketplaceInfo.marketplaceId)) {
996
- _context13.next = 6;
1149
+ _context17.next = 6;
997
1150
  break;
998
1151
  }
999
- return _context13.abrupt("return", this.availableMarketplaces[marketplaceInfo.tenantSlug][marketplaceInfo.marketplaceSlug]["."].source);
1152
+ return _context17.abrupt("return", this.availableMarketplaces[marketplaceInfo.tenantSlug][marketplaceInfo.marketplaceSlug]["."].source);
1000
1153
  case 6:
1001
- _context13.next = 8;
1154
+ _context17.next = 8;
1002
1155
  return this.client.ContentObjectMetadata({
1003
1156
  libraryId: this.mainSiteLibraryId,
1004
1157
  objectId: this.mainSiteId,
@@ -1007,15 +1160,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
1007
1160
  noAuth: true
1008
1161
  });
1009
1162
  case 8:
1010
- marketplaceLink = _context13.sent;
1011
- return _context13.abrupt("return", LinkTargetHash(marketplaceLink));
1163
+ marketplaceLink = _context17.sent;
1164
+ return _context17.abrupt("return", LinkTargetHash(marketplaceLink));
1012
1165
  case 10:
1013
1166
  case "end":
1014
- return _context13.stop();
1167
+ return _context17.stop();
1015
1168
  }
1016
- }, _callee13, this);
1169
+ }, _callee17, this);
1017
1170
  }));
1018
- function LatestMarketplaceHash(_x16) {
1171
+ function LatestMarketplaceHash(_x19) {
1019
1172
  return _LatestMarketplaceHash.apply(this, arguments);
1020
1173
  }
1021
1174
  return LatestMarketplaceHash;
@@ -1023,30 +1176,30 @@ var ElvWalletClient = /*#__PURE__*/function () {
1023
1176
  }, {
1024
1177
  key: "LoadMarketplace",
1025
1178
  value: function () {
1026
- var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(marketplaceParams) {
1179
+ var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(marketplaceParams) {
1027
1180
  var _this5 = this;
1028
1181
  var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
1029
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1030
- while (1) switch (_context15.prev = _context15.next) {
1182
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1183
+ while (1) switch (_context19.prev = _context19.next) {
1031
1184
  case 0:
1032
1185
  marketplaceInfo = this.MarketplaceInfo({
1033
1186
  marketplaceParams: marketplaceParams
1034
1187
  });
1035
1188
  marketplaceId = marketplaceInfo.marketplaceId;
1036
- _context15.next = 4;
1189
+ _context19.next = 4;
1037
1190
  return this.LatestMarketplaceHash({
1038
1191
  marketplaceParams: marketplaceParams
1039
1192
  });
1040
1193
  case 4:
1041
- marketplaceHash = _context15.sent;
1194
+ marketplaceHash = _context19.sent;
1042
1195
  if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
1043
1196
  delete this.cachedMarketplaces[marketplaceId];
1044
1197
  }
1045
1198
  if (this.cachedMarketplaces[marketplaceId]) {
1046
- _context15.next = 28;
1199
+ _context19.next = 28;
1047
1200
  break;
1048
1201
  }
1049
- _context15.next = 9;
1202
+ _context19.next = 9;
1050
1203
  return this.client.ContentObjectMetadata({
1051
1204
  libraryId: this.mainSiteLibraryId,
1052
1205
  objectId: this.mainSiteId,
@@ -1060,12 +1213,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
1060
1213
  authorizationToken: this.publicStaticToken
1061
1214
  });
1062
1215
  case 9:
1063
- marketplace = _context15.sent;
1216
+ marketplace = _context19.sent;
1064
1217
  if (!marketplace.branding.use_tenant_styling) {
1065
- _context15.next = 17;
1218
+ _context19.next = 17;
1066
1219
  break;
1067
1220
  }
1068
- _context15.next = 13;
1221
+ _context19.next = 13;
1069
1222
  return this.client.ContentObjectMetadata({
1070
1223
  libraryId: this.mainSiteLibraryId,
1071
1224
  objectId: this.mainSiteId,
@@ -1074,37 +1227,37 @@ var ElvWalletClient = /*#__PURE__*/function () {
1074
1227
  produceLinkUrls: true
1075
1228
  });
1076
1229
  case 13:
1077
- _context15.t0 = _context15.sent;
1078
- if (_context15.t0) {
1079
- _context15.next = 16;
1230
+ _context19.t0 = _context19.sent;
1231
+ if (_context19.t0) {
1232
+ _context19.next = 16;
1080
1233
  break;
1081
1234
  }
1082
- _context15.t0 = {};
1235
+ _context19.t0 = {};
1083
1236
  case 16:
1084
- marketplace.tenantBranding = _context15.t0;
1237
+ marketplace.tenantBranding = _context19.t0;
1085
1238
  case 17:
1086
- _context15.next = 19;
1239
+ _context19.next = 19;
1087
1240
  return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
1088
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(item, index) {
1241
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(item, index) {
1089
1242
  var authorizationToken;
1090
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1091
- while (1) switch (_context14.prev = _context14.next) {
1243
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1244
+ while (1) switch (_context18.prev = _context18.next) {
1092
1245
  case 0:
1093
1246
  if (!item.requires_permissions) {
1094
- _context14.next = 14;
1247
+ _context18.next = 14;
1095
1248
  break;
1096
1249
  }
1097
1250
  if (_this5.loggedIn) {
1098
- _context14.next = 5;
1251
+ _context18.next = 5;
1099
1252
  break;
1100
1253
  }
1101
- _context14.next = 4;
1254
+ _context18.next = 4;
1102
1255
  return _this5.client.CreateFabricToken({});
1103
1256
  case 4:
1104
- authorizationToken = _context14.sent;
1257
+ authorizationToken = _context18.sent;
1105
1258
  case 5:
1106
- _context14.prev = 5;
1107
- _context14.next = 8;
1259
+ _context18.prev = 5;
1260
+ _context18.next = 8;
1108
1261
  return _this5.client.ContentObjectMetadata({
1109
1262
  versionHash: LinkTargetHash(item.nft_template),
1110
1263
  metadataSubtree: "permissioned",
@@ -1112,29 +1265,29 @@ var ElvWalletClient = /*#__PURE__*/function () {
1112
1265
  });
1113
1266
  case 8:
1114
1267
  item.authorized = true;
1115
- _context14.next = 14;
1268
+ _context18.next = 14;
1116
1269
  break;
1117
1270
  case 11:
1118
- _context14.prev = 11;
1119
- _context14.t0 = _context14["catch"](5);
1271
+ _context18.prev = 11;
1272
+ _context18.t0 = _context18["catch"](5);
1120
1273
  item.authorized = false;
1121
1274
  case 14:
1122
1275
  item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
1123
1276
  item.nftTemplateHash = ((item.nft_template || {})["."] || {}).source;
1124
1277
  item.itemIndex = index;
1125
- return _context14.abrupt("return", item);
1278
+ return _context18.abrupt("return", item);
1126
1279
  case 18:
1127
1280
  case "end":
1128
- return _context14.stop();
1281
+ return _context18.stop();
1129
1282
  }
1130
- }, _callee14, null, [[5, 11]]);
1283
+ }, _callee18, null, [[5, 11]]);
1131
1284
  }));
1132
- return function (_x18, _x19) {
1133
- return _ref14.apply(this, arguments);
1285
+ return function (_x21, _x22) {
1286
+ return _ref18.apply(this, arguments);
1134
1287
  };
1135
1288
  }()));
1136
1289
  case 19:
1137
- marketplace.items = _context15.sent;
1290
+ marketplace.items = _context19.sent;
1138
1291
  marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
1139
1292
  return _objectSpread(_objectSpread({}, collection), {}, {
1140
1293
  collectionIndex: collectionIndex
@@ -1170,14 +1323,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
1170
1323
  });
1171
1324
  this.cachedMarketplaces[marketplaceId] = marketplace;
1172
1325
  case 28:
1173
- return _context15.abrupt("return", this.cachedMarketplaces[marketplaceId]);
1326
+ return _context19.abrupt("return", this.cachedMarketplaces[marketplaceId]);
1174
1327
  case 29:
1175
1328
  case "end":
1176
- return _context15.stop();
1329
+ return _context19.stop();
1177
1330
  }
1178
- }, _callee15, this);
1331
+ }, _callee19, this);
1179
1332
  }));
1180
- function LoadMarketplace(_x17) {
1333
+ function LoadMarketplace(_x20) {
1181
1334
  return _LoadMarketplace.apply(this, arguments);
1182
1335
  }
1183
1336
  return LoadMarketplace;
@@ -1185,14 +1338,14 @@ var ElvWalletClient = /*#__PURE__*/function () {
1185
1338
  }, {
1186
1339
  key: "FilteredQuery",
1187
1340
  value: function () {
1188
- var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
1341
+ var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
1189
1342
  var _this6 = this;
1190
- var _ref15,
1191
- _ref15$mode,
1343
+ var _ref19,
1344
+ _ref19$mode,
1192
1345
  mode,
1193
- _ref15$sortBy,
1346
+ _ref19$sortBy,
1194
1347
  sortBy,
1195
- _ref15$sortDesc,
1348
+ _ref19$sortDesc,
1196
1349
  sortDesc,
1197
1350
  filter,
1198
1351
  editionFilters,
@@ -1208,27 +1361,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
1208
1361
  capLimit,
1209
1362
  userAddress,
1210
1363
  sellerAddress,
1211
- _ref15$lastNDays,
1364
+ _ref19$lastNDays,
1212
1365
  lastNDays,
1213
- _ref15$includeCheckou,
1366
+ _ref19$includeCheckou,
1214
1367
  includeCheckoutLocked,
1215
- _ref15$start,
1368
+ _ref19$start,
1216
1369
  start,
1217
- _ref15$limit,
1370
+ _ref19$limit,
1218
1371
  limit,
1219
1372
  params,
1220
1373
  marketplaceInfo,
1221
1374
  marketplace,
1222
1375
  filters,
1223
1376
  path,
1224
- _ref17,
1377
+ _ref21,
1225
1378
  contents,
1226
1379
  paging,
1227
- _args16 = arguments;
1228
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1229
- while (1) switch (_context16.prev = _context16.next) {
1380
+ _args20 = arguments;
1381
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1382
+ while (1) switch (_context20.prev = _context20.next) {
1230
1383
  case 0:
1231
- _ref15 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, _ref15$mode = _ref15.mode, mode = _ref15$mode === void 0 ? "listings" : _ref15$mode, _ref15$sortBy = _ref15.sortBy, sortBy = _ref15$sortBy === void 0 ? "created" : _ref15$sortBy, _ref15$sortDesc = _ref15.sortDesc, sortDesc = _ref15$sortDesc === void 0 ? false : _ref15$sortDesc, filter = _ref15.filter, editionFilters = _ref15.editionFilters, attributeFilters = _ref15.attributeFilters, contractAddress = _ref15.contractAddress, tokenId = _ref15.tokenId, currency = _ref15.currency, marketplaceParams = _ref15.marketplaceParams, tenantId = _ref15.tenantId, collectionIndexes = _ref15.collectionIndexes, priceRange = _ref15.priceRange, tokenIdRange = _ref15.tokenIdRange, capLimit = _ref15.capLimit, userAddress = _ref15.userAddress, sellerAddress = _ref15.sellerAddress, _ref15$lastNDays = _ref15.lastNDays, lastNDays = _ref15$lastNDays === void 0 ? -1 : _ref15$lastNDays, _ref15$includeCheckou = _ref15.includeCheckoutLocked, includeCheckoutLocked = _ref15$includeCheckou === void 0 ? false : _ref15$includeCheckou, _ref15$start = _ref15.start, start = _ref15$start === void 0 ? 0 : _ref15$start, _ref15$limit = _ref15.limit, limit = _ref15$limit === void 0 ? 50 : _ref15$limit;
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;
1232
1385
  collectionIndexes = (collectionIndexes || []).map(function (i) {
1233
1386
  return parseInt(i);
1234
1387
  });
@@ -1247,27 +1400,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
1247
1400
  params.checkout = true;
1248
1401
  }
1249
1402
  if (!marketplaceParams) {
1250
- _context16.next = 14;
1403
+ _context20.next = 14;
1251
1404
  break;
1252
1405
  }
1253
- _context16.next = 9;
1406
+ _context20.next = 9;
1254
1407
  return this.MarketplaceInfo({
1255
1408
  marketplaceParams: marketplaceParams
1256
1409
  });
1257
1410
  case 9:
1258
- marketplaceInfo = _context16.sent;
1411
+ marketplaceInfo = _context20.sent;
1259
1412
  if (!(collectionIndexes.length > 0)) {
1260
- _context16.next = 14;
1413
+ _context20.next = 14;
1261
1414
  break;
1262
1415
  }
1263
- _context16.next = 13;
1416
+ _context20.next = 13;
1264
1417
  return this.Marketplace({
1265
1418
  marketplaceParams: marketplaceParams
1266
1419
  });
1267
1420
  case 13:
1268
- marketplace = _context16.sent;
1421
+ marketplace = _context20.sent;
1269
1422
  case 14:
1270
- _context16.prev = 14;
1423
+ _context20.prev = 14;
1271
1424
  filters = [];
1272
1425
  if (sellerAddress) {
1273
1426
  filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
@@ -1327,9 +1480,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
1327
1480
  });
1328
1481
  }
1329
1482
  if (attributeFilters) {
1330
- attributeFilters.map(function (_ref16) {
1331
- var name = _ref16.name,
1332
- value = _ref16.value;
1483
+ attributeFilters.map(function (_ref20) {
1484
+ var name = _ref20.name,
1485
+ value = _ref20.value;
1333
1486
  if (!name || !value) {
1334
1487
  return;
1335
1488
  }
@@ -1361,75 +1514,75 @@ var ElvWalletClient = /*#__PURE__*/function () {
1361
1514
  if (capLimit) {
1362
1515
  filters.push("info/cap:le:".concat(parseInt(capLimit)));
1363
1516
  }
1364
- _context16.t0 = mode;
1365
- _context16.next = _context16.t0 === "owned" ? 29 : _context16.t0 === "listings" ? 31 : _context16.t0 === "transfers" ? 33 : _context16.t0 === "sales" ? 37 : _context16.t0 === "listing-stats" ? 41 : _context16.t0 === "sales-stats" ? 43 : _context16.t0 === "leaderboard" ? 46 : 48;
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;
1366
1519
  break;
1367
1520
  case 29:
1368
1521
  path = UrlJoin("as", "wlt", userAddress || this.UserAddress());
1369
- return _context16.abrupt("break", 48);
1522
+ return _context20.abrupt("break", 48);
1370
1523
  case 31:
1371
1524
  path = UrlJoin("as", "mkt", "f");
1372
- return _context16.abrupt("break", 48);
1525
+ return _context20.abrupt("break", 48);
1373
1526
  case 33:
1374
1527
  path = UrlJoin("as", "mkt", "hst", "f");
1375
1528
  filters.push("action:eq:TRANSFERRED");
1376
1529
  filters.push("action:eq:SOLD");
1377
- return _context16.abrupt("break", 48);
1530
+ return _context20.abrupt("break", 48);
1378
1531
  case 37:
1379
1532
  path = UrlJoin("as", "mkt", "hst", "f");
1380
1533
  filters.push("action:eq:SOLD");
1381
1534
  filters.push("seller:co:0x");
1382
- return _context16.abrupt("break", 48);
1535
+ return _context20.abrupt("break", 48);
1383
1536
  case 41:
1384
1537
  path = UrlJoin("as", "mkt", "stats", "listed");
1385
- return _context16.abrupt("break", 48);
1538
+ return _context20.abrupt("break", 48);
1386
1539
  case 43:
1387
1540
  path = UrlJoin("as", "mkt", "stats", "sold");
1388
1541
  filters.push("seller:co:0x");
1389
- return _context16.abrupt("break", 48);
1542
+ return _context20.abrupt("break", 48);
1390
1543
  case 46:
1391
1544
  path = UrlJoin("as", "wlt", "leaders");
1392
- return _context16.abrupt("break", 48);
1545
+ return _context20.abrupt("break", 48);
1393
1546
  case 48:
1394
1547
  if (filters.length > 0) {
1395
1548
  params.filter = filters;
1396
1549
  }
1397
1550
  if (!mode.includes("stats")) {
1398
- _context16.next = 53;
1551
+ _context20.next = 53;
1399
1552
  break;
1400
1553
  }
1401
- _context16.next = 52;
1554
+ _context20.next = 52;
1402
1555
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
1403
1556
  path: path,
1404
1557
  method: "GET",
1405
1558
  queryParams: params
1406
1559
  }));
1407
1560
  case 52:
1408
- return _context16.abrupt("return", _context16.sent);
1561
+ return _context20.abrupt("return", _context20.sent);
1409
1562
  case 53:
1410
- _context16.t2 = Utils;
1411
- _context16.next = 56;
1563
+ _context20.t2 = Utils;
1564
+ _context20.next = 56;
1412
1565
  return this.client.authClient.MakeAuthServiceRequest({
1413
1566
  path: path,
1414
1567
  method: "GET",
1415
1568
  queryParams: params
1416
1569
  });
1417
1570
  case 56:
1418
- _context16.t3 = _context16.sent;
1419
- _context16.next = 59;
1420
- return _context16.t2.ResponseToJson.call(_context16.t2, _context16.t3);
1571
+ _context20.t3 = _context20.sent;
1572
+ _context20.next = 59;
1573
+ return _context20.t2.ResponseToJson.call(_context20.t2, _context20.t3);
1421
1574
  case 59:
1422
- _context16.t1 = _context16.sent;
1423
- if (_context16.t1) {
1424
- _context16.next = 62;
1575
+ _context20.t1 = _context20.sent;
1576
+ if (_context20.t1) {
1577
+ _context20.next = 62;
1425
1578
  break;
1426
1579
  }
1427
- _context16.t1 = [];
1580
+ _context20.t1 = [];
1428
1581
  case 62:
1429
- _ref17 = _context16.t1;
1430
- contents = _ref17.contents;
1431
- paging = _ref17.paging;
1432
- return _context16.abrupt("return", {
1582
+ _ref21 = _context20.t1;
1583
+ contents = _ref21.contents;
1584
+ paging = _ref21.paging;
1585
+ return _context20.abrupt("return", {
1433
1586
  paging: {
1434
1587
  start: params.start,
1435
1588
  limit: params.limit,
@@ -1441,13 +1594,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
1441
1594
  })
1442
1595
  });
1443
1596
  case 68:
1444
- _context16.prev = 68;
1445
- _context16.t4 = _context16["catch"](14);
1446
- if (!(_context16.t4.status && _context16.t4.status.toString() === "404")) {
1447
- _context16.next = 72;
1597
+ _context20.prev = 68;
1598
+ _context20.t4 = _context20["catch"](14);
1599
+ if (!(_context20.t4.status && _context20.t4.status.toString() === "404")) {
1600
+ _context20.next = 72;
1448
1601
  break;
1449
1602
  }
1450
- return _context16.abrupt("return", {
1603
+ return _context20.abrupt("return", {
1451
1604
  paging: {
1452
1605
  start: params.start,
1453
1606
  limit: params.limit,
@@ -1457,12 +1610,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
1457
1610
  results: []
1458
1611
  });
1459
1612
  case 72:
1460
- throw _context16.t4;
1613
+ throw _context20.t4;
1461
1614
  case 73:
1462
1615
  case "end":
1463
- return _context16.stop();
1616
+ return _context20.stop();
1464
1617
  }
1465
- }, _callee16, this, [[14, 68]]);
1618
+ }, _callee20, this, [[14, 68]]);
1466
1619
  }));
1467
1620
  function FilteredQuery() {
1468
1621
  return _FilteredQuery.apply(this, arguments);
@@ -1472,26 +1625,26 @@ var ElvWalletClient = /*#__PURE__*/function () {
1472
1625
  }, {
1473
1626
  key: "MintingStatus",
1474
1627
  value: function () {
1475
- var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref18) {
1628
+ var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
1476
1629
  var marketplaceParams, tenantId, marketplaceInfo, response;
1477
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1478
- while (1) switch (_context17.prev = _context17.next) {
1630
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1631
+ while (1) switch (_context21.prev = _context21.next) {
1479
1632
  case 0:
1480
- marketplaceParams = _ref18.marketplaceParams, tenantId = _ref18.tenantId;
1633
+ marketplaceParams = _ref22.marketplaceParams, tenantId = _ref22.tenantId;
1481
1634
  if (tenantId) {
1482
- _context17.next = 6;
1635
+ _context21.next = 6;
1483
1636
  break;
1484
1637
  }
1485
- _context17.next = 4;
1638
+ _context21.next = 4;
1486
1639
  return this.MarketplaceInfo({
1487
1640
  marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
1488
1641
  });
1489
1642
  case 4:
1490
- marketplaceInfo = _context17.sent;
1643
+ marketplaceInfo = _context21.sent;
1491
1644
  tenantId = marketplaceInfo.tenantId;
1492
1645
  case 6:
1493
- _context17.prev = 6;
1494
- _context17.next = 9;
1646
+ _context21.prev = 6;
1647
+ _context21.next = 9;
1495
1648
  return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
1496
1649
  path: UrlJoin("as", "wlt", "status", "act", tenantId),
1497
1650
  method: "GET",
@@ -1500,8 +1653,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
1500
1653
  }
1501
1654
  }));
1502
1655
  case 9:
1503
- response = _context17.sent;
1504
- return _context17.abrupt("return", response.map(function (status) {
1656
+ response = _context21.sent;
1657
+ return _context21.abrupt("return", response.map(function (status) {
1505
1658
  var _status$op$split = status.op.split(":"),
1506
1659
  _status$op$split2 = _slicedToArray(_status$op$split, 3),
1507
1660
  op = _status$op$split2[0],
@@ -1539,17 +1692,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
1539
1692
  return a.ts < b.ts ? 1 : -1;
1540
1693
  }));
1541
1694
  case 13:
1542
- _context17.prev = 13;
1543
- _context17.t0 = _context17["catch"](6);
1544
- this.Log("Failed to retrieve minting status", true, _context17.t0);
1545
- return _context17.abrupt("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", []);
1546
1699
  case 17:
1547
1700
  case "end":
1548
- return _context17.stop();
1701
+ return _context21.stop();
1549
1702
  }
1550
- }, _callee17, this, [[6, 13]]);
1703
+ }, _callee21, this, [[6, 13]]);
1551
1704
  }));
1552
- function MintingStatus(_x20) {
1705
+ function MintingStatus(_x23) {
1553
1706
  return _MintingStatus.apply(this, arguments);
1554
1707
  }
1555
1708
  return MintingStatus;
@@ -1590,48 +1743,48 @@ var ElvWalletClient = /*#__PURE__*/function () {
1590
1743
  }, {
1591
1744
  key: "Initialize",
1592
1745
  value: function () {
1593
- var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref19) {
1594
- var client, _ref19$appId, appId, _ref19$network, network, _ref19$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref19$storeAuthToken, storeAuthToken, _ref19$skipMarketplac, skipMarketplaceLoad, _ref20, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
1595
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1596
- while (1) switch (_context18.prev = _context18.next) {
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) {
1597
1750
  case 0:
1598
- client = _ref19.client, _ref19$appId = _ref19.appId, appId = _ref19$appId === void 0 ? "general" : _ref19$appId, _ref19$network = _ref19.network, network = _ref19$network === void 0 ? "main" : _ref19$network, _ref19$mode = _ref19.mode, mode = _ref19$mode === void 0 ? "production" : _ref19$mode, localization = _ref19.localization, marketplaceParams = _ref19.marketplaceParams, previewMarketplaceId = _ref19.previewMarketplaceId, _ref19$storeAuthToken = _ref19.storeAuthToken, storeAuthToken = _ref19$storeAuthToken === void 0 ? true : _ref19$storeAuthToken, _ref19$skipMarketplac = _ref19.skipMarketplaceLoad, skipMarketplaceLoad = _ref19$skipMarketplac === void 0 ? false : _ref19$skipMarketplac;
1599
- _ref20 = marketplaceParams || {}, tenantSlug = _ref20.tenantSlug, marketplaceSlug = _ref20.marketplaceSlug, marketplaceId = _ref20.marketplaceId, marketplaceHash = _ref20.marketplaceHash;
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;
1600
1753
  if (Configuration[network]) {
1601
- _context18.next = 6;
1754
+ _context22.next = 6;
1602
1755
  break;
1603
1756
  }
1604
1757
  throw Error("ElvWalletClient: Invalid network ".concat(network));
1605
1758
  case 6:
1606
1759
  if (Configuration[network][mode]) {
1607
- _context18.next = 8;
1760
+ _context22.next = 8;
1608
1761
  break;
1609
1762
  }
1610
1763
  throw Error("ElvWalletClient: Invalid mode ".concat(mode));
1611
1764
  case 8:
1612
1765
  if (client) {
1613
- _context18.next = 12;
1766
+ _context22.next = 12;
1614
1767
  break;
1615
1768
  }
1616
- _context18.next = 11;
1769
+ _context22.next = 11;
1617
1770
  return ElvClient.FromNetworkName({
1618
1771
  networkName: network,
1619
1772
  assumeV3: true
1620
1773
  });
1621
1774
  case 11:
1622
- client = _context18.sent;
1775
+ client = _context22.sent;
1623
1776
  case 12:
1624
1777
  previewMarketplaceHash = previewMarketplaceId;
1625
1778
  if (!(previewMarketplaceHash && !previewMarketplaceHash.startsWith("hq__"))) {
1626
- _context18.next = 17;
1779
+ _context22.next = 17;
1627
1780
  break;
1628
1781
  }
1629
- _context18.next = 16;
1782
+ _context22.next = 16;
1630
1783
  return client.LatestVersionHash({
1631
1784
  objectId: previewMarketplaceId
1632
1785
  });
1633
1786
  case 16:
1634
- previewMarketplaceHash = _context18.sent;
1787
+ previewMarketplaceHash = _context22.sent;
1635
1788
  case 17:
1636
1789
  walletClient = new ElvWalletClient({
1637
1790
  appId: appId,
@@ -1649,61 +1802,61 @@ var ElvWalletClient = /*#__PURE__*/function () {
1649
1802
  storeAuthToken: storeAuthToken
1650
1803
  });
1651
1804
  if (!(inBrowser && window.location && window.location.href)) {
1652
- _context18.next = 37;
1805
+ _context22.next = 37;
1653
1806
  break;
1654
1807
  }
1655
1808
  url = new URL(window.location.href);
1656
1809
  if (!url.searchParams.get("elvToken")) {
1657
- _context18.next = 27;
1810
+ _context22.next = 27;
1658
1811
  break;
1659
1812
  }
1660
- _context18.next = 23;
1813
+ _context22.next = 23;
1661
1814
  return walletClient.Authenticate({
1662
1815
  token: url.searchParams.get("elvToken")
1663
1816
  });
1664
1817
  case 23:
1665
1818
  url.searchParams["delete"]("elvToken");
1666
1819
  window.history.replaceState("", "", url);
1667
- _context18.next = 37;
1820
+ _context22.next = 37;
1668
1821
  break;
1669
1822
  case 27:
1670
1823
  if (!(storeAuthToken && localStorageAvailable)) {
1671
- _context18.next = 37;
1824
+ _context22.next = 37;
1672
1825
  break;
1673
1826
  }
1674
- _context18.prev = 28;
1827
+ _context22.prev = 28;
1675
1828
  // Load saved auth token
1676
1829
  savedToken = localStorage.getItem("__elv-token-".concat(network));
1677
1830
  if (!savedToken) {
1678
- _context18.next = 33;
1831
+ _context22.next = 33;
1679
1832
  break;
1680
1833
  }
1681
- _context18.next = 33;
1834
+ _context22.next = 33;
1682
1835
  return walletClient.Authenticate({
1683
1836
  token: savedToken
1684
1837
  });
1685
1838
  case 33:
1686
- _context18.next = 37;
1839
+ _context22.next = 37;
1687
1840
  break;
1688
1841
  case 35:
1689
- _context18.prev = 35;
1690
- _context18.t0 = _context18["catch"](28);
1842
+ _context22.prev = 35;
1843
+ _context22.t0 = _context22["catch"](28);
1691
1844
  case 37:
1692
1845
  if (skipMarketplaceLoad) {
1693
- _context18.next = 40;
1846
+ _context22.next = 40;
1694
1847
  break;
1695
1848
  }
1696
- _context18.next = 40;
1849
+ _context22.next = 40;
1697
1850
  return walletClient.LoadAvailableMarketplaces();
1698
1851
  case 40:
1699
- return _context18.abrupt("return", walletClient);
1852
+ return _context22.abrupt("return", walletClient);
1700
1853
  case 41:
1701
1854
  case "end":
1702
- return _context18.stop();
1855
+ return _context22.stop();
1703
1856
  }
1704
- }, _callee18, null, [[28, 35]]);
1857
+ }, _callee22, null, [[28, 35]]);
1705
1858
  }));
1706
- function Initialize(_x21) {
1859
+ function Initialize(_x24) {
1707
1860
  return _Initialize.apply(this, arguments);
1708
1861
  }
1709
1862
  return Initialize;