@eluvio/elv-client-js 3.2.45 → 4.0.1

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.
Files changed (37) hide show
  1. package/dist/ElvClient-min.js +17 -9
  2. package/dist/ElvClient-node-min.js +12 -25
  3. package/dist/ElvFrameClient-min.js +17 -9
  4. package/dist/ElvPermissionsClient-min.js +16 -8
  5. package/dist/ElvWalletClient-min.js +17 -9
  6. package/dist/ElvWalletClient-node-min.js +12 -25
  7. package/dist/src/AuthorizationClient.js +6 -6
  8. package/dist/src/ElvClient.js +24 -14
  9. package/dist/src/ElvWallet.js +1 -3
  10. package/dist/src/EthClient.js +21 -12
  11. package/dist/src/FrameClient.js +10 -7
  12. package/dist/src/HttpClient.js +7 -6
  13. package/dist/src/client/ContentAccess.js +3 -3
  14. package/dist/src/client/ContentManagement.js +15 -12
  15. package/dist/src/client/Contracts.js +1 -1
  16. package/package.json +2 -2
  17. package/src/AuthorizationClient.js +6 -6
  18. package/src/ElvClient.js +16 -5
  19. package/src/ElvWallet.js +1 -3
  20. package/src/EthClient.js +19 -10
  21. package/src/FrameClient.js +10 -2
  22. package/src/HttpClient.js +7 -5
  23. package/src/client/ContentAccess.js +3 -3
  24. package/src/client/ContentManagement.js +7 -5
  25. package/src/client/Contracts.js +1 -1
  26. package/testScripts/Test.js +7 -36
  27. package/testScripts/abr_profile_both.json +4 -4
  28. package/testScripts/abr_profile_clear_store_encrypted.json +4 -4
  29. package/testScripts/abr_profile_clear_store_unencrypted.json +4 -4
  30. package/testScripts/abr_profile_drm.json +4 -4
  31. package/utilities/example_files/abr_profile_both.json +4 -4
  32. package/utilities/example_files/abr_profile_clear_hls_only_store_encrypted.json +4 -4
  33. package/utilities/example_files/abr_profile_clear_hls_only_store_unencrypted.json +4 -4
  34. package/utilities/example_files/abr_profile_clear_store_encrypted.json +4 -4
  35. package/utilities/example_files/abr_profile_clear_store_unencrypted.json +4 -4
  36. package/utilities/example_files/abr_profile_drm.json +4 -4
  37. package/utilities/example_files/abr_profile_drm_hls_only.json +4 -4
@@ -353,7 +353,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
353
353
  addr: Utils.FormatAddress(this.client.signer && this.client.signer.address || "")
354
354
  };
355
355
 
