@eluvio/elv-client-js 4.0.86 → 4.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +10 -10
- package/dist/ElvClient-node-min.js +11 -11
- package/dist/ElvFrameClient-min.js +7 -7
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +11 -11
- package/dist/ElvWalletClient-node-min.js +11 -11
- package/dist/src/ContentObjectAudit.js +163 -0
- package/dist/src/ElvClient.js +422 -444
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/HttpClient.js +70 -9
- package/dist/src/RemoteSigner.js +162 -57
- package/dist/src/Validation.js +6 -2
- package/dist/src/abr_profiles/abr_profile_live_to_vod.js +7 -0
- package/dist/src/client/ContentAccess.js +834 -770
- package/dist/src/client/ContentManagement.js +55 -3
- package/dist/src/client/Files.js +9 -6
- package/dist/src/client/LiveConf.js +144 -35
- package/dist/src/client/LiveStream.js +1104 -531
- package/dist/src/walletClient/index.js +366 -279
- package/package.json +1 -1
- package/src/ContentObjectAudit.js +98 -0
- package/src/ElvClient.js +7 -3
- package/src/FrameClient.js +2 -1
- package/src/HttpClient.js +36 -4
- package/src/Validation.js +5 -2
- package/src/client/ContentAccess.js +13 -10
- package/src/client/Files.js +7 -5
- package/src/client/LiveConf.js +11 -11
- package/src/client/LiveStream.js +29 -2
- package/src/ContentObjectVerification.js +0 -210
|
@@ -463,20 +463,80 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
463
463
|
*/
|
|
464
464
|
}, {
|
|
465
465
|
key: "LogOut",
|
|
466
|
-
value: function
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
466
|
+
value: function () {
|
|
467
|
+
var _LogOut = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
468
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
469
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
470
|
+
case 0:
|
|
471
|
+
if (!this.__authorization.nonce) {
|
|
472
|
+
_context8.next = 9;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
_context8.prev = 1;
|
|
476
|
+
_context8.next = 4;
|
|
477
|
+
return this.client.signer.ReleaseCSAT({
|
|
478
|
+
accessToken: this.AuthToken()
|
|
479
|
+
});
|
|
480
|
+
case 4:
|
|
481
|
+
_context8.next = 9;
|
|
482
|
+
break;
|
|
483
|
+
case 6:
|
|
484
|
+
_context8.prev = 6;
|
|
485
|
+
_context8.t0 = _context8["catch"](1);
|
|
486
|
+
this.Log("Failed to release token", true, _context8.t0);
|
|
487
|
+
case 9:
|
|
488
|
+
this.__authorization = {};
|
|
489
|
+
this.loggedIn = false;
|
|
490
|
+
this.cachedMarketplaces = {};
|
|
470
491
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
492
|
+
// Delete saved auth token
|
|
493
|
+
if (localStorageAvailable) {
|
|
494
|
+
try {
|
|
495
|
+
localStorage.removeItem("__elv-token-".concat(this.network));
|
|
496
|
+
// eslint-disable-next-line no-empty
|
|
497
|
+
} catch (error) {}
|
|
498
|
+
}
|
|
499
|
+
case 13:
|
|
500
|
+
case "end":
|
|
501
|
+
return _context8.stop();
|
|
502
|
+
}
|
|
503
|
+
}, _callee8, this, [[1, 6]]);
|
|
504
|
+
}));
|
|
505
|
+
function LogOut() {
|
|
506
|
+
return _LogOut.apply(this, arguments);
|
|
477
507
|
}
|
|
478
|
-
|
|
479
|
-
|
|
508
|
+
return LogOut;
|
|
509
|
+
}()
|
|
510
|
+
}, {
|
|
511
|
+
key: "TokenStatus",
|
|
512
|
+
value: function () {
|
|
513
|
+
var _TokenStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
514
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
515
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
if (!(!this.__authorization || !this.__authorization.nonce)) {
|
|
518
|
+
_context9.next = 2;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
return _context9.abrupt("return", true);
|
|
522
|
+
case 2:
|
|
523
|
+
_context9.next = 4;
|
|
524
|
+
return this.client.signer.CSATStatus({
|
|
525
|
+
accessToken: this.AuthToken()
|
|
526
|
+
});
|
|
527
|
+
case 4:
|
|
528
|
+
return _context9.abrupt("return", _context9.sent);
|
|
529
|
+
case 5:
|
|
530
|
+
case "end":
|
|
531
|
+
return _context9.stop();
|
|
532
|
+
}
|
|
533
|
+
}, _callee9, this);
|
|
534
|
+
}));
|
|
535
|
+
function TokenStatus() {
|
|
536
|
+
return _TokenStatus.apply(this, arguments);
|
|
537
|
+
}
|
|
538
|
+
return TokenStatus;
|
|
539
|
+
}()
|
|
480
540
|
/**
|
|
481
541
|
* Authenticate with an ElvWalletClient authorization token
|
|
482
542
|
*
|
|
@@ -487,32 +547,32 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
487
547
|
}, {
|
|
488
548
|
key: "Authenticate",
|
|
489
549
|
value: function () {
|
|
490
|
-
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
550
|
+
var _Authenticate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref7) {
|
|
491
551
|
var token, decodedToken;
|
|
492
|
-
return _regeneratorRuntime.wrap(function
|
|
493
|
-
while (1) switch (
|
|
552
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
553
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
494
554
|
case 0:
|
|
495
555
|
token = _ref7.token;
|
|
496
|
-
|
|
556
|
+
_context10.prev = 1;
|
|
497
557
|
decodedToken = JSON.parse(this.utils.FromB58ToStr(token)) || {};
|
|
498
|
-
|
|
558
|
+
_context10.next = 8;
|
|
499
559
|
break;
|
|
500
560
|
case 5:
|
|
501
|
-
|
|
502
|
-
|
|
561
|
+
_context10.prev = 5;
|
|
562
|
+
_context10.t0 = _context10["catch"](1);
|
|
503
563
|
throw new Error("Invalid authorization token " + token);
|
|
504
564
|
case 8:
|
|
505
565
|
if (!(!decodedToken.expiresAt || Date.now() > decodedToken.expiresAt)) {
|
|
506
|
-
|
|
566
|
+
_context10.next = 10;
|
|
507
567
|
break;
|
|
508
568
|
}
|
|
509
569
|
throw Error("ElvWalletClient: Provided authorization token has expired");
|
|
510
570
|
case 10:
|
|
511
571
|
if (!decodedToken.clusterToken) {
|
|
512
|
-
|
|
572
|
+
_context10.next = 13;
|
|
513
573
|
break;
|
|
514
574
|
}
|
|
515
|
-
|
|
575
|
+
_context10.next = 13;
|
|
516
576
|
return this.client.SetRemoteSigner({
|
|
517
577
|
authToken: decodedToken.clusterToken,
|
|
518
578
|
signerURIs: decodedToken.signerURIs
|
|
@@ -521,12 +581,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
521
581
|
this.client.SetStaticToken({
|
|
522
582
|
token: decodedToken.fabricToken
|
|
523
583
|
});
|
|
524
|
-
return
|
|
584
|
+
return _context10.abrupt("return", this.SetAuthorization(_objectSpread({}, decodedToken)));
|
|
525
585
|
case 15:
|
|
526
586
|
case "end":
|
|
527
|
-
return
|
|
587
|
+
return _context10.stop();
|
|
528
588
|
}
|
|
529
|
-
},
|
|
589
|
+
}, _callee10, this, [[1, 5]]);
|
|
530
590
|
}));
|
|
531
591
|
function Authenticate(_x12) {
|
|
532
592
|
return _Authenticate.apply(this, arguments);
|
|
@@ -555,60 +615,83 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
555
615
|
}, {
|
|
556
616
|
key: "AuthenticateOAuth",
|
|
557
617
|
value: function () {
|
|
558
|
-
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
559
|
-
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, tokenDuration, expiresAt,
|
|
560
|
-
return _regeneratorRuntime.wrap(function
|
|
561
|
-
while (1) switch (
|
|
618
|
+
var _AuthenticateOAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref8) {
|
|
619
|
+
var idToken, tenantId, email, signerURIs, _ref8$shareEmail, shareEmail, _ref8$extraData, extraData, nonce, _ref8$createRemoteTok, createRemoteToken, _ref8$force, force, tokenDuration, fabricToken, expiresAt, tokenResponse, address, decodedToken;
|
|
620
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
621
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
562
622
|
case 0:
|
|
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;
|
|
623
|
+
idToken = _ref8.idToken, tenantId = _ref8.tenantId, email = _ref8.email, signerURIs = _ref8.signerURIs, _ref8$shareEmail = _ref8.shareEmail, shareEmail = _ref8$shareEmail === void 0 ? false : _ref8$shareEmail, _ref8$extraData = _ref8.extraData, extraData = _ref8$extraData === void 0 ? {} : _ref8$extraData, nonce = _ref8.nonce, _ref8$createRemoteTok = _ref8.createRemoteToken, createRemoteToken = _ref8$createRemoteTok === void 0 ? true : _ref8$createRemoteTok, _ref8$force = _ref8.force, force = _ref8$force === void 0 ? false : _ref8$force;
|
|
564
624
|
tokenDuration = 24;
|
|
565
625
|
if (!(!tenantId && this.selectedMarketplaceInfo)) {
|
|
566
|
-
|
|
626
|
+
_context11.next = 6;
|
|
567
627
|
break;
|
|
568
628
|
}
|
|
569
|
-
|
|
629
|
+
_context11.next = 5;
|
|
570
630
|
return this.AvailableMarketplaces();
|
|
571
631
|
case 5:
|
|
572
632
|
tenantId = this.selectedMarketplaceInfo.tenantId;
|
|
573
633
|
case 6:
|
|
574
|
-
|
|
634
|
+
_context11.next = 8;
|
|
575
635
|
return this.client.SetRemoteSigner({
|
|
576
636
|
idToken: idToken,
|
|
577
637
|
tenantId: tenantId,
|
|
578
638
|
signerURIs: signerURIs,
|
|
579
|
-
extraData: {
|
|
639
|
+
extraData: _objectSpread(_objectSpread({}, extraData), {}, {
|
|
580
640
|
share_email: shareEmail
|
|
581
|
-
},
|
|
641
|
+
}),
|
|
582
642
|
unsignedPublicAuth: true
|
|
583
643
|
});
|
|
584
644
|
case 8:
|
|
645
|
+
if (!(createRemoteToken && this.client.signer.remoteSigner)) {
|
|
646
|
+
_context11.next = 17;
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
expiresAt = Date.now() + 24 * 60 * 60 * 1000;
|
|
650
|
+
_context11.next = 12;
|
|
651
|
+
return this.client.signer.RetrieveCSAT({
|
|
652
|
+
email: email,
|
|
653
|
+
nonce: nonce,
|
|
654
|
+
force: force
|
|
655
|
+
});
|
|
656
|
+
case 12:
|
|
657
|
+
tokenResponse = _context11.sent;
|
|
658
|
+
fabricToken = tokenResponse.token;
|
|
659
|
+
nonce = tokenResponse.nonce;
|
|
660
|
+
_context11.next = 21;
|
|
661
|
+
break;
|
|
662
|
+
case 17:
|
|
585
663
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
586
|
-
|
|
664
|
+
_context11.next = 20;
|
|
587
665
|
return this.client.CreateFabricToken({
|
|
588
|
-
duration: tokenDuration * 60 * 60 * 1000
|
|
589
|
-
|
|
666
|
+
duration: tokenDuration * 60 * 60 * 1000,
|
|
667
|
+
context: email ? {
|
|
668
|
+
usr: {
|
|
669
|
+
email: email
|
|
670
|
+
}
|
|
671
|
+
} : {}
|
|
590
672
|
});
|
|
591
|
-
case
|
|
592
|
-
fabricToken =
|
|
673
|
+
case 20:
|
|
674
|
+
fabricToken = _context11.sent;
|
|
675
|
+
case 21:
|
|
593
676
|
address = this.client.utils.FormatAddress(this.client.CurrentAccountAddress());
|
|
594
677
|
if (email) {
|
|
595
|
-
|
|
678
|
+
_context11.next = 31;
|
|
596
679
|
break;
|
|
597
680
|
}
|
|
598
|
-
|
|
681
|
+
_context11.prev = 23;
|
|
599
682
|
decodedToken = JSON.parse(this.utils.FromB64URL(idToken.split(".")[1]));
|
|
600
683
|
email = decodedToken.email;
|
|
601
|
-
|
|
684
|
+
_context11.next = 31;
|
|
602
685
|
break;
|
|
603
|
-
case
|
|
604
|
-
|
|
605
|
-
|
|
686
|
+
case 28:
|
|
687
|
+
_context11.prev = 28;
|
|
688
|
+
_context11.t0 = _context11["catch"](23);
|
|
606
689
|
throw Error("Failed to decode ID token");
|
|
607
|
-
case
|
|
690
|
+
case 31:
|
|
608
691
|
this.client.SetStaticToken({
|
|
609
692
|
token: fabricToken
|
|
610
693
|
});
|
|
611
|
-
return
|
|
694
|
+
return _context11.abrupt("return", {
|
|
612
695
|
authToken: this.SetAuthorization({
|
|
613
696
|
fabricToken: fabricToken,
|
|
614
697
|
tenantId: tenantId,
|
|
@@ -618,7 +701,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
618
701
|
signerURIs: signerURIs,
|
|
619
702
|
walletType: "Custodial",
|
|
620
703
|
walletName: "Eluvio",
|
|
621
|
-
register: true
|
|
704
|
+
register: true,
|
|
705
|
+
nonce: nonce
|
|
622
706
|
}),
|
|
623
707
|
signingToken: this.SetAuthorization({
|
|
624
708
|
clusterToken: this.client.signer.authToken,
|
|
@@ -629,14 +713,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
629
713
|
expiresAt: expiresAt,
|
|
630
714
|
signerURIs: signerURIs,
|
|
631
715
|
walletType: "Custodial",
|
|
632
|
-
walletName: "Eluvio"
|
|
716
|
+
walletName: "Eluvio",
|
|
717
|
+
nonce: nonce
|
|
633
718
|
})
|
|
634
719
|
});
|
|
635
|
-
case
|
|
720
|
+
case 33:
|
|
636
721
|
case "end":
|
|
637
|
-
return
|
|
722
|
+
return _context11.stop();
|
|
638
723
|
}
|
|
639
|
-
},
|
|
724
|
+
}, _callee11, this, [[23, 28]]);
|
|
640
725
|
}));
|
|
641
726
|
function AuthenticateOAuth(_x13) {
|
|
642
727
|
return _AuthenticateOAuth.apply(this, arguments);
|
|
@@ -659,11 +744,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
659
744
|
}, {
|
|
660
745
|
key: "AuthenticateExternalWallet",
|
|
661
746
|
value: function () {
|
|
662
|
-
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
747
|
+
var _AuthenticateExternalWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref9) {
|
|
663
748
|
var _this2 = this;
|
|
664
749
|
var address, _ref9$tokenDuration, tokenDuration, _ref9$walletName, walletName, Sign, expiresAt, fabricToken;
|
|
665
|
-
return _regeneratorRuntime.wrap(function
|
|
666
|
-
while (1) switch (
|
|
750
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
751
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
667
752
|
case 0:
|
|
668
753
|
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;
|
|
669
754
|
if (!address) {
|
|
@@ -672,19 +757,19 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
672
757
|
address = this.utils.FormatAddress(address);
|
|
673
758
|
if (!Sign) {
|
|
674
759
|
Sign = /*#__PURE__*/function () {
|
|
675
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
676
|
-
return _regeneratorRuntime.wrap(function
|
|
677
|
-
while (1) switch (
|
|
760
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(message) {
|
|
761
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
762
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
678
763
|
case 0:
|
|
679
|
-
return
|
|
764
|
+
return _context12.abrupt("return", _this2.SignMetamask({
|
|
680
765
|
message: message,
|
|
681
766
|
address: address
|
|
682
767
|
}));
|
|
683
768
|
case 1:
|
|
684
769
|
case "end":
|
|
685
|
-
return
|
|
770
|
+
return _context12.stop();
|
|
686
771
|
}
|
|
687
|
-
},
|
|
772
|
+
}, _callee12);
|
|
688
773
|
}));
|
|
689
774
|
return function Sign(_x15) {
|
|
690
775
|
return _ref10.apply(this, arguments);
|
|
@@ -692,7 +777,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
692
777
|
}();
|
|
693
778
|
}
|
|
694
779
|
expiresAt = Date.now() + tokenDuration * 60 * 60 * 1000;
|
|
695
|
-
|
|
780
|
+
_context13.next = 7;
|
|
696
781
|
return this.client.CreateFabricToken({
|
|
697
782
|
address: address,
|
|
698
783
|
duration: tokenDuration * 60 * 60 * 1000,
|
|
@@ -700,8 +785,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
700
785
|
addEthereumPrefix: false
|
|
701
786
|
});
|
|
702
787
|
case 7:
|
|
703
|
-
fabricToken =
|
|
704
|
-
return
|
|
788
|
+
fabricToken = _context13.sent;
|
|
789
|
+
return _context13.abrupt("return", this.SetAuthorization({
|
|
705
790
|
fabricToken: fabricToken,
|
|
706
791
|
address: address,
|
|
707
792
|
expiresAt: expiresAt,
|
|
@@ -711,9 +796,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
711
796
|
}));
|
|
712
797
|
case 9:
|
|
713
798
|
case "end":
|
|
714
|
-
return
|
|
799
|
+
return _context13.stop();
|
|
715
800
|
}
|
|
716
|
-
},
|
|
801
|
+
}, _callee13, this);
|
|
717
802
|
}));
|
|
718
803
|
function AuthenticateExternalWallet(_x14) {
|
|
719
804
|
return _AuthenticateExternalWallet.apply(this, arguments);
|
|
@@ -756,6 +841,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
756
841
|
signerURIs = _ref11.signerURIs,
|
|
757
842
|
walletType = _ref11.walletType,
|
|
758
843
|
walletName = _ref11.walletName,
|
|
844
|
+
nonce = _ref11.nonce,
|
|
759
845
|
_ref11$register = _ref11.register,
|
|
760
846
|
register = _ref11$register === void 0 ? false : _ref11$register;
|
|
761
847
|
address = this.client.utils.FormatAddress(address);
|
|
@@ -766,7 +852,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
766
852
|
email: email,
|
|
767
853
|
expiresAt: expiresAt,
|
|
768
854
|
walletType: walletType,
|
|
769
|
-
walletName: walletName
|
|
855
|
+
walletName: walletName,
|
|
856
|
+
nonce: nonce
|
|
770
857
|
};
|
|
771
858
|
if (clusterToken) {
|
|
772
859
|
this.__authorization.clusterToken = clusterToken;
|
|
@@ -799,43 +886,43 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
799
886
|
}, {
|
|
800
887
|
key: "SignMetamask",
|
|
801
888
|
value: function () {
|
|
802
|
-
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
889
|
+
var _SignMetamask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref12) {
|
|
803
890
|
var message, address, accounts;
|
|
804
|
-
return _regeneratorRuntime.wrap(function
|
|
805
|
-
while (1) switch (
|
|
891
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
892
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
806
893
|
case 0:
|
|
807
894
|
message = _ref12.message, address = _ref12.address;
|
|
808
895
|
if (!(!inBrowser || !window.ethereum)) {
|
|
809
|
-
|
|
896
|
+
_context14.next = 3;
|
|
810
897
|
break;
|
|
811
898
|
}
|
|
812
899
|
throw Error("ElvWalletClient: Unable to initialize - Metamask not available");
|
|
813
900
|
case 3:
|
|
814
901
|
address = address || this.UserAddress();
|
|
815
|
-
|
|
902
|
+
_context14.next = 6;
|
|
816
903
|
return window.ethereum.request({
|
|
817
904
|
method: "eth_requestAccounts"
|
|
818
905
|
});
|
|
819
906
|
case 6:
|
|
820
|
-
accounts =
|
|
907
|
+
accounts = _context14.sent;
|
|
821
908
|
if (!(address && !Utils.EqualAddress(accounts[0], address))) {
|
|
822
|
-
|
|
909
|
+
_context14.next = 9;
|
|
823
910
|
break;
|
|
824
911
|
}
|
|
825
912
|
throw Error("ElvWalletClient: Incorrect MetaMask account selected. Expected ".concat(address, ", got ").concat(accounts[0]));
|
|
826
913
|
case 9:
|
|
827
|
-
|
|
914
|
+
_context14.next = 11;
|
|
828
915
|
return window.ethereum.request({
|
|
829
916
|
method: "personal_sign",
|
|
830
917
|
params: [message, address, ""]
|
|
831
918
|
});
|
|
832
919
|
case 11:
|
|
833
|
-
return
|
|
920
|
+
return _context14.abrupt("return", _context14.sent);
|
|
834
921
|
case 12:
|
|
835
922
|
case "end":
|
|
836
|
-
return
|
|
923
|
+
return _context14.stop();
|
|
837
924
|
}
|
|
838
|
-
},
|
|
925
|
+
}, _callee14, this);
|
|
839
926
|
}));
|
|
840
927
|
function SignMetamask(_x16) {
|
|
841
928
|
return _SignMetamask.apply(this, arguments);
|
|
@@ -863,29 +950,29 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
863
950
|
}, {
|
|
864
951
|
key: "GenerateCodeAuth",
|
|
865
952
|
value: function () {
|
|
866
|
-
var _GenerateCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
953
|
+
var _GenerateCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
867
954
|
var _ref14,
|
|
868
955
|
url,
|
|
869
956
|
response,
|
|
870
|
-
|
|
871
|
-
return _regeneratorRuntime.wrap(function
|
|
872
|
-
while (1) switch (
|
|
957
|
+
_args15 = arguments;
|
|
958
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
959
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
873
960
|
case 0:
|
|
874
|
-
_ref14 =
|
|
961
|
+
_ref14 = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {}, url = _ref14.url;
|
|
875
962
|
if (url) {
|
|
876
|
-
|
|
963
|
+
_context15.next = 7;
|
|
877
964
|
break;
|
|
878
965
|
}
|
|
879
|
-
|
|
966
|
+
_context15.next = 4;
|
|
880
967
|
return this.LogInURL({
|
|
881
968
|
mode: "login"
|
|
882
969
|
});
|
|
883
970
|
case 4:
|
|
884
|
-
url =
|
|
971
|
+
url = _context15.sent;
|
|
885
972
|
url.searchParams.set("response", "code");
|
|
886
973
|
url.searchParams.set("source", "code");
|
|
887
974
|
case 7:
|
|
888
|
-
|
|
975
|
+
_context15.next = 9;
|
|
889
976
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
890
977
|
path: UrlJoin("as", "wlt", "login", "redirect", "metamask"),
|
|
891
978
|
method: "POST",
|
|
@@ -895,16 +982,16 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
895
982
|
}
|
|
896
983
|
}));
|
|
897
984
|
case 9:
|
|
898
|
-
response =
|
|
985
|
+
response = _context15.sent;
|
|
899
986
|
response.code = response.id;
|
|
900
987
|
response.url = response.url.startsWith("https://") ? response.url : "https://".concat(response.url);
|
|
901
988
|
response.metamask_url = response.metamask_url.startsWith("https://") ? response.metamask_url : "https://".concat(response.metamask_url);
|
|
902
|
-
return
|
|
989
|
+
return _context15.abrupt("return", response);
|
|
903
990
|
case 14:
|
|
904
991
|
case "end":
|
|
905
|
-
return
|
|
992
|
+
return _context15.stop();
|
|
906
993
|
}
|
|
907
|
-
},
|
|
994
|
+
}, _callee15, this);
|
|
908
995
|
}));
|
|
909
996
|
function GenerateCodeAuth() {
|
|
910
997
|
return _GenerateCodeAuth.apply(this, arguments);
|
|
@@ -914,13 +1001,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
914
1001
|
}, {
|
|
915
1002
|
key: "SetCodeAuth",
|
|
916
1003
|
value: function () {
|
|
917
|
-
var _SetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1004
|
+
var _SetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref15) {
|
|
918
1005
|
var code, address, type, authToken;
|
|
919
|
-
return _regeneratorRuntime.wrap(function
|
|
920
|
-
while (1) switch (
|
|
1006
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
1007
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
921
1008
|
case 0:
|
|
922
1009
|
code = _ref15.code, address = _ref15.address, type = _ref15.type, authToken = _ref15.authToken;
|
|
923
|
-
|
|
1010
|
+
_context16.next = 3;
|
|
924
1011
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
925
1012
|
path: UrlJoin("as", "wlt", "login", "session", code),
|
|
926
1013
|
method: "POST",
|
|
@@ -941,9 +1028,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
941
1028
|
}));
|
|
942
1029
|
case 3:
|
|
943
1030
|
case "end":
|
|
944
|
-
return
|
|
1031
|
+
return _context16.stop();
|
|
945
1032
|
}
|
|
946
|
-
},
|
|
1033
|
+
}, _callee16, this);
|
|
947
1034
|
}));
|
|
948
1035
|
function SetCodeAuth(_x17) {
|
|
949
1036
|
return _SetCodeAuth.apply(this, arguments);
|
|
@@ -953,35 +1040,35 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
953
1040
|
}, {
|
|
954
1041
|
key: "GetCodeAuth",
|
|
955
1042
|
value: function () {
|
|
956
|
-
var _GetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1043
|
+
var _GetCodeAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
|
|
957
1044
|
var code, passcode;
|
|
958
|
-
return _regeneratorRuntime.wrap(function
|
|
959
|
-
while (1) switch (
|
|
1045
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1046
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
960
1047
|
case 0:
|
|
961
1048
|
code = _ref16.code, passcode = _ref16.passcode;
|
|
962
|
-
|
|
963
|
-
|
|
1049
|
+
_context17.prev = 1;
|
|
1050
|
+
_context17.next = 4;
|
|
964
1051
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
965
1052
|
path: UrlJoin("as", "wlt", "login", "redirect", "metamask", code, passcode),
|
|
966
1053
|
method: "GET"
|
|
967
1054
|
}));
|
|
968
1055
|
case 4:
|
|
969
|
-
return
|
|
1056
|
+
return _context17.abrupt("return", _context17.sent);
|
|
970
1057
|
case 7:
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (!(
|
|
974
|
-
|
|
1058
|
+
_context17.prev = 7;
|
|
1059
|
+
_context17.t0 = _context17["catch"](1);
|
|
1060
|
+
if (!(_context17.t0 && _context17.t0.status === 404)) {
|
|
1061
|
+
_context17.next = 11;
|
|
975
1062
|
break;
|
|
976
1063
|
}
|
|
977
|
-
return
|
|
1064
|
+
return _context17.abrupt("return", undefined);
|
|
978
1065
|
case 11:
|
|
979
|
-
throw
|
|
1066
|
+
throw _context17.t0;
|
|
980
1067
|
case 12:
|
|
981
1068
|
case "end":
|
|
982
|
-
return
|
|
1069
|
+
return _context17.stop();
|
|
983
1070
|
}
|
|
984
|
-
},
|
|
1071
|
+
}, _callee17, this, [[1, 7]]);
|
|
985
1072
|
}));
|
|
986
1073
|
function GetCodeAuth(_x18) {
|
|
987
1074
|
return _GetCodeAuth.apply(this, arguments);
|
|
@@ -991,7 +1078,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
991
1078
|
}, {
|
|
992
1079
|
key: "LoadAvailableMarketplaces",
|
|
993
1080
|
value: function () {
|
|
994
|
-
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1081
|
+
var _LoadAvailableMarketplaces = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
995
1082
|
var _this4 = this;
|
|
996
1083
|
var forceReload,
|
|
997
1084
|
metadata,
|
|
@@ -1001,18 +1088,18 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1001
1088
|
previewMarketplaceMetadata,
|
|
1002
1089
|
availableMarketplaces,
|
|
1003
1090
|
availableMarketplacesById,
|
|
1004
|
-
|
|
1005
|
-
return _regeneratorRuntime.wrap(function
|
|
1006
|
-
while (1) switch (
|
|
1091
|
+
_args18 = arguments;
|
|
1092
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1093
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1007
1094
|
case 0:
|
|
1008
|
-
forceReload =
|
|
1095
|
+
forceReload = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : false;
|
|
1009
1096
|
if (!(!forceReload && Object.keys(this.availableMarketplaces) > 0)) {
|
|
1010
|
-
|
|
1097
|
+
_context18.next = 3;
|
|
1011
1098
|
break;
|
|
1012
1099
|
}
|
|
1013
|
-
return
|
|
1100
|
+
return _context18.abrupt("return");
|
|
1014
1101
|
case 3:
|
|
1015
|
-
|
|
1102
|
+
_context18.next = 5;
|
|
1016
1103
|
return this.client.ContentObjectMetadata({
|
|
1017
1104
|
libraryId: this.mainSiteLibraryId,
|
|
1018
1105
|
objectId: this.mainSiteId,
|
|
@@ -1028,13 +1115,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1028
1115
|
remove: ["tenants/*/info/branding/wallet_css", "tenants/*/marketplaces/*/info/branding/custom_css"]
|
|
1029
1116
|
});
|
|
1030
1117
|
case 5:
|
|
1031
|
-
metadata =
|
|
1118
|
+
metadata = _context18.sent;
|
|
1032
1119
|
marketplaceOrder = ((metadata || {}).info || {}).marketplace_order || [];
|
|
1033
1120
|
metadata = (metadata || {}).tenants || {};
|
|
1034
1121
|
|
|
1035
1122
|
// If preview marketplace is specified, load it appropriately
|
|
1036
1123
|
if (!this.previewMarketplaceId) {
|
|
1037
|
-
|
|
1124
|
+
_context18.next = 23;
|
|
1038
1125
|
break;
|
|
1039
1126
|
}
|
|
1040
1127
|
previewTenantSlug = "PREVIEW";
|
|
@@ -1057,10 +1144,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1057
1144
|
|
|
1058
1145
|
// Marketplace not present in branch, or preview version is different - Load metadata directly
|
|
1059
1146
|
if (previewMarketplaceMetadata) {
|
|
1060
|
-
|
|
1147
|
+
_context18.next = 16;
|
|
1061
1148
|
break;
|
|
1062
1149
|
}
|
|
1063
|
-
|
|
1150
|
+
_context18.next = 14;
|
|
1064
1151
|
return this.client.ContentObjectMetadata({
|
|
1065
1152
|
versionHash: this.previewMarketplaceHash,
|
|
1066
1153
|
metadataSubtree: "public/asset_metadata",
|
|
@@ -1071,7 +1158,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1071
1158
|
remove: ["info/branding/custom_css"]
|
|
1072
1159
|
});
|
|
1073
1160
|
case 14:
|
|
1074
|
-
previewMarketplaceMetadata =
|
|
1161
|
+
previewMarketplaceMetadata = _context18.sent;
|
|
1075
1162
|
if (!previewMarketplaceSlug) {
|
|
1076
1163
|
previewMarketplaceSlug = previewMarketplaceMetadata.slug;
|
|
1077
1164
|
}
|
|
@@ -1132,9 +1219,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1132
1219
|
this.availableMarketplacesById = availableMarketplacesById;
|
|
1133
1220
|
case 28:
|
|
1134
1221
|
case "end":
|
|
1135
|
-
return
|
|
1222
|
+
return _context18.stop();
|
|
1136
1223
|
}
|
|
1137
|
-
},
|
|
1224
|
+
}, _callee18, this);
|
|
1138
1225
|
}));
|
|
1139
1226
|
function LoadAvailableMarketplaces() {
|
|
1140
1227
|
return _LoadAvailableMarketplaces.apply(this, arguments);
|
|
@@ -1144,25 +1231,25 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1144
1231
|
}, {
|
|
1145
1232
|
key: "LatestMarketplaceHash",
|
|
1146
1233
|
value: function () {
|
|
1147
|
-
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1234
|
+
var _LatestMarketplaceHash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref17) {
|
|
1148
1235
|
var marketplaceParams, marketplaceInfo, marketplaceLink;
|
|
1149
|
-
return _regeneratorRuntime.wrap(function
|
|
1150
|
-
while (1) switch (
|
|
1236
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1237
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1151
1238
|
case 0:
|
|
1152
1239
|
marketplaceParams = _ref17.marketplaceParams;
|
|
1153
|
-
|
|
1240
|
+
_context19.next = 3;
|
|
1154
1241
|
return this.MarketplaceInfo({
|
|
1155
1242
|
marketplaceParams: marketplaceParams
|
|
1156
1243
|
});
|
|
1157
1244
|
case 3:
|
|
1158
|
-
marketplaceInfo =
|
|
1245
|
+
marketplaceInfo = _context19.sent;
|
|
1159
1246
|
if (!(this.previewMarketplaceId && Utils.EqualHash(this.previewMarketplaceId, marketplaceInfo.marketplaceId))) {
|
|
1160
|
-
|
|
1247
|
+
_context19.next = 6;
|
|
1161
1248
|
break;
|
|
1162
1249
|
}
|
|
1163
|
-
return
|
|
1250
|
+
return _context19.abrupt("return", this.previewMarketplaceHash);
|
|
1164
1251
|
case 6:
|
|
1165
|
-
|
|
1252
|
+
_context19.next = 8;
|
|
1166
1253
|
return this.client.ContentObjectMetadata({
|
|
1167
1254
|
libraryId: this.mainSiteLibraryId,
|
|
1168
1255
|
objectId: this.mainSiteId,
|
|
@@ -1171,13 +1258,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1171
1258
|
noAuth: true
|
|
1172
1259
|
});
|
|
1173
1260
|
case 8:
|
|
1174
|
-
marketplaceLink =
|
|
1175
|
-
return
|
|
1261
|
+
marketplaceLink = _context19.sent;
|
|
1262
|
+
return _context19.abrupt("return", LinkTargetHash(marketplaceLink));
|
|
1176
1263
|
case 10:
|
|
1177
1264
|
case "end":
|
|
1178
|
-
return
|
|
1265
|
+
return _context19.stop();
|
|
1179
1266
|
}
|
|
1180
|
-
},
|
|
1267
|
+
}, _callee19, this);
|
|
1181
1268
|
}));
|
|
1182
1269
|
function LatestMarketplaceHash(_x19) {
|
|
1183
1270
|
return _LatestMarketplaceHash.apply(this, arguments);
|
|
@@ -1187,34 +1274,34 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1187
1274
|
}, {
|
|
1188
1275
|
key: "LoadMarketplace",
|
|
1189
1276
|
value: function () {
|
|
1190
|
-
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1277
|
+
var _LoadMarketplace = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(marketplaceParams) {
|
|
1191
1278
|
var _this5 = this;
|
|
1192
1279
|
var marketplaceInfo, marketplaceId, marketplaceHash, marketplace;
|
|
1193
|
-
return _regeneratorRuntime.wrap(function
|
|
1194
|
-
while (1) switch (
|
|
1280
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1281
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1195
1282
|
case 0:
|
|
1196
1283
|
marketplaceInfo = this.MarketplaceInfo({
|
|
1197
1284
|
marketplaceParams: marketplaceParams
|
|
1198
1285
|
});
|
|
1199
1286
|
marketplaceId = marketplaceInfo.marketplaceId;
|
|
1200
|
-
|
|
1287
|
+
_context21.next = 4;
|
|
1201
1288
|
return this.LatestMarketplaceHash({
|
|
1202
1289
|
marketplaceParams: marketplaceParams
|
|
1203
1290
|
});
|
|
1204
1291
|
case 4:
|
|
1205
|
-
marketplaceHash =
|
|
1292
|
+
marketplaceHash = _context21.sent;
|
|
1206
1293
|
if (this.cachedMarketplaces[marketplaceId] && this.cachedMarketplaces[marketplaceId].versionHash !== marketplaceHash) {
|
|
1207
1294
|
delete this.cachedMarketplaces[marketplaceId];
|
|
1208
1295
|
}
|
|
1209
1296
|
if (this.cachedMarketplaces[marketplaceId]) {
|
|
1210
|
-
|
|
1297
|
+
_context21.next = 34;
|
|
1211
1298
|
break;
|
|
1212
1299
|
}
|
|
1213
1300
|
if (!(this.previewMarketplaceId && Utils.EqualHash(marketplaceId, this.previewMarketplaceId))) {
|
|
1214
|
-
|
|
1301
|
+
_context21.next = 13;
|
|
1215
1302
|
break;
|
|
1216
1303
|
}
|
|
1217
|
-
|
|
1304
|
+
_context21.next = 10;
|
|
1218
1305
|
return this.client.ContentObjectMetadata({
|
|
1219
1306
|
versionHash: this.previewMarketplaceHash,
|
|
1220
1307
|
metadataSubtree: "/public/asset_metadata/info",
|
|
@@ -1227,11 +1314,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1227
1314
|
authorizationToken: this.publicStaticToken
|
|
1228
1315
|
});
|
|
1229
1316
|
case 10:
|
|
1230
|
-
marketplace =
|
|
1231
|
-
|
|
1317
|
+
marketplace = _context21.sent;
|
|
1318
|
+
_context21.next = 16;
|
|
1232
1319
|
break;
|
|
1233
1320
|
case 13:
|
|
1234
|
-
|
|
1321
|
+
_context21.next = 15;
|
|
1235
1322
|
return this.client.ContentObjectMetadata({
|
|
1236
1323
|
libraryId: this.mainSiteLibraryId,
|
|
1237
1324
|
objectId: this.mainSiteId,
|
|
@@ -1245,13 +1332,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1245
1332
|
authorizationToken: this.publicStaticToken
|
|
1246
1333
|
});
|
|
1247
1334
|
case 15:
|
|
1248
|
-
marketplace =
|
|
1335
|
+
marketplace = _context21.sent;
|
|
1249
1336
|
case 16:
|
|
1250
1337
|
if (!marketplace.branding.use_tenant_styling) {
|
|
1251
|
-
|
|
1338
|
+
_context21.next = 23;
|
|
1252
1339
|
break;
|
|
1253
1340
|
}
|
|
1254
|
-
|
|
1341
|
+
_context21.next = 19;
|
|
1255
1342
|
return this.client.ContentObjectMetadata({
|
|
1256
1343
|
libraryId: this.mainSiteLibraryId,
|
|
1257
1344
|
objectId: this.mainSiteId,
|
|
@@ -1260,37 +1347,37 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1260
1347
|
produceLinkUrls: true
|
|
1261
1348
|
});
|
|
1262
1349
|
case 19:
|
|
1263
|
-
|
|
1264
|
-
if (
|
|
1265
|
-
|
|
1350
|
+
_context21.t0 = _context21.sent;
|
|
1351
|
+
if (_context21.t0) {
|
|
1352
|
+
_context21.next = 22;
|
|
1266
1353
|
break;
|
|
1267
1354
|
}
|
|
1268
|
-
|
|
1355
|
+
_context21.t0 = {};
|
|
1269
1356
|
case 22:
|
|
1270
|
-
marketplace.tenantBranding =
|
|
1357
|
+
marketplace.tenantBranding = _context21.t0;
|
|
1271
1358
|
case 23:
|
|
1272
|
-
|
|
1359
|
+
_context21.next = 25;
|
|
1273
1360
|
return Promise.all(marketplace.items.map( /*#__PURE__*/function () {
|
|
1274
|
-
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1361
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(item, index) {
|
|
1275
1362
|
var authorizationToken;
|
|
1276
|
-
return _regeneratorRuntime.wrap(function
|
|
1277
|
-
while (1) switch (
|
|
1363
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1364
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1278
1365
|
case 0:
|
|
1279
1366
|
if (!item.requires_permissions) {
|
|
1280
|
-
|
|
1367
|
+
_context20.next = 14;
|
|
1281
1368
|
break;
|
|
1282
1369
|
}
|
|
1283
1370
|
if (_this5.loggedIn) {
|
|
1284
|
-
|
|
1371
|
+
_context20.next = 5;
|
|
1285
1372
|
break;
|
|
1286
1373
|
}
|
|
1287
|
-
|
|
1374
|
+
_context20.next = 4;
|
|
1288
1375
|
return _this5.client.CreateFabricToken({});
|
|
1289
1376
|
case 4:
|
|
1290
|
-
authorizationToken =
|
|
1377
|
+
authorizationToken = _context20.sent;
|
|
1291
1378
|
case 5:
|
|
1292
|
-
|
|
1293
|
-
|
|
1379
|
+
_context20.prev = 5;
|
|
1380
|
+
_context20.next = 8;
|
|
1294
1381
|
return _this5.client.ContentObjectMetadata({
|
|
1295
1382
|
versionHash: LinkTargetHash(item.nft_template),
|
|
1296
1383
|
metadataSubtree: "permissioned",
|
|
@@ -1298,29 +1385,29 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1298
1385
|
});
|
|
1299
1386
|
case 8:
|
|
1300
1387
|
item.authorized = true;
|
|
1301
|
-
|
|
1388
|
+
_context20.next = 14;
|
|
1302
1389
|
break;
|
|
1303
1390
|
case 11:
|
|
1304
|
-
|
|
1305
|
-
|
|
1391
|
+
_context20.prev = 11;
|
|
1392
|
+
_context20.t0 = _context20["catch"](5);
|
|
1306
1393
|
item.authorized = false;
|
|
1307
1394
|
case 14:
|
|
1308
1395
|
item.nftTemplateMetadata = (item.nft_template || {}).nft || {};
|
|
1309
1396
|
item.nftTemplateHash = ((item.nft_template || {})["."] || {}).source;
|
|
1310
1397
|
item.itemIndex = index;
|
|
1311
|
-
return
|
|
1398
|
+
return _context20.abrupt("return", item);
|
|
1312
1399
|
case 18:
|
|
1313
1400
|
case "end":
|
|
1314
|
-
return
|
|
1401
|
+
return _context20.stop();
|
|
1315
1402
|
}
|
|
1316
|
-
},
|
|
1403
|
+
}, _callee20, null, [[5, 11]]);
|
|
1317
1404
|
}));
|
|
1318
1405
|
return function (_x21, _x22) {
|
|
1319
1406
|
return _ref18.apply(this, arguments);
|
|
1320
1407
|
};
|
|
1321
1408
|
}()));
|
|
1322
1409
|
case 25:
|
|
1323
|
-
marketplace.items =
|
|
1410
|
+
marketplace.items = _context21.sent;
|
|
1324
1411
|
marketplace.collections = (marketplace.collections || []).map(function (collection, collectionIndex) {
|
|
1325
1412
|
return _objectSpread(_objectSpread({}, collection), {}, {
|
|
1326
1413
|
collectionIndex: collectionIndex
|
|
@@ -1356,12 +1443,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1356
1443
|
});
|
|
1357
1444
|
this.cachedMarketplaces[marketplaceId] = marketplace;
|
|
1358
1445
|
case 34:
|
|
1359
|
-
return
|
|
1446
|
+
return _context21.abrupt("return", this.cachedMarketplaces[marketplaceId]);
|
|
1360
1447
|
case 35:
|
|
1361
1448
|
case "end":
|
|
1362
|
-
return
|
|
1449
|
+
return _context21.stop();
|
|
1363
1450
|
}
|
|
1364
|
-
},
|
|
1451
|
+
}, _callee21, this);
|
|
1365
1452
|
}));
|
|
1366
1453
|
function LoadMarketplace(_x20) {
|
|
1367
1454
|
return _LoadMarketplace.apply(this, arguments);
|
|
@@ -1371,7 +1458,7 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1371
1458
|
}, {
|
|
1372
1459
|
key: "FilteredQuery",
|
|
1373
1460
|
value: function () {
|
|
1374
|
-
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1461
|
+
var _FilteredQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
1375
1462
|
var _this6 = this;
|
|
1376
1463
|
var _ref19,
|
|
1377
1464
|
_ref19$mode,
|
|
@@ -1414,11 +1501,11 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1414
1501
|
contents,
|
|
1415
1502
|
paging,
|
|
1416
1503
|
modesToFormat,
|
|
1417
|
-
|
|
1418
|
-
return _regeneratorRuntime.wrap(function
|
|
1419
|
-
while (1) switch (
|
|
1504
|
+
_args22 = arguments;
|
|
1505
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1506
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1420
1507
|
case 0:
|
|
1421
|
-
_ref19 =
|
|
1508
|
+
_ref19 = _args22.length > 0 && _args22[0] !== undefined ? _args22[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, startTime = _ref19.startTime, endTime = _ref19.endTime, _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;
|
|
1422
1509
|
collectionIndexes = (collectionIndexes || []).map(function (i) {
|
|
1423
1510
|
return parseInt(i);
|
|
1424
1511
|
});
|
|
@@ -1437,27 +1524,27 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1437
1524
|
params.checkout = true;
|
|
1438
1525
|
}
|
|
1439
1526
|
if (!marketplaceParams) {
|
|
1440
|
-
|
|
1527
|
+
_context22.next = 14;
|
|
1441
1528
|
break;
|
|
1442
1529
|
}
|
|
1443
|
-
|
|
1530
|
+
_context22.next = 9;
|
|
1444
1531
|
return this.MarketplaceInfo({
|
|
1445
1532
|
marketplaceParams: marketplaceParams
|
|
1446
1533
|
});
|
|
1447
1534
|
case 9:
|
|
1448
|
-
marketplaceInfo =
|
|
1535
|
+
marketplaceInfo = _context22.sent;
|
|
1449
1536
|
if (!(collectionIndexes.length > 0)) {
|
|
1450
|
-
|
|
1537
|
+
_context22.next = 14;
|
|
1451
1538
|
break;
|
|
1452
1539
|
}
|
|
1453
|
-
|
|
1540
|
+
_context22.next = 13;
|
|
1454
1541
|
return this.Marketplace({
|
|
1455
1542
|
marketplaceParams: marketplaceParams
|
|
1456
1543
|
});
|
|
1457
1544
|
case 13:
|
|
1458
|
-
marketplace =
|
|
1545
|
+
marketplace = _context22.sent;
|
|
1459
1546
|
case 14:
|
|
1460
|
-
|
|
1547
|
+
_context22.prev = 14;
|
|
1461
1548
|
filters = [];
|
|
1462
1549
|
if (sellerAddress) {
|
|
1463
1550
|
filters.push("seller:eq:".concat(this.client.utils.FormatAddress(sellerAddress)));
|
|
@@ -1558,50 +1645,50 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1558
1645
|
if (capLimit) {
|
|
1559
1646
|
filters.push("info/cap:le:".concat(parseInt(capLimit)));
|
|
1560
1647
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1648
|
+
_context22.t0 = mode;
|
|
1649
|
+
_context22.next = _context22.t0 === "owned" ? 29 : _context22.t0 === "owned-full-meta" ? 31 : _context22.t0 === "listings" ? 34 : _context22.t0 === "transfers" ? 36 : _context22.t0 === "sales" ? 40 : _context22.t0 === "listing-stats" ? 44 : _context22.t0 === "sales-stats" ? 46 : _context22.t0 === "leaderboard" ? 49 : 51;
|
|
1563
1650
|
break;
|
|
1564
1651
|
case 29:
|
|
1565
1652
|
path = UrlJoin("as", "wlt", userAddress || this.UserAddress());
|
|
1566
|
-
return
|
|
1653
|
+
return _context22.abrupt("break", 51);
|
|
1567
1654
|
case 31:
|
|
1568
1655
|
path = UrlJoin("as", "apigw", "nfts");
|
|
1569
1656
|
headers = {
|
|
1570
1657
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
1571
1658
|
};
|
|
1572
|
-
return
|
|
1659
|
+
return _context22.abrupt("break", 51);
|
|
1573
1660
|
case 34:
|
|
1574
1661
|
path = UrlJoin("as", "mkt", "f");
|
|
1575
|
-
return
|
|
1662
|
+
return _context22.abrupt("break", 51);
|
|
1576
1663
|
case 36:
|
|
1577
1664
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1578
1665
|
filters.push("action:eq:TRANSFERRED");
|
|
1579
1666
|
filters.push("action:eq:SOLD");
|
|
1580
|
-
return
|
|
1667
|
+
return _context22.abrupt("break", 51);
|
|
1581
1668
|
case 40:
|
|
1582
1669
|
path = UrlJoin("as", "mkt", "hst", "f");
|
|
1583
1670
|
filters.push("action:eq:SOLD");
|
|
1584
1671
|
filters.push("seller:co:0x");
|
|
1585
|
-
return
|
|
1672
|
+
return _context22.abrupt("break", 51);
|
|
1586
1673
|
case 44:
|
|
1587
1674
|
path = UrlJoin("as", "mkt", "stats", "listed");
|
|
1588
|
-
return
|
|
1675
|
+
return _context22.abrupt("break", 51);
|
|
1589
1676
|
case 46:
|
|
1590
1677
|
path = UrlJoin("as", "mkt", "stats", "sold");
|
|
1591
1678
|
filters.push("seller:co:0x");
|
|
1592
|
-
return
|
|
1679
|
+
return _context22.abrupt("break", 51);
|
|
1593
1680
|
case 49:
|
|
1594
1681
|
path = UrlJoin("as", "wlt", "leaders");
|
|
1595
|
-
return
|
|
1682
|
+
return _context22.abrupt("break", 51);
|
|
1596
1683
|
case 51:
|
|
1597
1684
|
if (filters.length > 0) {
|
|
1598
1685
|
params.filter = filters;
|
|
1599
1686
|
}
|
|
1600
1687
|
if (!mode.includes("stats")) {
|
|
1601
|
-
|
|
1688
|
+
_context22.next = 56;
|
|
1602
1689
|
break;
|
|
1603
1690
|
}
|
|
1604
|
-
|
|
1691
|
+
_context22.next = 55;
|
|
1605
1692
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1606
1693
|
path: path,
|
|
1607
1694
|
method: "GET",
|
|
@@ -1609,10 +1696,10 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1609
1696
|
headers: headers
|
|
1610
1697
|
}));
|
|
1611
1698
|
case 55:
|
|
1612
|
-
return
|
|
1699
|
+
return _context22.abrupt("return", _context22.sent);
|
|
1613
1700
|
case 56:
|
|
1614
|
-
|
|
1615
|
-
|
|
1701
|
+
_context22.t2 = Utils;
|
|
1702
|
+
_context22.next = 59;
|
|
1616
1703
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1617
1704
|
path: path,
|
|
1618
1705
|
method: "GET",
|
|
@@ -1620,22 +1707,22 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1620
1707
|
headers: headers
|
|
1621
1708
|
});
|
|
1622
1709
|
case 59:
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
return
|
|
1710
|
+
_context22.t3 = _context22.sent;
|
|
1711
|
+
_context22.next = 62;
|
|
1712
|
+
return _context22.t2.ResponseToJson.call(_context22.t2, _context22.t3);
|
|
1626
1713
|
case 62:
|
|
1627
|
-
|
|
1628
|
-
if (
|
|
1629
|
-
|
|
1714
|
+
_context22.t1 = _context22.sent;
|
|
1715
|
+
if (_context22.t1) {
|
|
1716
|
+
_context22.next = 65;
|
|
1630
1717
|
break;
|
|
1631
1718
|
}
|
|
1632
|
-
|
|
1719
|
+
_context22.t1 = [];
|
|
1633
1720
|
case 65:
|
|
1634
|
-
_ref21 =
|
|
1721
|
+
_ref21 = _context22.t1;
|
|
1635
1722
|
contents = _ref21.contents;
|
|
1636
1723
|
paging = _ref21.paging;
|
|
1637
1724
|
modesToFormat = ["owned", "listings", "owned-full-meta"];
|
|
1638
|
-
return
|
|
1725
|
+
return _context22.abrupt("return", {
|
|
1639
1726
|
paging: {
|
|
1640
1727
|
start: params.start,
|
|
1641
1728
|
limit: params.limit,
|
|
@@ -1647,13 +1734,13 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1647
1734
|
})
|
|
1648
1735
|
});
|
|
1649
1736
|
case 72:
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
if (!(
|
|
1653
|
-
|
|
1737
|
+
_context22.prev = 72;
|
|
1738
|
+
_context22.t4 = _context22["catch"](14);
|
|
1739
|
+
if (!(_context22.t4.status && _context22.t4.status.toString() === "404")) {
|
|
1740
|
+
_context22.next = 76;
|
|
1654
1741
|
break;
|
|
1655
1742
|
}
|
|
1656
|
-
return
|
|
1743
|
+
return _context22.abrupt("return", {
|
|
1657
1744
|
paging: {
|
|
1658
1745
|
start: params.start,
|
|
1659
1746
|
limit: params.limit,
|
|
@@ -1663,12 +1750,12 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1663
1750
|
results: []
|
|
1664
1751
|
});
|
|
1665
1752
|
case 76:
|
|
1666
|
-
throw
|
|
1753
|
+
throw _context22.t4;
|
|
1667
1754
|
case 77:
|
|
1668
1755
|
case "end":
|
|
1669
|
-
return
|
|
1756
|
+
return _context22.stop();
|
|
1670
1757
|
}
|
|
1671
|
-
},
|
|
1758
|
+
}, _callee22, this, [[14, 72]]);
|
|
1672
1759
|
}));
|
|
1673
1760
|
function FilteredQuery() {
|
|
1674
1761
|
return _FilteredQuery.apply(this, arguments);
|
|
@@ -1678,26 +1765,26 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1678
1765
|
}, {
|
|
1679
1766
|
key: "MintingStatus",
|
|
1680
1767
|
value: function () {
|
|
1681
|
-
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1768
|
+
var _MintingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref22) {
|
|
1682
1769
|
var marketplaceParams, tenantId, marketplaceInfo, response;
|
|
1683
|
-
return _regeneratorRuntime.wrap(function
|
|
1684
|
-
while (1) switch (
|
|
1770
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1771
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1685
1772
|
case 0:
|
|
1686
1773
|
marketplaceParams = _ref22.marketplaceParams, tenantId = _ref22.tenantId;
|
|
1687
1774
|
if (tenantId) {
|
|
1688
|
-
|
|
1775
|
+
_context23.next = 6;
|
|
1689
1776
|
break;
|
|
1690
1777
|
}
|
|
1691
|
-
|
|
1778
|
+
_context23.next = 4;
|
|
1692
1779
|
return this.MarketplaceInfo({
|
|
1693
1780
|
marketplaceParams: marketplaceParams || this.selectedMarketplaceInfo
|
|
1694
1781
|
});
|
|
1695
1782
|
case 4:
|
|
1696
|
-
marketplaceInfo =
|
|
1783
|
+
marketplaceInfo = _context23.sent;
|
|
1697
1784
|
tenantId = marketplaceInfo.tenantId;
|
|
1698
1785
|
case 6:
|
|
1699
|
-
|
|
1700
|
-
|
|
1786
|
+
_context23.prev = 6;
|
|
1787
|
+
_context23.next = 9;
|
|
1701
1788
|
return Utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
|
|
1702
1789
|
path: UrlJoin("as", "wlt", "status", "act", tenantId),
|
|
1703
1790
|
method: "GET",
|
|
@@ -1706,8 +1793,8 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1706
1793
|
}
|
|
1707
1794
|
}));
|
|
1708
1795
|
case 9:
|
|
1709
|
-
response =
|
|
1710
|
-
return
|
|
1796
|
+
response = _context23.sent;
|
|
1797
|
+
return _context23.abrupt("return", response.map(function (status) {
|
|
1711
1798
|
var _status$op$split = status.op.split(":"),
|
|
1712
1799
|
_status$op$split2 = _slicedToArray(_status$op$split, 3),
|
|
1713
1800
|
op = _status$op$split2[0],
|
|
@@ -1769,15 +1856,15 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1769
1856
|
return a.ts < b.ts ? 1 : -1;
|
|
1770
1857
|
}));
|
|
1771
1858
|
case 13:
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
this.Log("Failed to retrieve minting status", true,
|
|
1775
|
-
return
|
|
1859
|
+
_context23.prev = 13;
|
|
1860
|
+
_context23.t0 = _context23["catch"](6);
|
|
1861
|
+
this.Log("Failed to retrieve minting status", true, _context23.t0);
|
|
1862
|
+
return _context23.abrupt("return", []);
|
|
1776
1863
|
case 17:
|
|
1777
1864
|
case "end":
|
|
1778
|
-
return
|
|
1865
|
+
return _context23.stop();
|
|
1779
1866
|
}
|
|
1780
|
-
},
|
|
1867
|
+
}, _callee23, this, [[6, 13]]);
|
|
1781
1868
|
}));
|
|
1782
1869
|
function MintingStatus(_x23) {
|
|
1783
1870
|
return _MintingStatus.apply(this, arguments);
|
|
@@ -1787,17 +1874,17 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1787
1874
|
}, {
|
|
1788
1875
|
key: "DeployTenant",
|
|
1789
1876
|
value: function () {
|
|
1790
|
-
var _DeployTenant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1877
|
+
var _DeployTenant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref23) {
|
|
1791
1878
|
var tenantId, _ref23$tenantSlug, tenantSlug, tenantHash, tenantLink, deployedTenantHash, body, token;
|
|
1792
|
-
return _regeneratorRuntime.wrap(function
|
|
1793
|
-
while (1) switch (
|
|
1879
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
1880
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1794
1881
|
case 0:
|
|
1795
1882
|
tenantId = _ref23.tenantId, _ref23$tenantSlug = _ref23.tenantSlug, tenantSlug = _ref23$tenantSlug === void 0 ? "" : _ref23$tenantSlug, tenantHash = _ref23.tenantHash;
|
|
1796
1883
|
if (tenantHash) {
|
|
1797
|
-
|
|
1884
|
+
_context24.next = 11;
|
|
1798
1885
|
break;
|
|
1799
1886
|
}
|
|
1800
|
-
|
|
1887
|
+
_context24.next = 4;
|
|
1801
1888
|
return this.client.ContentObjectMetadata({
|
|
1802
1889
|
libraryId: this.mainSiteLibraryId,
|
|
1803
1890
|
objectId: this.mainSiteId,
|
|
@@ -1809,30 +1896,30 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1809
1896
|
select: ["."]
|
|
1810
1897
|
});
|
|
1811
1898
|
case 4:
|
|
1812
|
-
tenantLink =
|
|
1899
|
+
tenantLink = _context24.sent;
|
|
1813
1900
|
if (tenantLink) {
|
|
1814
|
-
|
|
1901
|
+
_context24.next = 7;
|
|
1815
1902
|
break;
|
|
1816
1903
|
}
|
|
1817
1904
|
throw Error("Eluvio Wallet Client: Invalid or missing tenancy: ".concat(tenantSlug));
|
|
1818
1905
|
case 7:
|
|
1819
1906
|
deployedTenantHash = tenantLink["."].source;
|
|
1820
|
-
|
|
1907
|
+
_context24.next = 10;
|
|
1821
1908
|
return this.client.LatestVersionHash({
|
|
1822
1909
|
versionHash: deployedTenantHash
|
|
1823
1910
|
});
|
|
1824
1911
|
case 10:
|
|
1825
|
-
tenantHash =
|
|
1912
|
+
tenantHash = _context24.sent;
|
|
1826
1913
|
case 11:
|
|
1827
1914
|
body = {
|
|
1828
1915
|
content_hash: tenantHash,
|
|
1829
1916
|
ts: Date.now()
|
|
1830
1917
|
};
|
|
1831
|
-
|
|
1918
|
+
_context24.next = 14;
|
|
1832
1919
|
return this.client.Sign(JSON.stringify(body));
|
|
1833
1920
|
case 14:
|
|
1834
|
-
token =
|
|
1835
|
-
|
|
1921
|
+
token = _context24.sent;
|
|
1922
|
+
_context24.next = 17;
|
|
1836
1923
|
return this.client.authClient.MakeAuthServiceRequest({
|
|
1837
1924
|
path: UrlJoin("as", "tnt", "config", tenantId, "metadata"),
|
|
1838
1925
|
method: "POST",
|
|
@@ -1843,9 +1930,9 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1843
1930
|
});
|
|
1844
1931
|
case 17:
|
|
1845
1932
|
case "end":
|
|
1846
|
-
return
|
|
1933
|
+
return _context24.stop();
|
|
1847
1934
|
}
|
|
1848
|
-
},
|
|
1935
|
+
}, _callee24, this);
|
|
1849
1936
|
}));
|
|
1850
1937
|
function DeployTenant(_x24) {
|
|
1851
1938
|
return _DeployTenant.apply(this, arguments);
|
|
@@ -1888,48 +1975,48 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1888
1975
|
}, {
|
|
1889
1976
|
key: "Initialize",
|
|
1890
1977
|
value: function () {
|
|
1891
|
-
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1978
|
+
var _Initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref24) {
|
|
1892
1979
|
var client, _ref24$appId, appId, _ref24$network, network, _ref24$mode, mode, localization, marketplaceParams, previewMarketplaceId, _ref24$storeAuthToken, storeAuthToken, _ref24$skipMarketplac, skipMarketplaceLoad, _ref25, tenantSlug, marketplaceSlug, marketplaceId, marketplaceHash, previewMarketplaceHash, walletClient, url, savedToken;
|
|
1893
|
-
return _regeneratorRuntime.wrap(function
|
|
1894
|
-
while (1) switch (
|
|
1980
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
1981
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1895
1982
|
case 0:
|
|
1896
1983
|
client = _ref24.client, _ref24$appId = _ref24.appId, appId = _ref24$appId === void 0 ? "general" : _ref24$appId, _ref24$network = _ref24.network, network = _ref24$network === void 0 ? "main" : _ref24$network, _ref24$mode = _ref24.mode, mode = _ref24$mode === void 0 ? "production" : _ref24$mode, localization = _ref24.localization, marketplaceParams = _ref24.marketplaceParams, previewMarketplaceId = _ref24.previewMarketplaceId, _ref24$storeAuthToken = _ref24.storeAuthToken, storeAuthToken = _ref24$storeAuthToken === void 0 ? true : _ref24$storeAuthToken, _ref24$skipMarketplac = _ref24.skipMarketplaceLoad, skipMarketplaceLoad = _ref24$skipMarketplac === void 0 ? false : _ref24$skipMarketplac;
|
|
1897
1984
|
_ref25 = marketplaceParams || {}, tenantSlug = _ref25.tenantSlug, marketplaceSlug = _ref25.marketplaceSlug, marketplaceId = _ref25.marketplaceId, marketplaceHash = _ref25.marketplaceHash;
|
|
1898
1985
|
if (Configuration[network]) {
|
|
1899
|
-
|
|
1986
|
+
_context25.next = 6;
|
|
1900
1987
|
break;
|
|
1901
1988
|
}
|
|
1902
1989
|
throw Error("ElvWalletClient: Invalid network ".concat(network));
|
|
1903
1990
|
case 6:
|
|
1904
1991
|
if (Configuration[network][mode]) {
|
|
1905
|
-
|
|
1992
|
+
_context25.next = 8;
|
|
1906
1993
|
break;
|
|
1907
1994
|
}
|
|
1908
1995
|
throw Error("ElvWalletClient: Invalid mode ".concat(mode));
|
|
1909
1996
|
case 8:
|
|
1910
1997
|
if (client) {
|
|
1911
|
-
|
|
1998
|
+
_context25.next = 12;
|
|
1912
1999
|
break;
|
|
1913
2000
|
}
|
|
1914
|
-
|
|
2001
|
+
_context25.next = 11;
|
|
1915
2002
|
return ElvClient.FromNetworkName({
|
|
1916
2003
|
networkName: network,
|
|
1917
2004
|
assumeV3: true
|
|
1918
2005
|
});
|
|
1919
2006
|
case 11:
|
|
1920
|
-
client =
|
|
2007
|
+
client = _context25.sent;
|
|
1921
2008
|
case 12:
|
|
1922
2009
|
previewMarketplaceHash = previewMarketplaceId;
|
|
1923
2010
|
if (!(previewMarketplaceHash && !previewMarketplaceHash.startsWith("hq__"))) {
|
|
1924
|
-
|
|
2011
|
+
_context25.next = 17;
|
|
1925
2012
|
break;
|
|
1926
2013
|
}
|
|
1927
|
-
|
|
2014
|
+
_context25.next = 16;
|
|
1928
2015
|
return client.LatestVersionHash({
|
|
1929
2016
|
objectId: previewMarketplaceId
|
|
1930
2017
|
});
|
|
1931
2018
|
case 16:
|
|
1932
|
-
previewMarketplaceHash =
|
|
2019
|
+
previewMarketplaceHash = _context25.sent;
|
|
1933
2020
|
case 17:
|
|
1934
2021
|
walletClient = new ElvWalletClient({
|
|
1935
2022
|
appId: appId,
|
|
@@ -1947,59 +2034,59 @@ var ElvWalletClient = /*#__PURE__*/function () {
|
|
|
1947
2034
|
storeAuthToken: storeAuthToken
|
|
1948
2035
|
});
|
|
1949
2036
|
if (!(inBrowser && window.location && window.location.href)) {
|
|
1950
|
-
|
|
2037
|
+
_context25.next = 37;
|
|
1951
2038
|
break;
|
|
1952
2039
|
}
|
|
1953
2040
|
url = new URL(window.location.href);
|
|
1954
2041
|
if (!url.searchParams.get("elvToken")) {
|
|
1955
|
-
|
|
2042
|
+
_context25.next = 27;
|
|
1956
2043
|
break;
|
|
1957
2044
|
}
|
|
1958
|
-
|
|
2045
|
+
_context25.next = 23;
|
|
1959
2046
|
return walletClient.Authenticate({
|
|
1960
2047
|
token: url.searchParams.get("elvToken")
|
|
1961
2048
|
});
|
|
1962
2049
|
case 23:
|
|
1963
2050
|
url.searchParams["delete"]("elvToken");
|
|
1964
2051
|
window.history.replaceState("", "", url);
|
|
1965
|
-
|
|
2052
|
+
_context25.next = 37;
|
|
1966
2053
|
break;
|
|
1967
2054
|
case 27:
|
|
1968
2055
|
if (!(storeAuthToken && localStorageAvailable)) {
|
|
1969
|
-
|
|
2056
|
+
_context25.next = 37;
|
|
1970
2057
|
break;
|
|
1971
2058
|
}
|
|
1972
|
-
|
|
2059
|
+
_context25.prev = 28;
|
|
1973
2060
|
// Load saved auth token
|
|
1974
2061
|
savedToken = localStorage.getItem("__elv-token-".concat(network));
|
|
1975
2062
|
if (!savedToken) {
|
|
1976
|
-
|
|
2063
|
+
_context25.next = 33;
|
|
1977
2064
|
break;
|
|
1978
2065
|
}
|
|
1979
|
-
|
|
2066
|
+
_context25.next = 33;
|
|
1980
2067
|
return walletClient.Authenticate({
|
|
1981
2068
|
token: savedToken
|
|
1982
2069
|
});
|
|
1983
2070
|
case 33:
|
|
1984
|
-
|
|
2071
|
+
_context25.next = 37;
|
|
1985
2072
|
break;
|
|
1986
2073
|
case 35:
|
|
1987
|
-
|
|
1988
|
-
|
|
2074
|
+
_context25.prev = 35;
|
|
2075
|
+
_context25.t0 = _context25["catch"](28);
|
|
1989
2076
|
case 37:
|
|
1990
2077
|
if (skipMarketplaceLoad) {
|
|
1991
|
-
|
|
2078
|
+
_context25.next = 40;
|
|
1992
2079
|
break;
|
|
1993
2080
|
}
|
|
1994
|
-
|
|
2081
|
+
_context25.next = 40;
|
|
1995
2082
|
return walletClient.LoadAvailableMarketplaces();
|
|
1996
2083
|
case 40:
|
|
1997
|
-
return
|
|
2084
|
+
return _context25.abrupt("return", walletClient);
|
|
1998
2085
|
case 41:
|
|
1999
2086
|
case "end":
|
|
2000
|
-
return
|
|
2087
|
+
return _context25.stop();
|
|
2001
2088
|
}
|
|
2002
|
-
},
|
|
2089
|
+
}, _callee25, null, [[28, 35]]);
|
|
2003
2090
|
}));
|
|
2004
2091
|
function Initialize(_x25) {
|
|
2005
2092
|
return _Initialize.apply(this, arguments);
|