@eluvio/elv-client-js 4.0.108 → 4.0.110
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 +2 -2
- package/dist/ElvClient-node-min.js +2 -2
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +2 -2
- package/dist/src/ElvClient.js +192 -145
- package/dist/src/client/LiveStream.js +43 -43
- package/package.json +1 -1
- package/src/ElvClient.js +17 -10
- package/src/client/LiveStream.js +3 -1
package/dist/src/ElvClient.js
CHANGED
|
@@ -275,19 +275,23 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
275
275
|
debug: this.debug,
|
|
276
276
|
timeout: this.ethereumContractTimeout
|
|
277
277
|
});
|
|
278
|
-
if (
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
mnemonic: wallet.GenerateMnemonic()
|
|
282
|
-
});
|
|
283
|
-
this.SetSigner({
|
|
284
|
-
signer: signer,
|
|
285
|
-
reset: false
|
|
286
|
-
});
|
|
287
|
-
this.SetStaticToken({
|
|
288
|
-
token: staticToken
|
|
289
|
-
});
|
|
278
|
+
if (this.signer) {
|
|
279
|
+
_context2.next = 21;
|
|
280
|
+
break;
|
|
290
281
|
}
|
|
282
|
+
wallet = this.GenerateWallet();
|
|
283
|
+
signer = wallet.AddAccountFromMnemonic({
|
|
284
|
+
mnemonic: wallet.GenerateMnemonic()
|
|
285
|
+
});
|
|
286
|
+
this.SetSigner({
|
|
287
|
+
signer: signer,
|
|
288
|
+
reset: false
|
|
289
|
+
});
|
|
290
|
+
_context2.next = 21;
|
|
291
|
+
return this.SetStaticToken({
|
|
292
|
+
token: staticToken
|
|
293
|
+
});
|
|
294
|
+
case 21:
|
|
291
295
|
this.authClient = new AuthorizationClient({
|
|
292
296
|
client: this,
|
|
293
297
|
contentSpaceId: this.contentSpaceId,
|
|
@@ -304,7 +308,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
304
308
|
// Initialize crypto wasm
|
|
305
309
|
this.Crypto = Crypto;
|
|
306
310
|
this.Crypto.ElvCrypto();
|
|
307
|
-
case
|
|
311
|
+
case 25:
|
|
308
312
|
case "end":
|
|
309
313
|
return _context2.stop();
|
|
310
314
|
}
|
|
@@ -564,12 +568,14 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
564
568
|
while (1) switch (_context6.prev = _context6.next) {
|
|
565
569
|
case 0:
|
|
566
570
|
_ref7 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, matchEndpoint = _ref7.matchEndpoint, matchNodeId = _ref7.matchNodeId;
|
|
567
|
-
|
|
571
|
+
_context6.next = 3;
|
|
572
|
+
return this.SetStaticToken();
|
|
573
|
+
case 3:
|
|
568
574
|
if (!matchEndpoint) {
|
|
569
|
-
_context6.next =
|
|
575
|
+
_context6.next = 13;
|
|
570
576
|
break;
|
|
571
577
|
}
|
|
572
|
-
_context6.next =
|
|
578
|
+
_context6.next = 6;
|
|
573
579
|
return this.utils.ResponseToJson(this.HttpClient.Request({
|
|
574
580
|
path: UrlJoin("nodes"),
|
|
575
581
|
method: "GET",
|
|
@@ -577,15 +583,15 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
577
583
|
Authorization: "Bearer ".concat(this.staticToken)
|
|
578
584
|
}
|
|
579
585
|
}));
|
|
580
|
-
case
|
|
586
|
+
case 6:
|
|
581
587
|
_yield$this$utils$Res = _context6.sent;
|
|
582
588
|
nodes = _yield$this$utils$Res.nodes;
|
|
583
589
|
if (!(!nodes || !Array.isArray(nodes) || nodes.length === 0)) {
|
|
584
|
-
_context6.next =
|
|
590
|
+
_context6.next = 10;
|
|
585
591
|
break;
|
|
586
592
|
}
|
|
587
593
|
return _context6.abrupt("return", []);
|
|
588
|
-
case
|
|
594
|
+
case 10:
|
|
589
595
|
return _context6.abrupt("return", nodes.filter(function (node) {
|
|
590
596
|
var match = false;
|
|
591
597
|
if (node.services && node.services.fabric_api && node.services.fabric_api.urls) {
|
|
@@ -602,13 +608,15 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
602
608
|
_this.ClearStaticToken();
|
|
603
609
|
return match;
|
|
604
610
|
}));
|
|
605
|
-
case
|
|
611
|
+
case 13:
|
|
606
612
|
if (!matchNodeId) {
|
|
607
|
-
_context6.next =
|
|
613
|
+
_context6.next = 21;
|
|
608
614
|
break;
|
|
609
615
|
}
|
|
610
|
-
this.SetStaticToken();
|
|
611
616
|
_context6.next = 16;
|
|
617
|
+
return this.SetStaticToken();
|
|
618
|
+
case 16:
|
|
619
|
+
_context6.next = 18;
|
|
612
620
|
return this.utils.ResponseToJson(this.HttpClient.Request({
|
|
613
621
|
path: UrlJoin("nodes", matchNodeId),
|
|
614
622
|
method: "GET",
|
|
@@ -616,11 +624,11 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
616
624
|
Authorization: "Bearer ".concat(this.staticToken)
|
|
617
625
|
}
|
|
618
626
|
}));
|
|
619
|
-
case
|
|
627
|
+
case 18:
|
|
620
628
|
node = _context6.sent;
|
|
621
629
|
this.ClearStaticToken();
|
|
622
630
|
return _context6.abrupt("return", [node]);
|
|
623
|
-
case
|
|
631
|
+
case 21:
|
|
624
632
|
case "end":
|
|
625
633
|
return _context6.stop();
|
|
626
634
|
}
|
|
@@ -922,13 +930,32 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
922
930
|
case 0:
|
|
923
931
|
message = _ref14.message, addEthereumPrefix = _ref14.addEthereumPrefix, Sign = _ref14.Sign;
|
|
924
932
|
if (!Sign) {
|
|
933
|
+
// Same as authClient.Sign, but authClient may not yet be initialized
|
|
925
934
|
Sign = /*#__PURE__*/function () {
|
|
926
935
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(message) {
|
|
927
936
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
928
937
|
while (1) switch (_context10.prev = _context10.next) {
|
|
929
938
|
case 0:
|
|
930
|
-
|
|
931
|
-
|
|
939
|
+
_context10.t0 = Ethers.utils;
|
|
940
|
+
if (!_this2.signer.signDigest) {
|
|
941
|
+
_context10.next = 7;
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
_context10.next = 4;
|
|
945
|
+
return _this2.signer.signDigest(message);
|
|
946
|
+
case 4:
|
|
947
|
+
_context10.t1 = _context10.sent;
|
|
948
|
+
_context10.next = 10;
|
|
949
|
+
break;
|
|
950
|
+
case 7:
|
|
951
|
+
_context10.next = 9;
|
|
952
|
+
return _this2.signer._signingKey().signDigest(message);
|
|
953
|
+
case 9:
|
|
954
|
+
_context10.t1 = _context10.sent;
|
|
955
|
+
case 10:
|
|
956
|
+
_context10.t2 = _context10.t1;
|
|
957
|
+
return _context10.abrupt("return", _context10.t0.joinSignature.call(_context10.t0, _context10.t2));
|
|
958
|
+
case 12:
|
|
932
959
|
case "end":
|
|
933
960
|
return _context10.stop();
|
|
934
961
|
}
|
|
@@ -1408,17 +1435,36 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1408
1435
|
*/
|
|
1409
1436
|
}, {
|
|
1410
1437
|
key: "SetStaticToken",
|
|
1411
|
-
value: function
|
|
1412
|
-
var
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1438
|
+
value: function () {
|
|
1439
|
+
var _SetStaticToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
1440
|
+
var _this3 = this;
|
|
1441
|
+
var _ref22,
|
|
1442
|
+
token,
|
|
1443
|
+
_args18 = arguments;
|
|
1444
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
1445
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1446
|
+
case 0:
|
|
1447
|
+
_ref22 = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {}, token = _ref22.token;
|
|
1448
|
+
if (token) {
|
|
1449
|
+
this.staticToken = token;
|
|
1450
|
+
} else {
|
|
1451
|
+
this.CreateFabricToken({
|
|
1452
|
+
duration: 7 * 24 * 60 * 60 * 1000
|
|
1453
|
+
}).then(function (token) {
|
|
1454
|
+
return _this3.staticToken = token;
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
case 2:
|
|
1458
|
+
case "end":
|
|
1459
|
+
return _context18.stop();
|
|
1460
|
+
}
|
|
1461
|
+
}, _callee18, this);
|
|
1462
|
+
}));
|
|
1463
|
+
function SetStaticToken() {
|
|
1464
|
+
return _SetStaticToken.apply(this, arguments);
|
|
1418
1465
|
}
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1466
|
+
return SetStaticToken;
|
|
1467
|
+
}()
|
|
1422
1468
|
/**
|
|
1423
1469
|
* Clear the set static token for the client
|
|
1424
1470
|
*/
|
|
@@ -1440,28 +1486,29 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1440
1486
|
}, {
|
|
1441
1487
|
key: "SetPolicyAuthorization",
|
|
1442
1488
|
value: function () {
|
|
1443
|
-
var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1489
|
+
var _SetPolicyAuthorization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref23) {
|
|
1444
1490
|
var objectId;
|
|
1445
|
-
return _regeneratorRuntime.wrap(function
|
|
1446
|
-
while (1) switch (
|
|
1491
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
1492
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1447
1493
|
case 0:
|
|
1448
1494
|
objectId = _ref23.objectId;
|
|
1449
|
-
|
|
1450
|
-
|
|
1495
|
+
_context19.t0 = this;
|
|
1496
|
+
_context19.next = 4;
|
|
1451
1497
|
return this.GenerateStateChannelToken({
|
|
1452
1498
|
objectId: objectId
|
|
1453
1499
|
});
|
|
1454
1500
|
case 4:
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
token:
|
|
1501
|
+
_context19.t1 = _context19.sent;
|
|
1502
|
+
_context19.t2 = {
|
|
1503
|
+
token: _context19.t1
|
|
1458
1504
|
};
|
|
1459
|
-
|
|
1460
|
-
|
|
1505
|
+
_context19.next = 8;
|
|
1506
|
+
return _context19.t0.SetStaticToken.call(_context19.t0, _context19.t2);
|
|
1507
|
+
case 8:
|
|
1461
1508
|
case "end":
|
|
1462
|
-
return
|
|
1509
|
+
return _context19.stop();
|
|
1463
1510
|
}
|
|
1464
|
-
},
|
|
1511
|
+
}, _callee19, this);
|
|
1465
1512
|
}));
|
|
1466
1513
|
function SetPolicyAuthorization(_x13) {
|
|
1467
1514
|
return _SetPolicyAuthorization.apply(this, arguments);
|
|
@@ -1477,21 +1524,21 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1477
1524
|
}, {
|
|
1478
1525
|
key: "Sign",
|
|
1479
1526
|
value: function () {
|
|
1480
|
-
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1527
|
+
var _Sign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(string) {
|
|
1481
1528
|
var signature;
|
|
1482
|
-
return _regeneratorRuntime.wrap(function
|
|
1483
|
-
while (1) switch (
|
|
1529
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
1530
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1484
1531
|
case 0:
|
|
1485
|
-
|
|
1532
|
+
_context20.next = 2;
|
|
1486
1533
|
return this.authClient.Sign(Ethers.utils.keccak256(Ethers.utils.toUtf8Bytes(string)));
|
|
1487
1534
|
case 2:
|
|
1488
|
-
signature =
|
|
1489
|
-
return
|
|
1535
|
+
signature = _context20.sent;
|
|
1536
|
+
return _context20.abrupt("return", this.utils.FormatSignature(signature));
|
|
1490
1537
|
case 4:
|
|
1491
1538
|
case "end":
|
|
1492
|
-
return
|
|
1539
|
+
return _context20.stop();
|
|
1493
1540
|
}
|
|
1494
|
-
},
|
|
1541
|
+
}, _callee20, this);
|
|
1495
1542
|
}));
|
|
1496
1543
|
function Sign(_x14) {
|
|
1497
1544
|
return _Sign.apply(this, arguments);
|
|
@@ -1510,28 +1557,28 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1510
1557
|
}, {
|
|
1511
1558
|
key: "EncryptECIES",
|
|
1512
1559
|
value: function () {
|
|
1513
|
-
var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1560
|
+
var _EncryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref24) {
|
|
1514
1561
|
var message, publicKey;
|
|
1515
|
-
return _regeneratorRuntime.wrap(function
|
|
1516
|
-
while (1) switch (
|
|
1562
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
1563
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1517
1564
|
case 0:
|
|
1518
1565
|
message = _ref24.message, publicKey = _ref24.publicKey;
|
|
1519
1566
|
if (this.signer) {
|
|
1520
|
-
|
|
1567
|
+
_context21.next = 3;
|
|
1521
1568
|
break;
|
|
1522
1569
|
}
|
|
1523
1570
|
throw "Signer not set";
|
|
1524
1571
|
case 3:
|
|
1525
1572
|
ValidatePresence("message", message);
|
|
1526
|
-
|
|
1573
|
+
_context21.next = 6;
|
|
1527
1574
|
return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
|
|
1528
1575
|
case 6:
|
|
1529
|
-
return
|
|
1576
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1530
1577
|
case 7:
|
|
1531
1578
|
case "end":
|
|
1532
|
-
return
|
|
1579
|
+
return _context21.stop();
|
|
1533
1580
|
}
|
|
1534
|
-
},
|
|
1581
|
+
}, _callee21, this);
|
|
1535
1582
|
}));
|
|
1536
1583
|
function EncryptECIES(_x15) {
|
|
1537
1584
|
return _EncryptECIES.apply(this, arguments);
|
|
@@ -1549,28 +1596,28 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1549
1596
|
}, {
|
|
1550
1597
|
key: "DecryptECIES",
|
|
1551
1598
|
value: function () {
|
|
1552
|
-
var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1599
|
+
var _DecryptECIES = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref25) {
|
|
1553
1600
|
var message;
|
|
1554
|
-
return _regeneratorRuntime.wrap(function
|
|
1555
|
-
while (1) switch (
|
|
1601
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
1602
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1556
1603
|
case 0:
|
|
1557
1604
|
message = _ref25.message;
|
|
1558
1605
|
if (this.signer) {
|
|
1559
|
-
|
|
1606
|
+
_context22.next = 3;
|
|
1560
1607
|
break;
|
|
1561
1608
|
}
|
|
1562
1609
|
throw "Signer not set";
|
|
1563
1610
|
case 3:
|
|
1564
1611
|
ValidatePresence("message", message);
|
|
1565
|
-
|
|
1612
|
+
_context22.next = 6;
|
|
1566
1613
|
return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
|
|
1567
1614
|
case 6:
|
|
1568
|
-
return
|
|
1615
|
+
return _context22.abrupt("return", _context22.sent);
|
|
1569
1616
|
case 7:
|
|
1570
1617
|
case "end":
|
|
1571
|
-
return
|
|
1618
|
+
return _context22.stop();
|
|
1572
1619
|
}
|
|
1573
|
-
},
|
|
1620
|
+
}, _callee22, this);
|
|
1574
1621
|
}));
|
|
1575
1622
|
function DecryptECIES(_x16) {
|
|
1576
1623
|
return _DecryptECIES.apply(this, arguments);
|
|
@@ -1591,22 +1638,22 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1591
1638
|
}, {
|
|
1592
1639
|
key: "Request",
|
|
1593
1640
|
value: function () {
|
|
1594
|
-
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1641
|
+
var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref26) {
|
|
1595
1642
|
var url, _ref26$format, format, _ref26$method, method, _ref26$headers, headers, body;
|
|
1596
|
-
return _regeneratorRuntime.wrap(function
|
|
1597
|
-
while (1) switch (
|
|
1643
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
1644
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1598
1645
|
case 0:
|
|
1599
1646
|
url = _ref26.url, _ref26$format = _ref26.format, format = _ref26$format === void 0 ? "json" : _ref26$format, _ref26$method = _ref26.method, method = _ref26$method === void 0 ? "GET" : _ref26$method, _ref26$headers = _ref26.headers, headers = _ref26$headers === void 0 ? {} : _ref26$headers, body = _ref26.body;
|
|
1600
|
-
return
|
|
1647
|
+
return _context23.abrupt("return", this.utils.ResponseToFormat(format, HttpClient.Fetch(url, {
|
|
1601
1648
|
method: method,
|
|
1602
1649
|
headers: headers,
|
|
1603
1650
|
body: body
|
|
1604
1651
|
})));
|
|
1605
1652
|
case 2:
|
|
1606
1653
|
case "end":
|
|
1607
|
-
return
|
|
1654
|
+
return _context23.stop();
|
|
1608
1655
|
}
|
|
1609
|
-
},
|
|
1656
|
+
}, _callee23, this);
|
|
1610
1657
|
}));
|
|
1611
1658
|
function Request(_x17) {
|
|
1612
1659
|
return _Request.apply(this, arguments);
|
|
@@ -1616,13 +1663,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1616
1663
|
}, {
|
|
1617
1664
|
key: "MakeAuthServiceRequest",
|
|
1618
1665
|
value: function () {
|
|
1619
|
-
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1666
|
+
var _MakeAuthServiceRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref27) {
|
|
1620
1667
|
var kmsId, objectId, versionHash, _ref27$method, method, path, bodyType, _ref27$body, body, _ref27$queryParams, queryParams, headers;
|
|
1621
|
-
return _regeneratorRuntime.wrap(function
|
|
1622
|
-
while (1) switch (
|
|
1668
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
1669
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1623
1670
|
case 0:
|
|
1624
1671
|
kmsId = _ref27.kmsId, objectId = _ref27.objectId, versionHash = _ref27.versionHash, _ref27$method = _ref27.method, method = _ref27$method === void 0 ? "GET" : _ref27$method, path = _ref27.path, bodyType = _ref27.bodyType, _ref27$body = _ref27.body, body = _ref27$body === void 0 ? {} : _ref27$body, _ref27$queryParams = _ref27.queryParams, queryParams = _ref27$queryParams === void 0 ? {} : _ref27$queryParams, headers = _ref27.headers;
|
|
1625
|
-
return
|
|
1672
|
+
return _context24.abrupt("return", this.authClient.MakeAuthServiceRequest({
|
|
1626
1673
|
kmsId: kmsId,
|
|
1627
1674
|
objectId: objectId,
|
|
1628
1675
|
versionHash: versionHash,
|
|
@@ -1635,9 +1682,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1635
1682
|
}));
|
|
1636
1683
|
case 2:
|
|
1637
1684
|
case "end":
|
|
1638
|
-
return
|
|
1685
|
+
return _context24.stop();
|
|
1639
1686
|
}
|
|
1640
|
-
},
|
|
1687
|
+
}, _callee24, this);
|
|
1641
1688
|
}));
|
|
1642
1689
|
function MakeAuthServiceRequest(_x18) {
|
|
1643
1690
|
return _MakeAuthServiceRequest.apply(this, arguments);
|
|
@@ -1649,10 +1696,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1649
1696
|
}, {
|
|
1650
1697
|
key: "FrameAllowedMethods",
|
|
1651
1698
|
value: function FrameAllowedMethods() {
|
|
1652
|
-
var
|
|
1699
|
+
var _this4 = this;
|
|
1653
1700
|
var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
|
|
1654
1701
|
return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
|
|
1655
|
-
return typeof
|
|
1702
|
+
return typeof _this4[method] === "function" && !forbiddenMethods.includes(method);
|
|
1656
1703
|
});
|
|
1657
1704
|
}
|
|
1658
1705
|
|
|
@@ -1660,21 +1707,21 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1660
1707
|
}, {
|
|
1661
1708
|
key: "CallFromFrameMessage",
|
|
1662
1709
|
value: function () {
|
|
1663
|
-
var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1664
|
-
var
|
|
1710
|
+
var _CallFromFrameMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(message, Respond) {
|
|
1711
|
+
var _this5 = this;
|
|
1665
1712
|
var callback, method, methodResults, responseError;
|
|
1666
|
-
return _regeneratorRuntime.wrap(function
|
|
1667
|
-
while (1) switch (
|
|
1713
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
1714
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1668
1715
|
case 0:
|
|
1669
1716
|
if (!(message.type !== "ElvFrameRequest")) {
|
|
1670
|
-
|
|
1717
|
+
_context25.next = 2;
|
|
1671
1718
|
break;
|
|
1672
1719
|
}
|
|
1673
|
-
return
|
|
1720
|
+
return _context25.abrupt("return");
|
|
1674
1721
|
case 2:
|
|
1675
1722
|
if (message.callbackId) {
|
|
1676
1723
|
callback = function callback(result) {
|
|
1677
|
-
Respond(
|
|
1724
|
+
Respond(_this5.utils.MakeClonable({
|
|
1678
1725
|
type: "ElvFrameResponse",
|
|
1679
1726
|
requestId: message.callbackId,
|
|
1680
1727
|
response: result
|
|
@@ -1682,75 +1729,75 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1682
1729
|
};
|
|
1683
1730
|
message.args.callback = callback;
|
|
1684
1731
|
}
|
|
1685
|
-
|
|
1732
|
+
_context25.prev = 3;
|
|
1686
1733
|
method = message.calledMethod;
|
|
1687
1734
|
if (!(message.module === "walletClient")) {
|
|
1688
|
-
|
|
1735
|
+
_context25.next = 15;
|
|
1689
1736
|
break;
|
|
1690
1737
|
}
|
|
1691
1738
|
if (this.walletClient) {
|
|
1692
|
-
|
|
1739
|
+
_context25.next = 8;
|
|
1693
1740
|
break;
|
|
1694
1741
|
}
|
|
1695
1742
|
throw Error("Wallet client not set");
|
|
1696
1743
|
case 8:
|
|
1697
1744
|
if (!this.walletClient.ForbiddenMethods().includes(method)) {
|
|
1698
|
-
|
|
1745
|
+
_context25.next = 10;
|
|
1699
1746
|
break;
|
|
1700
1747
|
}
|
|
1701
1748
|
throw Error("Invalid user profile method: " + method);
|
|
1702
1749
|
case 10:
|
|
1703
|
-
|
|
1750
|
+
_context25.next = 12;
|
|
1704
1751
|
return this.walletClient[method](message.args);
|
|
1705
1752
|
case 12:
|
|
1706
|
-
methodResults =
|
|
1707
|
-
|
|
1753
|
+
methodResults = _context25.sent;
|
|
1754
|
+
_context25.next = 28;
|
|
1708
1755
|
break;
|
|
1709
1756
|
case 15:
|
|
1710
1757
|
if (!(message.module === "userProfileClient")) {
|
|
1711
|
-
|
|
1758
|
+
_context25.next = 23;
|
|
1712
1759
|
break;
|
|
1713
1760
|
}
|
|
1714
1761
|
if (this.userProfileClient.FrameAllowedMethods().includes(method)) {
|
|
1715
|
-
|
|
1762
|
+
_context25.next = 18;
|
|
1716
1763
|
break;
|
|
1717
1764
|
}
|
|
1718
1765
|
throw Error("Invalid user profile method: " + method);
|
|
1719
1766
|
case 18:
|
|
1720
|
-
|
|
1767
|
+
_context25.next = 20;
|
|
1721
1768
|
return this.userProfileClient[method](message.args);
|
|
1722
1769
|
case 20:
|
|
1723
|
-
methodResults =
|
|
1724
|
-
|
|
1770
|
+
methodResults = _context25.sent;
|
|
1771
|
+
_context25.next = 28;
|
|
1725
1772
|
break;
|
|
1726
1773
|
case 23:
|
|
1727
1774
|
if (this.FrameAllowedMethods().includes(method)) {
|
|
1728
|
-
|
|
1775
|
+
_context25.next = 25;
|
|
1729
1776
|
break;
|
|
1730
1777
|
}
|
|
1731
1778
|
throw Error("Invalid method: " + method);
|
|
1732
1779
|
case 25:
|
|
1733
|
-
|
|
1780
|
+
_context25.next = 27;
|
|
1734
1781
|
return this[method](message.args);
|
|
1735
1782
|
case 27:
|
|
1736
|
-
methodResults =
|
|
1783
|
+
methodResults = _context25.sent;
|
|
1737
1784
|
case 28:
|
|
1738
1785
|
Respond(this.utils.MakeClonable({
|
|
1739
1786
|
type: "ElvFrameResponse",
|
|
1740
1787
|
requestId: message.requestId,
|
|
1741
1788
|
response: methodResults
|
|
1742
1789
|
}));
|
|
1743
|
-
|
|
1790
|
+
_context25.next = 37;
|
|
1744
1791
|
break;
|
|
1745
1792
|
case 31:
|
|
1746
|
-
|
|
1747
|
-
|
|
1793
|
+
_context25.prev = 31;
|
|
1794
|
+
_context25.t0 = _context25["catch"](3);
|
|
1748
1795
|
// eslint-disable-next-line no-console
|
|
1749
|
-
this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(
|
|
1796
|
+
this.Log("Frame Message Error:\n Method: ".concat(message.calledMethod, "\n Arguments: ").concat(JSON.stringify(message.args, null, 2), "\n Error: ").concat(_typeof(_context25.t0) === "object" ? JSON.stringify(_context25.t0, null, 2) : _context25.t0), true);
|
|
1750
1797
|
|
|
1751
1798
|
// eslint-disable-next-line no-console
|
|
1752
|
-
console.error(
|
|
1753
|
-
responseError =
|
|
1799
|
+
console.error(_context25.t0);
|
|
1800
|
+
responseError = _context25.t0 instanceof Error ? _context25.t0.message : _context25.t0;
|
|
1754
1801
|
Respond(this.utils.MakeClonable({
|
|
1755
1802
|
type: "ElvFrameResponse",
|
|
1756
1803
|
requestId: message.requestId,
|
|
@@ -1758,9 +1805,9 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1758
1805
|
}));
|
|
1759
1806
|
case 37:
|
|
1760
1807
|
case "end":
|
|
1761
|
-
return
|
|
1808
|
+
return _context25.stop();
|
|
1762
1809
|
}
|
|
1763
|
-
},
|
|
1810
|
+
}, _callee25, this, [[3, 31]]);
|
|
1764
1811
|
}));
|
|
1765
1812
|
function CallFromFrameMessage(_x19, _x20) {
|
|
1766
1813
|
return _CallFromFrameMessage.apply(this, arguments);
|
|
@@ -1770,13 +1817,13 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1770
1817
|
}], [{
|
|
1771
1818
|
key: "Configuration",
|
|
1772
1819
|
value: function () {
|
|
1773
|
-
var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1820
|
+
var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref28) {
|
|
1774
1821
|
var configUrl, _ref28$kmsUrls, kmsUrls, region, clientIP, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion;
|
|
1775
|
-
return _regeneratorRuntime.wrap(function
|
|
1776
|
-
while (1) switch (
|
|
1822
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
1823
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1777
1824
|
case 0:
|
|
1778
1825
|
configUrl = _ref28.configUrl, _ref28$kmsUrls = _ref28.kmsUrls, kmsUrls = _ref28$kmsUrls === void 0 ? [] : _ref28$kmsUrls, region = _ref28.region, clientIP = _ref28.clientIP;
|
|
1779
|
-
|
|
1826
|
+
_context26.prev = 1;
|
|
1780
1827
|
uri = new URI(configUrl);
|
|
1781
1828
|
uri.pathname("/config");
|
|
1782
1829
|
if (region) {
|
|
@@ -1785,10 +1832,10 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1785
1832
|
if (clientIP) {
|
|
1786
1833
|
uri.addSearch("client_ip", clientIP);
|
|
1787
1834
|
}
|
|
1788
|
-
|
|
1835
|
+
_context26.next = 8;
|
|
1789
1836
|
return Utils.ResponseToJson(HttpClient.Fetch(uri.toString()));
|
|
1790
1837
|
case 8:
|
|
1791
|
-
fabricInfo =
|
|
1838
|
+
fabricInfo = _context26.sent;
|
|
1792
1839
|
// If any HTTPS urls present, throw away HTTP urls so only HTTPS will be used
|
|
1793
1840
|
filterHTTPS = function filterHTTPS(uri) {
|
|
1794
1841
|
return uri.toLowerCase().startsWith("https");
|
|
@@ -1811,7 +1858,7 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1811
1858
|
}
|
|
1812
1859
|
searchURIs = fabricInfo.network.services.search || [];
|
|
1813
1860
|
fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
|
|
1814
|
-
return
|
|
1861
|
+
return _context26.abrupt("return", {
|
|
1815
1862
|
nodeId: fabricInfo.node_id,
|
|
1816
1863
|
contentSpaceId: fabricInfo.qspace.id,
|
|
1817
1864
|
networkId: (fabricInfo.qspace.ethereum || {}).network_id,
|
|
@@ -1825,18 +1872,18 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1825
1872
|
fabricVersion: fabricVersion
|
|
1826
1873
|
});
|
|
1827
1874
|
case 23:
|
|
1828
|
-
|
|
1829
|
-
|
|
1875
|
+
_context26.prev = 23;
|
|
1876
|
+
_context26.t0 = _context26["catch"](1);
|
|
1830
1877
|
// eslint-disable-next-line no-console
|
|
1831
1878
|
console.error("Error retrieving fabric configuration:");
|
|
1832
1879
|
// eslint-disable-next-line no-console
|
|
1833
|
-
console.error(
|
|
1834
|
-
throw
|
|
1880
|
+
console.error(_context26.t0);
|
|
1881
|
+
throw _context26.t0;
|
|
1835
1882
|
case 28:
|
|
1836
1883
|
case "end":
|
|
1837
|
-
return
|
|
1884
|
+
return _context26.stop();
|
|
1838
1885
|
}
|
|
1839
|
-
},
|
|
1886
|
+
}, _callee26, null, [[1, 23]]);
|
|
1840
1887
|
}));
|
|
1841
1888
|
function Configuration(_x21) {
|
|
1842
1889
|
return _Configuration.apply(this, arguments);
|
|
@@ -1875,20 +1922,20 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1875
1922
|
}, {
|
|
1876
1923
|
key: "FromNetworkName",
|
|
1877
1924
|
value: function () {
|
|
1878
|
-
var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1925
|
+
var _FromNetworkName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref29) {
|
|
1879
1926
|
var networkName, region, clientIP, trustAuthorityId, staticToken, _ref29$ethereumContra, ethereumContractTimeout, _ref29$noCache, noCache, _ref29$noAuth, noAuth, assumeV3, configUrl;
|
|
1880
|
-
return _regeneratorRuntime.wrap(function
|
|
1881
|
-
while (1) switch (
|
|
1927
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
1928
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1882
1929
|
case 0:
|
|
1883
1930
|
networkName = _ref29.networkName, region = _ref29.region, clientIP = _ref29.clientIP, trustAuthorityId = _ref29.trustAuthorityId, staticToken = _ref29.staticToken, _ref29$ethereumContra = _ref29.ethereumContractTimeout, ethereumContractTimeout = _ref29$ethereumContra === void 0 ? 10 : _ref29$ethereumContra, _ref29$noCache = _ref29.noCache, noCache = _ref29$noCache === void 0 ? false : _ref29$noCache, _ref29$noAuth = _ref29.noAuth, noAuth = _ref29$noAuth === void 0 ? false : _ref29$noAuth, assumeV3 = _ref29.assumeV3;
|
|
1884
1931
|
configUrl = networks[networkName];
|
|
1885
1932
|
if (configUrl) {
|
|
1886
|
-
|
|
1933
|
+
_context27.next = 4;
|
|
1887
1934
|
break;
|
|
1888
1935
|
}
|
|
1889
1936
|
throw Error("Invalid network name: " + networkName);
|
|
1890
1937
|
case 4:
|
|
1891
|
-
|
|
1938
|
+
_context27.next = 6;
|
|
1892
1939
|
return this.FromConfigurationUrl({
|
|
1893
1940
|
configUrl: configUrl,
|
|
1894
1941
|
region: region,
|
|
@@ -1901,12 +1948,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1901
1948
|
assumeV3: assumeV3
|
|
1902
1949
|
});
|
|
1903
1950
|
case 6:
|
|
1904
|
-
return
|
|
1951
|
+
return _context27.abrupt("return", _context27.sent);
|
|
1905
1952
|
case 7:
|
|
1906
1953
|
case "end":
|
|
1907
|
-
return
|
|
1954
|
+
return _context27.stop();
|
|
1908
1955
|
}
|
|
1909
|
-
},
|
|
1956
|
+
}, _callee27, this);
|
|
1910
1957
|
}));
|
|
1911
1958
|
function FromNetworkName(_x22) {
|
|
1912
1959
|
return _FromNetworkName.apply(this, arguments);
|
|
@@ -1932,20 +1979,20 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1932
1979
|
}, {
|
|
1933
1980
|
key: "FromConfigurationUrl",
|
|
1934
1981
|
value: function () {
|
|
1935
|
-
var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1982
|
+
var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref30) {
|
|
1936
1983
|
var configUrl, region, clientIP, trustAuthorityId, staticToken, _ref30$ethereumContra, ethereumContractTimeout, _ref30$noCache, noCache, _ref30$noAuth, noAuth, _ref30$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fileServiceURIs, searchURIs, fabricVersion, client;
|
|
1937
|
-
return _regeneratorRuntime.wrap(function
|
|
1938
|
-
while (1) switch (
|
|
1984
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
1985
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1939
1986
|
case 0:
|
|
1940
1987
|
configUrl = _ref30.configUrl, region = _ref30.region, clientIP = _ref30.clientIP, trustAuthorityId = _ref30.trustAuthorityId, staticToken = _ref30.staticToken, _ref30$ethereumContra = _ref30.ethereumContractTimeout, ethereumContractTimeout = _ref30$ethereumContra === void 0 ? 10 : _ref30$ethereumContra, _ref30$noCache = _ref30.noCache, noCache = _ref30$noCache === void 0 ? false : _ref30$noCache, _ref30$noAuth = _ref30.noAuth, noAuth = _ref30$noAuth === void 0 ? false : _ref30$noAuth, _ref30$assumeV = _ref30.assumeV3, assumeV3 = _ref30$assumeV === void 0 ? false : _ref30$assumeV;
|
|
1941
|
-
|
|
1988
|
+
_context28.next = 3;
|
|
1942
1989
|
return ElvClient.Configuration({
|
|
1943
1990
|
configUrl: configUrl,
|
|
1944
1991
|
clientIP: clientIP,
|
|
1945
1992
|
region: region
|
|
1946
1993
|
});
|
|
1947
1994
|
case 3:
|
|
1948
|
-
_yield$ElvClient$Conf3 =
|
|
1995
|
+
_yield$ElvClient$Conf3 = _context28.sent;
|
|
1949
1996
|
contentSpaceId = _yield$ElvClient$Conf3.contentSpaceId;
|
|
1950
1997
|
networkId = _yield$ElvClient$Conf3.networkId;
|
|
1951
1998
|
networkName = _yield$ElvClient$Conf3.networkName;
|
|
@@ -1975,12 +2022,12 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1975
2022
|
client.configUrl = configUrl;
|
|
1976
2023
|
client.region = region;
|
|
1977
2024
|
client.clientIP = clientIP;
|
|
1978
|
-
return
|
|
2025
|
+
return _context28.abrupt("return", client);
|
|
1979
2026
|
case 18:
|
|
1980
2027
|
case "end":
|
|
1981
|
-
return
|
|
2028
|
+
return _context28.stop();
|
|
1982
2029
|
}
|
|
1983
|
-
},
|
|
2030
|
+
}, _callee28);
|
|
1984
2031
|
}));
|
|
1985
2032
|
function FromConfigurationUrl(_x23) {
|
|
1986
2033
|
return _FromConfigurationUrl.apply(this, arguments);
|