356
- if (this.noAuth || noAuth) {
356
+ if (!update) {
357
357
  _context3.next = 29;
358
358
  break;
359
359
  }
@@ -602,8 +602,8 @@ var AuthorizationClient = /*#__PURE__*/function () {
602
602
  }; // Save request ID if present
603
603
 
604
604
  accessRequest.logs.some(function (log) {
605
- if (log.values && (log.values.requestID || log.values.requestNonce)) {
606
- _this.requestIds[address] = (log.values.requestID || log.values.requestNonce || "").toString().replace(/^0x/, "");
605
+ if (log.args && (log.args.requestID || log.args.requestNonce)) {
606
+ _this.requestIds[address] = (log.args.requestID || log.args.requestNonce || "").toString().replace(/^0x/, "");
607
607
  return true;
608
608
  }
609
609
  });
@@ -1231,11 +1231,11 @@ var AuthorizationClient = /*#__PURE__*/function () {
1231
1231
  if (!isV3) {
1232
1232
  if (args && args.length > 0) {
1233
1233
  // Inject public key of requester
1234
- args[1] = this.client.signer.signingKey ? this.client.signer.signingKey.publicKey : "";
1234
+ args[1] = this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "";
1235
1235
  } else {
1236
1236
  // Set default args
1237
1237
  args = [0, // Access level
1238
- this.client.signer.signingKey ? this.client.signer.signingKey.publicKey : "", // Public key of requester
1238
+ this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "", // Public key of requester
1239
1239
  publicKey, //cap.public_key,
1240
1240
  [], // Custom values
1241
1241
  [] // Stakeholders
@@ -1607,7 +1607,7 @@ var AuthorizationClient = /*#__PURE__*/function () {
1607
1607
 
1608
1608
  case 7:
1609
1609
  _context17.next = 9;
1610
- return this.client.signer.signingKey.signDigest(message);
1610
+ return this.client.signer._signingKey().signDigest(message);
1611
1611
 
1612
1612
  case 9:
1613
1613
  _context17.t1 = _context17.sent;
@@ -87,7 +87,8 @@ var ElvClient = /*#__PURE__*/function () {
87
87
  * @param {number} fabricVersion - The version of the target content fabric
88
88
  * @param {Array<string>} fabricURIs - A list of full URIs to content fabric nodes
89
89
  * @param {Array<string>} ethereumURIs - A list of full URIs to ethereum nodes
90
- * @param {Array<string>} ethereumURIs - A list of full URIs to auth service endpoints
90
+ * @param {Array<string>} authServiceURIs - A list of full URIs to auth service endpoints
91
+ * @param {Array<string>=} searchURIs - A list of full URIs to search service endpoints
91
92
  * @param {number=} ethereumContractTimeout=10 - Number of seconds to wait for contract calls
92
93
  * @param {string=} trustAuthorityId - (OAuth) The ID of the trust authority to use for OAuth authentication
93
94
  * @param {string=} staticToken - Static token that will be used for all authorization in place of normal auth
@@ -104,6 +105,7 @@ var ElvClient = /*#__PURE__*/function () {
104
105
  fabricURIs = _ref.fabricURIs,
105
106
  ethereumURIs = _ref.ethereumURIs,
106
107
  authServiceURIs = _ref.authServiceURIs,
108
+ searchURIs = _ref.searchURIs,
107
109
  _ref$ethereumContract = _ref.ethereumContractTimeout,
108
110
  ethereumContractTimeout = _ref$ethereumContract === void 0 ? 10 : _ref$ethereumContract,
109
111
  trustAuthorityId = _ref.trustAuthorityId,
@@ -128,6 +130,7 @@ var ElvClient = /*#__PURE__*/function () {
128
130
  this.fabricURIs = fabricURIs;
129
131
  this.authServiceURIs = authServiceURIs;
130
132
  this.ethereumURIs = ethereumURIs;
133
+ this.searchURIs = searchURIs;
131
134
  this.ethereumContractTimeout = ethereumContractTimeout;
132
135
  this.trustAuthorityId = trustAuthorityId;
133
136
  this.noCache = noCache;
@@ -364,7 +367,7 @@ var ElvClient = /*#__PURE__*/function () {
364
367
  key: "UseRegion",
365
368
  value: function () {
366
369
  var _UseRegion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref4) {
367
- var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs;
370
+ var region, _yield$ElvClient$Conf, fabricURIs, ethereumURIs, authServiceURIs, searchURIs;
368
371
 
369
372
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
370
373
  while (1) {
@@ -391,19 +394,22 @@ var ElvClient = /*#__PURE__*/function () {
391
394
  fabricURIs = _yield$ElvClient$Conf.fabricURIs;
392
395
  ethereumURIs = _yield$ElvClient$Conf.ethereumURIs;
393
396
  authServiceURIs = _yield$ElvClient$Conf.authServiceURIs;
397
+ searchURIs = _yield$ElvClient$Conf.searchURIs;
394
398
  this.authServiceURIs = authServiceURIs;
395
399
  this.fabricURIs = fabricURIs;
396
400
  this.ethereumURIs = ethereumURIs;
401
+ this.searchURIs = searchURIs;
397
402
  this.HttpClient.uris = fabricURIs;
398
403
  this.HttpClient.uriIndex = 0;
399
404
  this.ethClient.ethereumURIs = ethereumURIs;
400
405
  this.ethClient.ethereumURIIndex = 0;
401
406
  return _context3.abrupt("return", {
402
407
  fabricURIs: fabricURIs,
403
- ethereumURIs: ethereumURIs
408
+ ethereumURIs: ethereumURIs,
409
+ searchURIs: searchURIs
404
410
  });
405
411
 
406
- case 17:
412
+ case 19:
407
413
  case "end":
408
414
  return _context3.stop();
409
415
  }
@@ -1479,7 +1485,7 @@ var ElvClient = /*#__PURE__*/function () {
1479
1485
  case 3:
1480
1486
  ValidatePresence("message", message);
1481
1487
  _context17.next = 6;
1482
- return this.Crypto.EncryptConk(message, publicKey || this.signer.signingKey.keyPair.publicKey);
1488
+ return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1483
1489
 
1484
1490
  case 6:
1485
1491
  return _context17.abrupt("return", _context17.sent);
@@ -1528,7 +1534,7 @@ var ElvClient = /*#__PURE__*/function () {
1528
1534
  case 3:
1529
1535
  ValidatePresence("message", message);
1530
1536
  _context18.next = 6;
1531
- return this.Crypto.DecryptCap(message, this.signer.signingKey.privateKey);
1537
+ return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1532
1538
 
1533
1539
  case 6:
1534
1540
  return _context18.abrupt("return", _context18.sent);
@@ -1598,7 +1604,7 @@ var ElvClient = /*#__PURE__*/function () {
1598
1604
  value: function FrameAllowedMethods() {
1599
1605
  var _this2 = this;
1600
1606
 
1601
- var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1607
+ var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1602
1608
  return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
1603
1609
  return typeof _this2[method] === "function" && !forbiddenMethods.includes(method);
1604
1610
  });
@@ -1715,7 +1721,7 @@ var ElvClient = /*#__PURE__*/function () {
1715
1721
  key: "Configuration",
1716
1722
  value: function () {
1717
1723
  var _Configuration = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref22) {
1718
- var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion;
1724
+ var configUrl, _ref22$kmsUrls, kmsUrls, region, uri, fabricInfo, filterHTTPS, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion;
1719
1725
 
1720
1726
  return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1721
1727
  while (1) {
@@ -1759,6 +1765,7 @@ var ElvClient = /*#__PURE__*/function () {
1759
1765
  authServiceURIs = authServiceURIs.filter(filterHTTPS);
1760
1766
  }
1761
1767
 
1768
+ searchURIs = fabricInfo.network.services.search || [];
1762
1769
  fabricVersion = Math.max.apply(Math, _toConsumableArray(fabricInfo.network.api_versions || [2]));
1763
1770
  return _context21.abrupt("return", {
1764
1771
  nodeId: fabricInfo.node_id,
@@ -1769,11 +1776,12 @@ var ElvClient = /*#__PURE__*/function () {
1769
1776
  ethereumURIs: ethereumURIs,
1770
1777
  authServiceURIs: authServiceURIs,
1771
1778
  kmsURIs: kmsUrls,
1779
+ searchURIs: searchURIs,
1772
1780
  fabricVersion: fabricVersion
1773
1781
  });
1774
1782
 
1775
- case 19:
1776
- _context21.prev = 19;
1783
+ case 20:
1784
+ _context21.prev = 20;
1777
1785
  _context21.t0 = _context21["catch"](1);
1778
1786
  // eslint-disable-next-line no-console
1779
1787
  console.error("Error retrieving fabric configuration:"); // eslint-disable-next-line no-console
@@ -1781,12 +1789,12 @@ var ElvClient = /*#__PURE__*/function () {
1781
1789
  console.error(_context21.t0);
1782
1790
  throw _context21.t0;
1783
1791
 
1784
- case 24:
1792
+ case 25:
1785
1793
  case "end":
1786
1794
  return _context21.stop();
1787
1795
  }
1788
1796
  }
1789
- }, _callee21, null, [[1, 19]]);
1797
+ }, _callee21, null, [[1, 20]]);
1790
1798
  }));
1791
1799
 
1792
1800
  function Configuration(_x18) {
@@ -1881,7 +1889,7 @@ var ElvClient = /*#__PURE__*/function () {
1881
1889
  key: "FromConfigurationUrl",
1882
1890
  value: function () {
1883
1891
  var _FromConfigurationUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref24) {
1884
- var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, fabricVersion, client;
1892
+ var configUrl, region, trustAuthorityId, staticToken, _ref24$ethereumContra, ethereumContractTimeout, _ref24$noCache, noCache, _ref24$noAuth, noAuth, _ref24$assumeV, assumeV3, _yield$ElvClient$Conf3, contentSpaceId, networkId, networkName, fabricURIs, ethereumURIs, authServiceURIs, searchURIs, fabricVersion, client;
1885
1893
 
1886
1894
  return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1887
1895
  while (1) {
@@ -1902,6 +1910,7 @@ var ElvClient = /*#__PURE__*/function () {
1902
1910
  fabricURIs = _yield$ElvClient$Conf3.fabricURIs;
1903
1911
  ethereumURIs = _yield$ElvClient$Conf3.ethereumURIs;
1904
1912
  authServiceURIs = _yield$ElvClient$Conf3.authServiceURIs;
1913
+ searchURIs = _yield$ElvClient$Conf3.searchURIs;
1905
1914
  fabricVersion = _yield$ElvClient$Conf3.fabricVersion;
1906
1915
  client = new ElvClient({
1907
1916
  contentSpaceId: contentSpaceId,
@@ -1911,6 +1920,7 @@ var ElvClient = /*#__PURE__*/function () {
1911
1920
  fabricURIs: fabricURIs,
1912
1921
  ethereumURIs: ethereumURIs,
1913
1922
  authServiceURIs: authServiceURIs,
1923
+ searchURIs: searchURIs,
1914
1924
  ethereumContractTimeout: ethereumContractTimeout,
1915
1925
  trustAuthorityId: trustAuthorityId,
1916
1926
  staticToken: staticToken,
@@ -1921,7 +1931,7 @@ var ElvClient = /*#__PURE__*/function () {
1921
1931
  client.configUrl = configUrl;
1922
1932
  return _context23.abrupt("return", client);
1923
1933
 
1924
- case 14:
1934
+ case 15:
1925
1935
  case "end":
1926
1936
  return _context23.stop();
1927
1937
  }
@@ -19,8 +19,6 @@ var ElvWallet = /*#__PURE__*/function () {
19
19
  * NOTE: It is recommended to initialize wallets from the ElvClient, not using this constructor
20
20
  *
21
21
  * @see ElvClient#GenerateWallet()
22
- *
23
- * @param {string} providerUrl - URL of blockchain provider
24
22
  */
25
23
  function ElvWallet(provider) {
26
24
  _classCallCheck(this, ElvWallet);
@@ -38,7 +36,7 @@ var ElvWallet = /*#__PURE__*/function () {
38
36
  _createClass(ElvWallet, [{
39
37
  key: "GenerateMnemonic",
40
38
  value: function GenerateMnemonic() {
41
- return Ethers.utils.HDNode.entropyToMnemonic(Ethers.utils.randomBytes(16));
39
+ return Ethers.Wallet.createRandom().mnemonic.phrase;
42
40
  }
43
41
  /**
44
42
  * Generate a private key from the given mnemonic
@@ -71,8 +71,7 @@ var EthClient = /*#__PURE__*/function () {
71
71
  this.HttpClient = new HttpClient({
72
72
  uris: this.ethereumURIs,
73
73
  debug: this.debug
74
- });
75
- Ethers.errors.setLogLevel("error");
74
+ }); //Ethers.errors.setLogLevel("error");
76
75
  }
77
76
 
78
77
  _createClass(EthClient, [{
@@ -429,7 +428,7 @@ var EthClient = /*#__PURE__*/function () {
429
428
  key: "CallContractMethod",
430
429
  value: function () {
431
430
  var _CallContractMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref9) {
432
- var contract, contractAddress, abi, methodName, _ref9$methodArgs, methodArgs, value, _ref9$overrides, overrides, _ref9$formatArguments, formatArguments, _ref9$cacheContract, cacheContract, _ref9$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract$functions, latestBlock;
431
+ var contract, contractAddress, abi, methodName, _ref9$methodArgs, methodArgs, value, _ref9$overrides, overrides, _ref9$formatArguments, formatArguments, _ref9$cacheContract, cacheContract, _ref9$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract, latestBlock;
433
432
 
434
433
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
435
434
  while (1) {
@@ -457,7 +456,7 @@ var EthClient = /*#__PURE__*/function () {
457
456
  cacheContract: cacheContract,
458
457
  overrideCachedContract: overrideCachedContract
459
458
  });
460
- abi = contract["interface"].abi; // Automatically format contract arguments
459
+ abi = contract["interface"].fragments; // Automatically format contract arguments
461
460
 
462
461
  if (formatArguments) {
463
462
  methodArgs = this.FormatContractArguments({
@@ -481,7 +480,7 @@ var EthClient = /*#__PURE__*/function () {
481
480
 
482
481
  case 11:
483
482
  this.Log("Calling contract method:\n Provider: ".concat(this.Provider().connection.url, "\n Address: ").concat(contract.address, "\n Method: ").concat(methodName, "\n Args: [").concat(methodArgs.join(", "), "]"));
484
- methodAbi = contract["interface"].abi.find(function (method) {
483
+ methodAbi = contract["interface"].fragments.find(function (method) {
485
484
  return method.name === methodName;
486
485
  }); // Lock if performing a transaction
487
486
 
@@ -520,7 +519,7 @@ var EthClient = /*#__PURE__*/function () {
520
519
 
521
520
  _context6.prev = 23;
522
521
  _context6.next = 26;
523
- return (_contract$functions = contract.functions)[methodName].apply(_contract$functions, _toConsumableArray(methodArgs).concat([overrides]));
522
+ return (_contract = contract)[methodName].apply(_contract, _toConsumableArray(methodArgs).concat([overrides]));
524
523
 
525
524
  case 26:
526
525
  result = _context6.sent;
@@ -673,7 +672,13 @@ var EthClient = /*#__PURE__*/function () {
673
672
  }
674
673
 
675
674
  methodEvent.logs = methodEvent.logs.map(function (log) {
676
- return _objectSpread(_objectSpread({}, log), contract["interface"].parseLog(log));
675
+ var parsedLogs = {};
676
+
677
+ try {
678
+ parsedLogs = contract["interface"].parseLog(log); // eslint-disable-next-line no-empty
679
+ } catch (error) {}
680
+
681
+ return _objectSpread(_objectSpread({}, log), parsedLogs);
677
682
  });
678
683
  return _context7.abrupt("break", 25);
679
684
 
@@ -766,11 +771,15 @@ var EthClient = /*#__PURE__*/function () {
766
771
  try {
767
772
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
768
773
  var log = _step.value;
769
- var parsedLog = contractInterface.parseLog(log);
770
774
 
771
- if (parsedLog && parsedLog.name === eventName) {
772
- return parsedLog;
773
- }
775
+ try {
776
+ var parsedLog = contractInterface.parseLog(log);
777
+
778
+ if (parsedLog && parsedLog.name === eventName) {
779
+ return parsedLog;
780
+ } // eslint-disable-next-line no-empty
781
+
782
+ } catch (error) {}
774
783
  }
775
784
  } catch (err) {
776
785
  _iterator.e(err);
@@ -821,7 +830,7 @@ var EthClient = /*#__PURE__*/function () {
821
830
  throw Error("".concat(methodName, " failed - Log not present in transaction"));
822
831
 
823
832
  case 10:
824
- newContractAddress = eventLog.values[eventValue];
833
+ newContractAddress = eventLog.args[eventValue];
825
834
  return _context9.abrupt("return", {
826
835
  contractAddress: Utils.FormatAddress(newContractAddress),
827
836
  transactionHash: event.transactionHash
@@ -480,19 +480,22 @@ var FrameClient = /*#__PURE__*/function () {
480
480
  }() // List of methods that may require a prompt - these should have an unlimited timeout period
481
481
 
482
482
  }, {
483
- key: "AllowedMethods",
484
- value: // List of allowed methods available to frames
483
+ key: "OverriddenMethods",
484
+ value: // List of methods that are defined separately in FrameClient
485
+ function OverriddenMethods() {
486
+ return ["UploadFiles"];
487
+ } // List of allowed methods available to frames
485
488
  // This should match ElvClient.FrameAvailableMethods()
486
489
  // ElvClient will also reject any disallowed methods
487
490
 
488
491
  /**
489
492
  * @returns {Array<string>} - List of ElvClient methods available to a FrameClient
490
493
  */
491
- function AllowedMethods() {
492
- return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData",
493
- /*"UploadFiles",*/
494
- //Override
495
- "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
494
+
495
+ }, {
496
+ key: "AllowedMethods",
497
+ value: function AllowedMethods() {
498
+ return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateSignedToken", "CurrentAccountAddress", "CustomContractAddress", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LROStatus", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RedeemCode", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "SendFunds", "SetAccessCharge", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetVisibility", "SetPermission", "StartABRMezzanineJobs", "SuspendNTPInstance", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "VerifyContentObject", "Visibility"];
496
499
  }
497
500
  }, {
498
501
  key: "AllowedUserProfileMethods",
@@ -36,8 +36,8 @@ var HttpClient = /*#__PURE__*/function () {
36
36
  }
37
37
  }, {
38
38
  key: "BaseURI",
39
- value: function BaseURI() {
40
- return new URI(this.uris[this.uriIndex]);
39
+ value: function BaseURI(url) {
40
+ return new URI(url || this.uris[this.uriIndex]);
41
41
  }
42
42
  }, {
43
43
  key: "RecordWriteToken",
@@ -65,14 +65,15 @@ var HttpClient = /*#__PURE__*/function () {
65
65
  key: "Request",
66
66
  value: function () {
67
67
  var _Request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
68
- var method, path, _ref2$queryParams, queryParams, body, _ref2$bodyType, bodyType, _ref2$headers, headers, _ref2$attempts, attempts, _ref2$failover, failover, _ref2$forceFailover, forceFailover, baseURI, writeTokenMatch, writeToken, uri, fetchParameters, response, responseType, errorBody, error;
68
+ var method, path, _ref2$queryParams, queryParams, body, _ref2$bodyType, bodyType, _ref2$headers, headers, _ref2$attempts, attempts, _ref2$failover, failover, _ref2$forceFailover, forceFailover, nodeUrl, baseURI, writeTokenMatch, writeToken, uri, fetchParameters, response, responseType, errorBody, error;
69
69
 
70
70
  return _regeneratorRuntime.wrap(function _callee$(_context) {
71
71
  while (1) {
72
72
  switch (_context.prev = _context.next) {
73
73
  case 0:
74
- method = _ref2.method, path = _ref2.path, _ref2$queryParams = _ref2.queryParams, queryParams = _ref2$queryParams === void 0 ? {} : _ref2$queryParams, body = _ref2.body, _ref2$bodyType = _ref2.bodyType, bodyType = _ref2$bodyType === void 0 ? "JSON" : _ref2$bodyType, _ref2$headers = _ref2.headers, headers = _ref2$headers === void 0 ? {} : _ref2$headers, _ref2$attempts = _ref2.attempts, attempts = _ref2$attempts === void 0 ? 0 : _ref2$attempts, _ref2$failover = _ref2.failover, failover = _ref2$failover === void 0 ? true : _ref2$failover, _ref2$forceFailover = _ref2.forceFailover, forceFailover = _ref2$forceFailover === void 0 ? false : _ref2$forceFailover;
75
- baseURI = this.BaseURI(); // If URL contains a write token, it must go to the correct server and can not fail over
74
+ method = _ref2.method, path = _ref2.path, _ref2$queryParams = _ref2.queryParams, queryParams = _ref2$queryParams === void 0 ? {} : _ref2$queryParams, body = _ref2.body, _ref2$bodyType = _ref2.bodyType, bodyType = _ref2$bodyType === void 0 ? "JSON" : _ref2$bodyType, _ref2$headers = _ref2.headers, headers = _ref2$headers === void 0 ? {} : _ref2$headers, _ref2$attempts = _ref2.attempts, attempts = _ref2$attempts === void 0 ? 0 : _ref2$attempts, _ref2$failover = _ref2.failover, failover = _ref2$failover === void 0 ? true : _ref2$failover, _ref2$forceFailover = _ref2.forceFailover, forceFailover = _ref2$forceFailover === void 0 ? false : _ref2$forceFailover, nodeUrl = _ref2.nodeUrl;
75
+ // if nodeUrl passed in, restrict communication to that node only (unless previously recorded write token is found in next step)
76
+ baseURI = this.BaseURI(nodeUrl); // If URL contains a write token, it must go to the correct server and can not fail over
76
77
 
77
78
  writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
78
79
  writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
@@ -127,7 +128,7 @@ var HttpClient = /*#__PURE__*/function () {
127
128
  break;
128
129
  }
129
130
 
130
- if (!(!writeToken && (failover && parseInt(response.status) >= 500 || forceFailover) && attempts < this.uris.length)) {
131
+ if (!(!writeToken && !nodeUrl && (failover && parseInt(response.status) >= 500 || forceFailover) && attempts < this.uris.length)) {
131
132
  _context.next = 24;
132
133
  break;
133
134
  }
@@ -4392,7 +4392,7 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
4392
4392
  }
4393
4393
 
4394
4394
  _context46.next = 17;
4395
- return this.Crypto.DecryptCap(existingUserCap, this.signer.signingKey.privateKey);
4395
+ return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
4396
4396
 
4397
4397
  case 17:
4398
4398
  this.encryptionConks[objectId] = _context46.sent;
@@ -4414,7 +4414,7 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
4414
4414
  _context46.t3 = writeToken;
4415
4415
  _context46.t4 = capKey;
4416
4416
  _context46.next = 30;
4417
- return this.Crypto.EncryptConk(this.encryptionConks[objectId], this.signer.signingKey.publicKey);
4417
+ return this.Crypto.EncryptConk(this.encryptionConks[objectId], this.signer._signingKey().publicKey);
4418
4418
 
4419
4419
  case 30:
4420
4420
  _context46.t5 = _context46.sent;
@@ -4631,7 +4631,7 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4631
4631
  }
4632
4632
 
4633
4633
  _context47.next = 29;
4634
- return this.Crypto.DecryptCap(existingUserCap, this.signer.signingKey.privateKey);
4634
+ return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
4635
4635
 
4636
4636
  case 29:
4637
4637
  this.encryptionConks[objectId] = _context47.sent;
@@ -1219,7 +1219,7 @@ exports.CopyContentObject = /*#__PURE__*/function () {
1219
1219
  }
1220
1220
 
1221
1221
  _context13.next = 20;
1222
- return this.Crypto.DecryptCap(metadata[userCapKey], this.signer.signingKey.privateKey);
1222
+ return this.Crypto.DecryptCap(metadata[userCapKey], this.signer._signingKey().privateKey);
1223
1223
 
1224
1224
  case 20:
1225
1225
  userConkKey = _context13.sent;
@@ -1230,7 +1230,7 @@ exports.CopyContentObject = /*#__PURE__*/function () {
1230
1230
  _context13.t3 = writeToken;
1231
1231
  _context13.t4 = userCapKey;
1232
1232
  _context13.next = 29;
1233
- return this.Crypto.EncryptConk(userConkKey, this.signer.signingKey.publicKey);
1233
+ return this.Crypto.EncryptConk(userConkKey, this.signer._signingKey().publicKey);
1234
1234
 
1235
1235
  case 29:
1236
1236
  _context13.t5 = _context13.sent;
@@ -1357,7 +1357,7 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
1357
1357
 
1358
1358
  case 7:
1359
1359
  _context14.next = 9;
1360
- return this.Crypto.DecryptCap(userCapValue, this.signer.signingKey.privateKey);
1360
+ return this.Crypto.DecryptCap(userCapValue, this.signer._signingKey().privateKey);
1361
1361
 
1362
1362
  case 9:
1363
1363
  userConk = _context14.sent;
@@ -1428,6 +1428,7 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
1428
1428
  * @param {object=} options -
1429
1429
  * meta: New metadata for the object - will be merged into existing metadata if specified
1430
1430
  * type: New type for the object - Object ID, version hash or name of type
1431
+ * nodeUrl: Node URL to use in HTTP call
1431
1432
  *
1432
1433
  * @returns {Promise<object>} - Response containing the object ID and write token of the draft, as well as URL of node handling the draft
1433
1434
  */
@@ -1517,26 +1518,28 @@ exports.EditContentObject = /*#__PURE__*/function () {
1517
1518
  _context15.t1 = _context15.sent;
1518
1519
  _context15.t2 = path;
1519
1520
  _context15.t3 = options;
1520
- _context15.t4 = {
1521
+ _context15.t4 = options.nodeUrl;
1522
+ _context15.t5 = {
1521
1523
  headers: _context15.t1,
1522
1524
  method: "POST",
1523
1525
  path: _context15.t2,
1524
- body: _context15.t3
1526
+ body: _context15.t3,
1527
+ nodeUrl: _context15.t4
1525
1528
  };
1526
- _context15.next = 33;
1527
- return _context15.t0.Request.call(_context15.t0, _context15.t4);
1529
+ _context15.next = 34;
1530
+ return _context15.t0.Request.call(_context15.t0, _context15.t5);
1528
1531
 
1529
- case 33:
1532
+ case 34:
1530
1533
  rawEditResponse = _context15.sent;
1531
1534
  actualUrl = new URL(rawEditResponse.url);
1532
1535
  actualUrl.pathname = "";
1533
1536
  actualUrl.search = "";
1534
1537
  actualUrl.hash = "";
1535
1538
  nodeUrl = actualUrl.href;
1536
- _context15.next = 41;
1539
+ _context15.next = 42;
1537
1540
  return this.utils.ResponseToJson(rawEditResponse);
1538
1541
 
1539
- case 41:
1542
+ case 42:
1540
1543
  editResponse = _context15.sent;
1541
1544
  // Record the node used in creating this write token
1542
1545
  this.HttpClient.RecordWriteToken(editResponse.write_token, nodeUrl);
@@ -1545,7 +1548,7 @@ exports.EditContentObject = /*#__PURE__*/function () {
1545
1548
  editResponse.nodeUrl = nodeUrl;
1546
1549
  return _context15.abrupt("return", editResponse);
1547
1550
 
1548
- case 47:
1551
+ case 48:
1549
1552
  case "end":
1550
1553
  return _context15.stop();
1551
1554
  }
@@ -2095,7 +2098,7 @@ exports.PublishContentVersion = /*#__PURE__*/function () {
2095
2098
  events = _context21.sent;
2096
2099
  confirmEvent = events.find(function (blockEvents) {
2097
2100
  return blockEvents.find(function (event) {
2098
- return objectHash === (event && event.values && event.values.objectHash);
2101
+ return objectHash === (event && event.args && event.args.objectHash);
2099
2102
  });
2100
2103
  });
2101
2104
 
@@ -813,7 +813,7 @@ exports.ExtractValueFromEvent = function (_ref25) {
813
813
  eventName: eventName,
814
814
  eventValue: eventValue
815
815
  });
816
- return eventLog ? eventLog.values[eventValue] : undefined;
816
+ return eventLog ? eventLog.args[eventValue] : undefined;
817
817
  };
818
818
 
819
819
  exports.FormatBlockNumbers = /*#__PURE__*/function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.45",
3
+ "version": "4.0.1",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -74,7 +74,7 @@
74
74
  "crocks": "^0.12.4",
75
75
  "deep-equal": "^1.0.1",
76
76
  "ellipsize": "^0.1.0",
77
- "ethers": "^4.0.26",
77
+ "ethers": "^5.7.2",
78
78
  "fraction.js": "^4.0.12",
79
79
  "hash.js": "^1.1.7",
80
80
  "image-type": "^4.1.0",
@@ -204,7 +204,7 @@ class AuthorizationClient {
204
204
  addr: Utils.FormatAddress(((this.client.signer && this.client.signer.address) || ""))
205
205
  };
206
206
 
207
- if(!(this.noAuth || noAuth)) {
207
+ if(update) {
208
208
  const { transactionHash } = await this.MakeAccessRequest({
209
209
  libraryId,
210
210
  objectId,
@@ -344,8 +344,8 @@ class AuthorizationClient {
344
344
 
345
345
  // Save request ID if present
346
346
  accessRequest.logs.some(log => {
347
- if(log.values && (log.values.requestID || log.values.requestNonce)) {
348
- this.requestIds[address] = (log.values.requestID || log.values.requestNonce || "").toString().replace(/^0x/, "");
347
+ if(log.args && (log.args.requestID || log.args.requestNonce)) {
348
+ this.requestIds[address] = (log.args.requestID || log.args.requestNonce || "").toString().replace(/^0x/, "");
349
349
  return true;
350
350
  }
351
351
  });
@@ -653,12 +653,12 @@ class AuthorizationClient {
653
653
  if(!isV3) {
654
654
  if(args && args.length > 0) {
655
655
  // Inject public key of requester
656
- args[1] = this.client.signer.signingKey ? this.client.signer.signingKey.publicKey : "";
656
+ args[1] = this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "";
657
657
  } else {
658
658
  // Set default args
659
659
  args = [
660
660
  0, // Access level
661
- this.client.signer.signingKey ? this.client.signer.signingKey.publicKey : "", // Public key of requester
661
+ this.client.signer._signingKey ? this.client.signer._signingKey().publicKey : "", // Public key of requester
662
662
  publicKey, //cap.public_key,
663
663
  [], // Custom values
664
664
  [] // Stakeholders
@@ -803,7 +803,7 @@ class AuthorizationClient {
803
803
  return await Ethers.utils.joinSignature(
804
804
  this.client.signer.signDigest ?
805
805
  await this.client.signer.signDigest(message) :
806
- await this.client.signer.signingKey.signDigest(message)
806
+ await this.client.signer._signingKey().signDigest(message)
807
807
  );
808
808
  }
809
809