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