@eluvio/elv-client-js 3.2.44 → 4.0.0

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.
@@ -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;
@@ -1479,7 +1479,7 @@ var ElvClient = /*#__PURE__*/function () {
1479
1479
  case 3:
1480
1480
  ValidatePresence("message", message);
1481
1481
  _context17.next = 6;
1482
- return this.Crypto.EncryptConk(message, publicKey || this.signer.signingKey.keyPair.publicKey);
1482
+ return this.Crypto.EncryptConk(message, publicKey || this.signer._signingKey().publicKey);
1483
1483
 
1484
1484
  case 6:
1485
1485
  return _context17.abrupt("return", _context17.sent);
@@ -1528,7 +1528,7 @@ var ElvClient = /*#__PURE__*/function () {
1528
1528
  case 3:
1529
1529
  ValidatePresence("message", message);
1530
1530
  _context18.next = 6;
1531
- return this.Crypto.DecryptCap(message, this.signer.signingKey.privateKey);
1531
+ return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
1532
1532
 
1533
1533
  case 6:
1534
1534
  return _context18.abrupt("return", _context18.sent);
@@ -1598,7 +1598,7 @@ var ElvClient = /*#__PURE__*/function () {
1598
1598
  value: function FrameAllowedMethods() {
1599
1599
  var _this2 = this;
1600
1600
 
1601
- var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1601
+ var forbiddenMethods = ["constructor", "AccessGroupMembershipMethod", "CallFromFrameMessage", "ClearSigner", "CreateAccount", "EnableMethodLogging", "FormatBlockNumbers", "FrameAllowedMethods", "FromConfigurationUrl", "GenerateWallet", "InitializeClients", "Log", "PersonalSign", "SetRemoteSigner", "SetSigner", "SetSignerFromWeb3Provider", "Sign", "ToggleLogging"];
1602
1602
  return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(function (method) {
1603
1603
  return typeof _this2[method] === "function" && !forbiddenMethods.includes(method);
1604
1604
  });
@@ -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",
@@ -41,8 +41,8 @@ var HttpClient = /*#__PURE__*/function () {
41
41
  }
42
42
  }, {
43
43
  key: "RecordWriteToken",
44
- value: function RecordWriteToken(writeToken) {
45
- this.draftURIs[writeToken] = this.BaseURI();
44
+ value: function RecordWriteToken(writeToken, nodeUrlStr) {
45
+ this.draftURIs[writeToken] = nodeUrlStr ? new URI(nodeUrlStr) : this.BaseURI();
46
46
  }
47
47
  }, {
48
48
  key: "RequestHeaders",
@@ -74,7 +74,7 @@ var HttpClient = /*#__PURE__*/function () {
74
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
75
  baseURI = this.BaseURI(); // If URL contains a write token, it must go to the correct server and can not fail over
76
76
 
77
- writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw_[a-zA-Z0-9]+)/);
77
+ writeTokenMatch = path.replace(/^\//, "").match(/(qlibs\/ilib[a-zA-Z0-9]+|q|qid)\/(tqw__[a-zA-Z0-9]+)/);
78
78
  writeToken = writeTokenMatch ? writeTokenMatch[2] : undefined;
79
79
 
80
80
  if (writeToken) {