@eluvio/elv-client-js 4.2.13 → 4.2.14

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 (45) hide show
  1. package/dist/ElvClient-min.js +1 -1
  2. package/dist/ElvClient-node-min.js +1 -1
  3. package/dist/ElvFrameClient-min.js +1 -1
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +1 -1
  6. package/dist/ElvWalletClient-node-min.js +1 -1
  7. package/dist/src/AuthorizationClient.js +723 -710
  8. package/dist/src/ContentObjectAudit.js +56 -56
  9. package/dist/src/Crypto.js +85 -85
  10. package/dist/src/ElvClient.js +502 -530
  11. package/dist/src/ElvWallet.js +28 -30
  12. package/dist/src/EthClient.js +311 -311
  13. package/dist/src/FrameClient.js +65 -64
  14. package/dist/src/HttpClient.js +60 -60
  15. package/dist/src/Id.js +2 -1
  16. package/dist/src/PermissionsClient.js +487 -499
  17. package/dist/src/RemoteSigner.js +178 -123
  18. package/dist/src/UserProfileClient.js +374 -392
  19. package/dist/src/Utils.js +66 -69
  20. package/dist/src/Validation.js +10 -10
  21. package/dist/src/client/ABRPublishing.js +239 -239
  22. package/dist/src/client/AccessGroups.js +474 -477
  23. package/dist/src/client/ContentAccess.js +1713 -1708
  24. package/dist/src/client/ContentManagement.js +871 -871
  25. package/dist/src/client/Contracts.js +736 -582
  26. package/dist/src/client/Files.js +684 -700
  27. package/dist/src/client/LiveConf.js +6 -1
  28. package/dist/src/client/LiveStream.js +686 -722
  29. package/dist/src/client/NFT.js +14 -14
  30. package/dist/src/client/NTP.js +84 -84
  31. package/dist/src/client/Shares.js +60 -53
  32. package/dist/src/walletClient/ClientMethods.js +951 -977
  33. package/dist/src/walletClient/Notifications.js +14 -14
  34. package/dist/src/walletClient/Profile.js +66 -66
  35. package/dist/src/walletClient/Utils.js +15 -15
  36. package/dist/src/walletClient/index.js +584 -581
  37. package/package.json +3 -2
  38. package/src/ElvClient.js +2 -1
  39. package/src/FrameClient.js +3 -0
  40. package/src/LogMessage.js +1 -1
  41. package/src/RemoteSigner.js +17 -3
  42. package/src/client/ABRPublishing.js +1 -1
  43. package/src/client/ContentAccess.js +16 -13
  44. package/src/client/Contracts.js +88 -7
  45. package/src/walletClient/index.js +15 -4
@@ -36,18 +36,18 @@ var Utils = require("../Utils");
36
36
  * @return {Promise<string>} - Name of the contract
37
37
  */
38
38
  exports.ContractName = /*#__PURE__*/function () {
39
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
39
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
40
40
  var contractAddress;
41
- return _regeneratorRuntime.wrap(function (_context) {
41
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
42
42
  while (1) switch (_context.prev = _context.next) {
43
43
  case 0:
44
44
  contractAddress = _ref.contractAddress;
45
45
  contractAddress = ValidateAddress(contractAddress);
46
- _context.next = 1;
46
+ _context.next = 4;
47
47
  return this.ethClient.ContractName(contractAddress);
48
- case 1:
48
+ case 4:
49
49
  return _context.abrupt("return", _context.sent);
50
- case 2:
50
+ case 5:
51
51
  case "end":
52
52
  return _context.stop();
53
53
  }
@@ -71,27 +71,27 @@ exports.ContractName = /*#__PURE__*/function () {
71
71
  * @throws If ABI is not able to be determined, throws an error
72
72
  */
73
73
  exports.ContractAbi = /*#__PURE__*/function () {
74
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
74
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
75
75
  var contractAddress, id, contractInfo;
76
- return _regeneratorRuntime.wrap(function (_context2) {
76
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
77
77
  while (1) switch (_context2.prev = _context2.next) {
78
78
  case 0:
79
79
  contractAddress = _ref3.contractAddress, id = _ref3.id;
80
- _context2.next = 1;
80
+ _context2.next = 3;
81
81
  return this.authClient.ContractInfo({
82
82
  address: contractAddress,
83
83
  id: id
84
84
  });
85
- case 1:
85
+ case 3:
86
86
  contractInfo = _context2.sent;
87
87
  if (contractInfo) {
88
- _context2.next = 2;
88
+ _context2.next = 6;
89
89
  break;
90
90
  }
91
91
  throw Error("Unable to determine contract info for ".concat(contractAddress));
92
- case 2:
92
+ case 6:
93
93
  return _context2.abrupt("return", contractInfo.abi);
94
- case 3:
94
+ case 7:
95
95
  case "end":
96
96
  return _context2.stop();
97
97
  }
@@ -113,9 +113,9 @@ exports.ContractAbi = /*#__PURE__*/function () {
113
113
  * @return {Promise<Object>} - The ABI, access type, and isV3 for the given contract
114
114
  */
115
115
  exports.ContractInfo = /*#__PURE__*/function () {
116
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
116
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
117
117
  var id, address;
118
- return _regeneratorRuntime.wrap(function (_context3) {
118
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
119
119
  while (1) switch (_context3.prev = _context3.next) {
120
120
  case 0:
121
121
  id = _ref5.id, address = _ref5.address;
@@ -123,7 +123,7 @@ exports.ContractInfo = /*#__PURE__*/function () {
123
123
  id: id,
124
124
  address: address
125
125
  }));
126
- case 1:
126
+ case 2:
127
127
  case "end":
128
128
  return _context3.stop();
129
129
  }
@@ -169,13 +169,13 @@ exports.FormatContractArguments = function (_ref7) {
169
169
  * @returns {Promise<Object>} - Response containing the deployed contract address and the transaction hash of the deployment
170
170
  */
171
171
  exports.DeployContract = /*#__PURE__*/function () {
172
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8) {
172
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8) {
173
173
  var abi, bytecode, constructorArgs, _ref8$overrides, overrides;
174
- return _regeneratorRuntime.wrap(function (_context4) {
174
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
175
175
  while (1) switch (_context4.prev = _context4.next) {
176
176
  case 0:
177
177
  abi = _ref8.abi, bytecode = _ref8.bytecode, constructorArgs = _ref8.constructorArgs, _ref8$overrides = _ref8.overrides, overrides = _ref8$overrides === void 0 ? {} : _ref8$overrides;
178
- _context4.next = 1;
178
+ _context4.next = 3;
179
179
  return this.ethClient.DeployContract({
180
180
  abi: abi,
181
181
  bytecode: bytecode,
@@ -183,9 +183,9 @@ exports.DeployContract = /*#__PURE__*/function () {
183
183
  overrides: overrides,
184
184
  signer: this.signer
185
185
  });
186
- case 1:
186
+ case 3:
187
187
  return _context4.abrupt("return", _context4.sent);
188
- case 2:
188
+ case 4:
189
189
  case "end":
190
190
  return _context4.stop();
191
191
  }
@@ -211,34 +211,34 @@ exports.DeployContract = /*#__PURE__*/function () {
211
211
  * @returns {Promise<Array<Array<Object>>>} - List of blocks, in ascending order by block number, each containing a list of the events in the block.
212
212
  */
213
213
  exports.ContractEvents = /*#__PURE__*/function () {
214
- var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref0) {
215
- var contractAddress, abi, _ref0$fromBlock, fromBlock, toBlock, _ref0$count, count, topics, _ref0$includeTransact, includeTransaction, blocks;
216
- return _regeneratorRuntime.wrap(function (_context5) {
214
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref10) {
215
+ var contractAddress, abi, _ref10$fromBlock, fromBlock, toBlock, _ref10$count, count, topics, _ref10$includeTransac, includeTransaction, blocks;
216
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
217
217
  while (1) switch (_context5.prev = _context5.next) {
218
218
  case 0:
219
- contractAddress = _ref0.contractAddress, abi = _ref0.abi, _ref0$fromBlock = _ref0.fromBlock, fromBlock = _ref0$fromBlock === void 0 ? 0 : _ref0$fromBlock, toBlock = _ref0.toBlock, _ref0$count = _ref0.count, count = _ref0$count === void 0 ? 1000 : _ref0$count, topics = _ref0.topics, _ref0$includeTransact = _ref0.includeTransaction, includeTransaction = _ref0$includeTransact === void 0 ? false : _ref0$includeTransact;
219
+ contractAddress = _ref10.contractAddress, abi = _ref10.abi, _ref10$fromBlock = _ref10.fromBlock, fromBlock = _ref10$fromBlock === void 0 ? 0 : _ref10$fromBlock, toBlock = _ref10.toBlock, _ref10$count = _ref10.count, count = _ref10$count === void 0 ? 1000 : _ref10$count, topics = _ref10.topics, _ref10$includeTransac = _ref10.includeTransaction, includeTransaction = _ref10$includeTransac === void 0 ? false : _ref10$includeTransac;
220
220
  contractAddress = ValidateAddress(contractAddress);
221
221
  if (abi) {
222
- _context5.next = 2;
222
+ _context5.next = 6;
223
223
  break;
224
224
  }
225
- _context5.next = 1;
225
+ _context5.next = 5;
226
226
  return this.ContractAbi({
227
227
  contractAddress: contractAddress
228
228
  });
229
- case 1:
229
+ case 5:
230
230
  abi = _context5.sent;
231
- case 2:
232
- _context5.next = 3;
231
+ case 6:
232
+ _context5.next = 8;
233
233
  return this.FormatBlockNumbers({
234
234
  fromBlock: fromBlock,
235
235
  toBlock: toBlock,
236
236
  count: count
237
237
  });
238
- case 3:
238
+ case 8:
239
239
  blocks = _context5.sent;
240
240
  this.Log("Querying contract events ".concat(contractAddress, " - Blocks ").concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
241
- _context5.next = 4;
241
+ _context5.next = 12;
242
242
  return this.ethClient.ContractEvents({
243
243
  contractAddress: contractAddress,
244
244
  abi: abi,
@@ -247,16 +247,16 @@ exports.ContractEvents = /*#__PURE__*/function () {
247
247
  topics: topics,
248
248
  includeTransaction: includeTransaction
249
249
  });
250
- case 4:
250
+ case 12:
251
251
  return _context5.abrupt("return", _context5.sent);
252
- case 5:
252
+ case 13:
253
253
  case "end":
254
254
  return _context5.stop();
255
255
  }
256
256
  }, _callee5, this);
257
257
  }));
258
258
  return function (_x5) {
259
- return _ref1.apply(this, arguments);
259
+ return _ref11.apply(this, arguments);
260
260
  };
261
261
  }();
262
262
 
@@ -279,12 +279,12 @@ exports.ContractEvents = /*#__PURE__*/function () {
279
279
  * @returns {Promise<*>} - Response containing information about the transaction
280
280
  */
281
281
  exports.CallContractMethod = /*#__PURE__*/function () {
282
- var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
283
- var contractAddress, abi, methodName, _ref10$methodArgs, methodArgs, value, _ref10$overrides, overrides, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract;
284
- return _regeneratorRuntime.wrap(function (_context6) {
282
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref12) {
283
+ var contractAddress, abi, methodName, _ref12$methodArgs, methodArgs, value, _ref12$overrides, overrides, _ref12$formatArgument, formatArguments, _ref12$cacheContract, cacheContract, _ref12$overrideCached, overrideCachedContract;
284
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
285
285
  while (1) switch (_context6.prev = _context6.next) {
286
286
  case 0:
287
- contractAddress = _ref10.contractAddress, abi = _ref10.abi, methodName = _ref10.methodName, _ref10$methodArgs = _ref10.methodArgs, methodArgs = _ref10$methodArgs === void 0 ? [] : _ref10$methodArgs, value = _ref10.value, _ref10$overrides = _ref10.overrides, overrides = _ref10$overrides === void 0 ? {} : _ref10$overrides, _ref10$formatArgument = _ref10.formatArguments, formatArguments = _ref10$formatArgument === void 0 ? true : _ref10$formatArgument, _ref10$cacheContract = _ref10.cacheContract, cacheContract = _ref10$cacheContract === void 0 ? true : _ref10$cacheContract, _ref10$overrideCached = _ref10.overrideCachedContract, overrideCachedContract = _ref10$overrideCached === void 0 ? false : _ref10$overrideCached;
287
+ contractAddress = _ref12.contractAddress, abi = _ref12.abi, methodName = _ref12.methodName, _ref12$methodArgs = _ref12.methodArgs, methodArgs = _ref12$methodArgs === void 0 ? [] : _ref12$methodArgs, value = _ref12.value, _ref12$overrides = _ref12.overrides, overrides = _ref12$overrides === void 0 ? {} : _ref12$overrides, _ref12$formatArgument = _ref12.formatArguments, formatArguments = _ref12$formatArgument === void 0 ? true : _ref12$formatArgument, _ref12$cacheContract = _ref12.cacheContract, cacheContract = _ref12$cacheContract === void 0 ? true : _ref12$cacheContract, _ref12$overrideCached = _ref12.overrideCachedContract, overrideCachedContract = _ref12$overrideCached === void 0 ? false : _ref12$overrideCached;
288
288
  contractAddress = ValidateAddress(contractAddress);
289
289
 
290
290
  // Delete cached visibility value if it is being changed
@@ -293,17 +293,17 @@ exports.CallContractMethod = /*#__PURE__*/function () {
293
293
  delete this.visibilityInfo[contractAddress];
294
294
  }
295
295
  if (abi) {
296
- _context6.next = 2;
296
+ _context6.next = 8;
297
297
  break;
298
298
  }
299
- _context6.next = 1;
299
+ _context6.next = 7;
300
300
  return this.ContractAbi({
301
301
  contractAddress: contractAddress
302
302
  });
303
- case 1:
303
+ case 7:
304
304
  abi = _context6.sent;
305
- case 2:
306
- _context6.next = 3;
305
+ case 8:
306
+ _context6.next = 10;
307
307
  return this.ethClient.CallContractMethod({
308
308
  contractAddress: contractAddress,
309
309
  abi: abi,
@@ -315,16 +315,16 @@ exports.CallContractMethod = /*#__PURE__*/function () {
315
315
  cacheContract: cacheContract,
316
316
  overrideCachedContract: overrideCachedContract
317
317
  });
318
- case 3:
318
+ case 10:
319
319
  return _context6.abrupt("return", _context6.sent);
320
- case 4:
320
+ case 11:
321
321
  case "end":
322
322
  return _context6.stop();
323
323
  }
324
324
  }, _callee6, this);
325
325
  }));
326
326
  return function (_x6) {
327
- return _ref11.apply(this, arguments);
327
+ return _ref13.apply(this, arguments);
328
328
  };
329
329
  }();
330
330
 
@@ -350,12 +350,12 @@ exports.CallContractMethod = /*#__PURE__*/function () {
350
350
  * the resulting event(s)
351
351
  */
352
352
  exports.CallContractMethodAndWait = /*#__PURE__*/function () {
353
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref12) {
354
- var contractAddress, abi, methodName, methodArgs, value, _ref12$overrides, overrides, _ref12$formatArgument, formatArguments, _ref12$cacheContract, cacheContract, _ref12$overrideCached, overrideCachedContract;
355
- return _regeneratorRuntime.wrap(function (_context7) {
353
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref14) {
354
+ var contractAddress, abi, methodName, methodArgs, value, _ref14$overrides, overrides, _ref14$formatArgument, formatArguments, _ref14$cacheContract, cacheContract, _ref14$overrideCached, overrideCachedContract;
355
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
356
356
  while (1) switch (_context7.prev = _context7.next) {
357
357
  case 0:
358
- contractAddress = _ref12.contractAddress, abi = _ref12.abi, methodName = _ref12.methodName, methodArgs = _ref12.methodArgs, value = _ref12.value, _ref12$overrides = _ref12.overrides, overrides = _ref12$overrides === void 0 ? {} : _ref12$overrides, _ref12$formatArgument = _ref12.formatArguments, formatArguments = _ref12$formatArgument === void 0 ? true : _ref12$formatArgument, _ref12$cacheContract = _ref12.cacheContract, cacheContract = _ref12$cacheContract === void 0 ? true : _ref12$cacheContract, _ref12$overrideCached = _ref12.overrideCachedContract, overrideCachedContract = _ref12$overrideCached === void 0 ? false : _ref12$overrideCached;
358
+ contractAddress = _ref14.contractAddress, abi = _ref14.abi, methodName = _ref14.methodName, methodArgs = _ref14.methodArgs, value = _ref14.value, _ref14$overrides = _ref14.overrides, overrides = _ref14$overrides === void 0 ? {} : _ref14$overrides, _ref14$formatArgument = _ref14.formatArguments, formatArguments = _ref14$formatArgument === void 0 ? true : _ref14$formatArgument, _ref14$cacheContract = _ref14.cacheContract, cacheContract = _ref14$cacheContract === void 0 ? true : _ref14$cacheContract, _ref14$overrideCached = _ref14.overrideCachedContract, overrideCachedContract = _ref14$overrideCached === void 0 ? false : _ref14$overrideCached;
359
359
  contractAddress = ValidateAddress(contractAddress);
360
360
 
361
361
  // Delete cached visibility value if it is being changed
@@ -364,17 +364,17 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
364
364
  delete this.visibilityInfo[contractAddress];
365
365
  }
366
366
  if (abi) {
367
- _context7.next = 2;
367
+ _context7.next = 8;
368
368
  break;
369
369
  }
370
- _context7.next = 1;
370
+ _context7.next = 7;
371
371
  return this.ContractAbi({
372
372
  contractAddress: contractAddress
373
373
  });
374
- case 1:
374
+ case 7:
375
375
  abi = _context7.sent;
376
- case 2:
377
- _context7.next = 3;
376
+ case 8:
377
+ _context7.next = 10;
378
378
  return this.ethClient.CallContractMethodAndWait({
379
379
  contractAddress: contractAddress,
380
380
  abi: abi,
@@ -386,16 +386,16 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
386
386
  cacheContract: cacheContract,
387
387
  overrideCachedContract: overrideCachedContract
388
388
  });
389
- case 3:
389
+ case 10:
390
390
  return _context7.abrupt("return", _context7.sent);
391
- case 4:
391
+ case 11:
392
392
  case "end":
393
393
  return _context7.stop();
394
394
  }
395
395
  }, _callee7, this);
396
396
  }));
397
397
  return function (_x7) {
398
- return _ref13.apply(this, arguments);
398
+ return _ref15.apply(this, arguments);
399
399
  };
400
400
  }();
401
401
 
@@ -410,42 +410,45 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
410
410
  * @return {Promise<Object|string>}
411
411
  */
412
412
  exports.ContractMetadata = /*#__PURE__*/function () {
413
- var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref14) {
414
- var contractAddress, metadataKey, metadata, data, _t, _t2;
415
- return _regeneratorRuntime.wrap(function (_context8) {
413
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref16) {
414
+ var contractAddress, metadataKey, metadata, data;
415
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
416
416
  while (1) switch (_context8.prev = _context8.next) {
417
417
  case 0:
418
- contractAddress = _ref14.contractAddress, metadataKey = _ref14.metadataKey;
418
+ contractAddress = _ref16.contractAddress, metadataKey = _ref16.metadataKey;
419
419
  ValidatePresence("contractAddress", contractAddress);
420
420
  ValidatePresence("metadataKey", metadataKey);
421
- _context8.prev = 1;
422
- _context8.next = 2;
421
+ _context8.prev = 3;
422
+ _context8.next = 6;
423
423
  return this.CallContractMethod({
424
424
  contractAddress: contractAddress,
425
425
  methodName: "getMeta",
426
426
  methodArgs: [metadataKey]
427
427
  });
428
- case 2:
428
+ case 6:
429
429
  metadata = _context8.sent;
430
430
  data = Buffer.from((metadata || "").replace("0x", ""), "hex").toString("utf-8");
431
- _context8.prev = 3;
431
+ _context8.prev = 8;
432
432
  return _context8.abrupt("return", JSON.parse(data));
433
- case 4:
434
- _context8.prev = 4;
435
- _t = _context8["catch"](3);
433
+ case 12:
434
+ _context8.prev = 12;
435
+ _context8.t0 = _context8["catch"](8);
436
436
  return _context8.abrupt("return", data);
437
- case 5:
438
- _context8.prev = 5;
439
- _t2 = _context8["catch"](1);
437
+ case 15:
438
+ _context8.next = 20;
439
+ break;
440
+ case 17:
441
+ _context8.prev = 17;
442
+ _context8.t1 = _context8["catch"](3);
440
443
  return _context8.abrupt("return", "");
441
- case 6:
444
+ case 20:
442
445
  case "end":
443
446
  return _context8.stop();
444
447
  }
445
- }, _callee8, this, [[1, 5], [3, 4]]);
448
+ }, _callee8, this, [[3, 17], [8, 12]]);
446
449
  }));
447
450
  return function (_x8) {
448
- return _ref15.apply(this, arguments);
451
+ return _ref17.apply(this, arguments);
449
452
  };
450
453
  }();
451
454
 
@@ -459,45 +462,45 @@ exports.ContractMetadata = /*#__PURE__*/function () {
459
462
  * @param {string} metadata
460
463
  */
461
464
  exports.MergeContractMetadata = /*#__PURE__*/function () {
462
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref16) {
463
- var contractAddress, metadataKey, metadata, existingMetadata, _t3;
464
- return _regeneratorRuntime.wrap(function (_context9) {
465
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref18) {
466
+ var contractAddress, metadataKey, metadata, existingMetadata;
467
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
465
468
  while (1) switch (_context9.prev = _context9.next) {
466
469
  case 0:
467
- contractAddress = _ref16.contractAddress, metadataKey = _ref16.metadataKey, metadata = _ref16.metadata;
470
+ contractAddress = _ref18.contractAddress, metadataKey = _ref18.metadataKey, metadata = _ref18.metadata;
468
471
  ValidatePresence("contractAddress", contractAddress);
469
472
  ValidatePresence("metadataKey", metadataKey);
470
- _context9.next = 1;
473
+ _context9.next = 5;
471
474
  return this.ContractMetadata({
472
475
  contractAddress: contractAddress,
473
476
  metadataKey: metadataKey
474
477
  });
475
- case 1:
476
- _t3 = _context9.sent;
477
- if (_t3) {
478
- _context9.next = 2;
478
+ case 5:
479
+ _context9.t0 = _context9.sent;
480
+ if (_context9.t0) {
481
+ _context9.next = 8;
479
482
  break;
480
483
  }
481
- _t3 = {};
482
- case 2:
483
- existingMetadata = _t3;
484
+ _context9.t0 = {};
485
+ case 8:
486
+ existingMetadata = _context9.t0;
484
487
  if (_typeof(existingMetadata) === "object") {
485
488
  metadata = _objectSpread(_objectSpread({}, existingMetadata), metadata);
486
489
  }
487
- _context9.next = 3;
490
+ _context9.next = 12;
488
491
  return this.CallContractMethodAndWait({
489
492
  contractAddress: contractAddress,
490
493
  methodName: "putMeta",
491
494
  methodArgs: [metadataKey, JSON.stringify(metadata)]
492
495
  });
493
- case 3:
496
+ case 12:
494
497
  case "end":
495
498
  return _context9.stop();
496
499
  }
497
500
  }, _callee9, this);
498
501
  }));
499
502
  return function (_x9) {
500
- return _ref17.apply(this, arguments);
503
+ return _ref19.apply(this, arguments);
501
504
  };
502
505
  }();
503
506
 
@@ -511,31 +514,31 @@ exports.MergeContractMetadata = /*#__PURE__*/function () {
511
514
  * @param {string|Object} metadata - The metadata to insert
512
515
  */
513
516
  exports.ReplaceContractMetadata = /*#__PURE__*/function () {
514
- var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref18) {
517
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref20) {
515
518
  var contractAddress, metadataKey, metadata;
516
- return _regeneratorRuntime.wrap(function (_context0) {
517
- while (1) switch (_context0.prev = _context0.next) {
519
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
520
+ while (1) switch (_context10.prev = _context10.next) {
518
521
  case 0:
519
- contractAddress = _ref18.contractAddress, metadataKey = _ref18.metadataKey, metadata = _ref18.metadata;
522
+ contractAddress = _ref20.contractAddress, metadataKey = _ref20.metadataKey, metadata = _ref20.metadata;
520
523
  ValidatePresence("contractAddress", contractAddress);
521
524
  ValidatePresence("metadataKey", metadataKey);
522
525
  if (_typeof(metadata) === "object") {
523
526
  metadata = JSON.stringify(metadata);
524
527
  }
525
- _context0.next = 1;
528
+ _context10.next = 6;
526
529
  return this.CallContractMethodAndWait({
527
530
  contractAddress: contractAddress,
528
531
  methodName: "putMeta",
529
532
  methodArgs: [metadataKey, metadata]
530
533
  });
531
- case 1:
534
+ case 6:
532
535
  case "end":
533
- return _context0.stop();
536
+ return _context10.stop();
534
537
  }
535
- }, _callee0, this);
538
+ }, _callee10, this);
536
539
  }));
537
- return function (_x0) {
538
- return _ref19.apply(this, arguments);
540
+ return function (_x10) {
541
+ return _ref21.apply(this, arguments);
539
542
  };
540
543
  }();
541
544
 
@@ -551,12 +554,12 @@ exports.ReplaceContractMetadata = /*#__PURE__*/function () {
551
554
  * @returns {Promise<string> | undefined} - If the object has a custom contract, this will return the address of the custom contract
552
555
  */
553
556
  exports.CustomContractAddress = /*#__PURE__*/function () {
554
- var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref20) {
557
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref22) {
555
558
  var libraryId, objectId, versionHash, abi, customContractAddress;
556
- return _regeneratorRuntime.wrap(function (_context1) {
557
- while (1) switch (_context1.prev = _context1.next) {
559
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
560
+ while (1) switch (_context11.prev = _context11.next) {
558
561
  case 0:
559
- libraryId = _ref20.libraryId, objectId = _ref20.objectId, versionHash = _ref20.versionHash;
562
+ libraryId = _ref22.libraryId, objectId = _ref22.objectId, versionHash = _ref22.versionHash;
560
563
  ValidateParameters({
561
564
  libraryId: libraryId,
562
565
  objectId: objectId,
@@ -566,42 +569,42 @@ exports.CustomContractAddress = /*#__PURE__*/function () {
566
569
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
567
570
  }
568
571
  if (!(libraryId === this.contentSpaceLibraryId || this.utils.EqualHash(libraryId, objectId))) {
569
- _context1.next = 1;
572
+ _context11.next = 5;
570
573
  break;
571
574
  }
572
- return _context1.abrupt("return");
573
- case 1:
575
+ return _context11.abrupt("return");
576
+ case 5:
574
577
  this.Log("Retrieving custom contract address: ".concat(objectId));
575
- _context1.next = 2;
578
+ _context11.next = 8;
576
579
  return this.ContractAbi({
577
580
  id: objectId
578
581
  });
579
- case 2:
580
- abi = _context1.sent;
581
- _context1.next = 3;
582
+ case 8:
583
+ abi = _context11.sent;
584
+ _context11.next = 11;
582
585
  return this.ethClient.CallContractMethod({
583
586
  contractAddress: this.utils.HashToAddress(objectId),
584
587
  abi: abi,
585
588
  methodName: "contentContractAddress",
586
589
  methodArgs: []
587
590
  });
588
- case 3:
589
- customContractAddress = _context1.sent;
591
+ case 11:
592
+ customContractAddress = _context11.sent;
590
593
  if (!(customContractAddress === this.utils.nullAddress)) {
591
- _context1.next = 4;
594
+ _context11.next = 14;
592
595
  break;
593
596
  }
594
- return _context1.abrupt("return");
595
- case 4:
596
- return _context1.abrupt("return", this.utils.FormatAddress(customContractAddress));
597
- case 5:
597
+ return _context11.abrupt("return");
598
+ case 14:
599
+ return _context11.abrupt("return", this.utils.FormatAddress(customContractAddress));
600
+ case 15:
598
601
  case "end":
599
- return _context1.stop();
602
+ return _context11.stop();
600
603
  }
601
- }, _callee1, this);
604
+ }, _callee11, this);
602
605
  }));
603
- return function (_x1) {
604
- return _ref21.apply(this, arguments);
606
+ return function (_x11) {
607
+ return _ref23.apply(this, arguments);
605
608
  };
606
609
  }();
607
610
 
@@ -624,12 +627,12 @@ exports.CustomContractAddress = /*#__PURE__*/function () {
624
627
  * @returns {Promise<Object>} - Result transaction of calling the setCustomContract method on the content object contract
625
628
  */
626
629
  exports.SetCustomContentContract = /*#__PURE__*/function () {
627
- var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref22) {
628
- var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref22$overrides, overrides, setResult, writeToken;
629
- return _regeneratorRuntime.wrap(function (_context10) {
630
- while (1) switch (_context10.prev = _context10.next) {
630
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref24) {
631
+ var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref24$overrides, overrides, setResult, writeToken;
632
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
633
+ while (1) switch (_context12.prev = _context12.next) {
631
634
  case 0:
632
- libraryId = _ref22.libraryId, objectId = _ref22.objectId, customContractAddress = _ref22.customContractAddress, name = _ref22.name, description = _ref22.description, abi = _ref22.abi, factoryAbi = _ref22.factoryAbi, _ref22$overrides = _ref22.overrides, overrides = _ref22$overrides === void 0 ? {} : _ref22$overrides;
635
+ libraryId = _ref24.libraryId, objectId = _ref24.objectId, customContractAddress = _ref24.customContractAddress, name = _ref24.name, description = _ref24.description, abi = _ref24.abi, factoryAbi = _ref24.factoryAbi, _ref24$overrides = _ref24.overrides, overrides = _ref24$overrides === void 0 ? {} : _ref24$overrides;
633
636
  ValidateParameters({
634
637
  libraryId: libraryId,
635
638
  objectId: objectId
@@ -637,23 +640,23 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
637
640
  customContractAddress = ValidateAddress(customContractAddress);
638
641
  customContractAddress = this.utils.FormatAddress(customContractAddress);
639
642
  this.Log("Setting custom contract address: ".concat(objectId, " ").concat(customContractAddress));
640
- _context10.next = 1;
643
+ _context12.next = 7;
641
644
  return this.ethClient.SetCustomContentContract({
642
645
  contentContractAddress: this.utils.HashToAddress(objectId),
643
646
  customContractAddress: customContractAddress,
644
647
  overrides: overrides,
645
648
  signer: this.signer
646
649
  });
647
- case 1:
648
- setResult = _context10.sent;
649
- _context10.next = 2;
650
+ case 7:
651
+ setResult = _context12.sent;
652
+ _context12.next = 10;
650
653
  return this.EditContentObject({
651
654
  libraryId: libraryId,
652
655
  objectId: objectId
653
656
  });
654
- case 2:
655
- writeToken = _context10.sent.write_token;
656
- _context10.next = 3;
657
+ case 10:
658
+ writeToken = _context12.sent.write_token;
659
+ _context12.next = 13;
657
660
  return this.ReplaceMetadata({
658
661
  libraryId: libraryId,
659
662
  objectId: objectId,
@@ -667,24 +670,24 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
667
670
  factoryAbi: factoryAbi
668
671
  }
669
672
  });
670
- case 3:
671
- _context10.next = 4;
673
+ case 13:
674
+ _context12.next = 15;
672
675
  return this.FinalizeContentObject({
673
676
  libraryId: libraryId,
674
677
  objectId: objectId,
675
678
  writeToken: writeToken,
676
679
  commitMessage: "Set custom contract"
677
680
  });
678
- case 4:
679
- return _context10.abrupt("return", setResult);
680
- case 5:
681
+ case 15:
682
+ return _context12.abrupt("return", setResult);
683
+ case 16:
681
684
  case "end":
682
- return _context10.stop();
685
+ return _context12.stop();
683
686
  }
684
- }, _callee10, this);
687
+ }, _callee12, this);
685
688
  }));
686
- return function (_x10) {
687
- return _ref23.apply(this, arguments);
689
+ return function (_x12) {
690
+ return _ref25.apply(this, arguments);
688
691
  };
689
692
  }();
690
693
 
@@ -703,10 +706,10 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
703
706
  *
704
707
  * @returns {Promise<Object>} - The parsed event log from the event
705
708
  */
706
- exports.ExtractEventFromLogs = function (_ref24) {
707
- var abi = _ref24.abi,
708
- event = _ref24.event,
709
- eventName = _ref24.eventName;
709
+ exports.ExtractEventFromLogs = function (_ref26) {
710
+ var abi = _ref26.abi,
711
+ event = _ref26.event,
712
+ eventName = _ref26.eventName;
710
713
  return this.ethClient.ExtractEventFromLogs({
711
714
  abi: abi,
712
715
  event: event,
@@ -728,11 +731,11 @@ exports.ExtractEventFromLogs = function (_ref24) {
728
731
  *
729
732
  * @returns {Promise<string>} The value extracted from the event
730
733
  */
731
- exports.ExtractValueFromEvent = function (_ref25) {
732
- var abi = _ref25.abi,
733
- event = _ref25.event,
734
- eventName = _ref25.eventName,
735
- eventValue = _ref25.eventValue;
734
+ exports.ExtractValueFromEvent = function (_ref27) {
735
+ var abi = _ref27.abi,
736
+ event = _ref27.event,
737
+ eventName = _ref27.eventName,
738
+ eventValue = _ref27.eventValue;
736
739
  var eventLog = this.ethClient.ExtractEventFromLogs({
737
740
  abi: abi,
738
741
  event: event,
@@ -742,16 +745,16 @@ exports.ExtractValueFromEvent = function (_ref25) {
742
745
  return eventLog ? eventLog.args[eventValue] : undefined;
743
746
  };
744
747
  exports.FormatBlockNumbers = /*#__PURE__*/function () {
745
- var _ref27 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref26) {
746
- var fromBlock, toBlock, _ref26$count, count, latestBlock;
747
- return _regeneratorRuntime.wrap(function (_context11) {
748
- while (1) switch (_context11.prev = _context11.next) {
748
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref28) {
749
+ var fromBlock, toBlock, _ref28$count, count, latestBlock;
750
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
751
+ while (1) switch (_context13.prev = _context13.next) {
749
752
  case 0:
750
- fromBlock = _ref26.fromBlock, toBlock = _ref26.toBlock, _ref26$count = _ref26.count, count = _ref26$count === void 0 ? 10 : _ref26$count;
751
- _context11.next = 1;
753
+ fromBlock = _ref28.fromBlock, toBlock = _ref28.toBlock, _ref28$count = _ref28.count, count = _ref28$count === void 0 ? 10 : _ref28$count;
754
+ _context13.next = 3;
752
755
  return this.BlockNumber();
753
- case 1:
754
- latestBlock = _context11.sent;
756
+ case 3:
757
+ latestBlock = _context13.sent;
755
758
  if (!toBlock) {
756
759
  if (!fromBlock) {
757
760
  toBlock = latestBlock;
@@ -770,18 +773,18 @@ exports.FormatBlockNumbers = /*#__PURE__*/function () {
770
773
  if (fromBlock < 0) {
771
774
  fromBlock = 0;
772
775
  }
773
- return _context11.abrupt("return", {
776
+ return _context13.abrupt("return", {
774
777
  fromBlock: fromBlock,
775
778
  toBlock: toBlock
776
779
  });
777
- case 2:
780
+ case 8:
778
781
  case "end":
779
- return _context11.stop();
782
+ return _context13.stop();
780
783
  }
781
- }, _callee11, this);
784
+ }, _callee13, this);
782
785
  }));
783
- return function (_x11) {
784
- return _ref27.apply(this, arguments);
786
+ return function (_x13) {
787
+ return _ref29.apply(this, arguments);
785
788
  };
786
789
  }();
787
790
 
@@ -799,42 +802,42 @@ exports.FormatBlockNumbers = /*#__PURE__*/function () {
799
802
  * Note: This requires two extra network calls per transaction, so it should not be used for very large ranges
800
803
  * @returns {Promise<Array<Array<Object>>>} - List of blocks, in ascending order by block number, each containing a list of the events in the block.
801
804
  */
802
- exports.Events = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
803
- var _ref29,
805
+ exports.Events = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
806
+ var _ref31,
804
807
  toBlock,
805
808
  fromBlock,
806
- _ref29$count,
809
+ _ref31$count,
807
810
  count,
808
- _ref29$includeTransac,
811
+ _ref31$includeTransac,
809
812
  includeTransaction,
810
813
  blocks,
811
- _args12 = arguments;
812
- return _regeneratorRuntime.wrap(function (_context12) {
813
- while (1) switch (_context12.prev = _context12.next) {
814
+ _args14 = arguments;
815
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
816
+ while (1) switch (_context14.prev = _context14.next) {
814
817
  case 0:
815
- _ref29 = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {}, toBlock = _ref29.toBlock, fromBlock = _ref29.fromBlock, _ref29$count = _ref29.count, count = _ref29$count === void 0 ? 10 : _ref29$count, _ref29$includeTransac = _ref29.includeTransaction, includeTransaction = _ref29$includeTransac === void 0 ? false : _ref29$includeTransac;
816
- _context12.next = 1;
818
+ _ref31 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, toBlock = _ref31.toBlock, fromBlock = _ref31.fromBlock, _ref31$count = _ref31.count, count = _ref31$count === void 0 ? 10 : _ref31$count, _ref31$includeTransac = _ref31.includeTransaction, includeTransaction = _ref31$includeTransac === void 0 ? false : _ref31$includeTransac;
819
+ _context14.next = 3;
817
820
  return this.FormatBlockNumbers({
818
821
  fromBlock: fromBlock,
819
822
  toBlock: toBlock,
820
823
  count: count
821
824
  });
822
- case 1:
823
- blocks = _context12.sent;
825
+ case 3:
826
+ blocks = _context14.sent;
824
827
  this.Log("Querying events - Blocks ".concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
825
- _context12.next = 2;
828
+ _context14.next = 7;
826
829
  return this.ethClient.Events({
827
830
  fromBlock: blocks.fromBlock,
828
831
  toBlock: blocks.toBlock,
829
832
  includeTransaction: includeTransaction
830
833
  });
831
- case 2:
832
- return _context12.abrupt("return", _context12.sent);
833
- case 3:
834
+ case 7:
835
+ return _context14.abrupt("return", _context14.sent);
836
+ case 8:
834
837
  case "end":
835
- return _context12.stop();
838
+ return _context14.stop();
836
839
  }
837
- }, _callee12, this);
840
+ }, _callee14, this);
838
841
  }));
839
842
 
840
843
  /**
@@ -844,21 +847,21 @@ exports.Events = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime
844
847
  *
845
848
  * @returns {Promise<number>} - The latest block number
846
849
  */
847
- exports.BlockNumber = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
848
- return _regeneratorRuntime.wrap(function (_context13) {
849
- while (1) switch (_context13.prev = _context13.next) {
850
+ exports.BlockNumber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
851
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
852
+ while (1) switch (_context15.prev = _context15.next) {
850
853
  case 0:
851
- _context13.next = 1;
854
+ _context15.next = 2;
852
855
  return this.ethClient.MakeProviderCall({
853
856
  methodName: "getBlockNumber"
854
857
  });
855
- case 1:
856
- return _context13.abrupt("return", _context13.sent);
857
858
  case 2:
859
+ return _context15.abrupt("return", _context15.sent);
860
+ case 3:
858
861
  case "end":
859
- return _context13.stop();
862
+ return _context15.stop();
860
863
  }
861
- }, _callee13, this);
864
+ }, _callee15, this);
862
865
  }));
863
866
 
864
867
  /**
@@ -871,29 +874,29 @@ exports.BlockNumber = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRu
871
874
  * @returns {Promise<string>} - Balance of the account, in ether (as string)
872
875
  */
873
876
  exports.GetBalance = /*#__PURE__*/function () {
874
- var _ref32 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref31) {
877
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref33) {
875
878
  var address, balance;
876
- return _regeneratorRuntime.wrap(function (_context14) {
877
- while (1) switch (_context14.prev = _context14.next) {
879
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
880
+ while (1) switch (_context16.prev = _context16.next) {
878
881
  case 0:
879
- address = _ref31.address;
882
+ address = _ref33.address;
880
883
  address = ValidateAddress(address);
881
- _context14.next = 1;
884
+ _context16.next = 4;
882
885
  return this.ethClient.MakeProviderCall({
883
886
  methodName: "getBalance",
884
887
  args: [address]
885
888
  });
886
- case 1:
887
- balance = _context14.sent;
888
- return _context14.abrupt("return", Ethers.utils.formatEther(balance));
889
- case 2:
889
+ case 4:
890
+ balance = _context16.sent;
891
+ return _context16.abrupt("return", Ethers.utils.formatEther(balance));
892
+ case 6:
890
893
  case "end":
891
- return _context14.stop();
894
+ return _context16.stop();
892
895
  }
893
- }, _callee14, this);
896
+ }, _callee16, this);
894
897
  }));
895
- return function (_x12) {
896
- return _ref32.apply(this, arguments);
898
+ return function (_x14) {
899
+ return _ref34.apply(this, arguments);
897
900
  };
898
901
  }();
899
902
 
@@ -908,83 +911,83 @@ exports.GetBalance = /*#__PURE__*/function () {
908
911
  * @returns {Promise<Object>} - The transaction receipt
909
912
  */
910
913
  exports.SendFunds = /*#__PURE__*/function () {
911
- var _ref34 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref33) {
914
+ var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref35) {
912
915
  var recipient, ether, transaction;
913
- return _regeneratorRuntime.wrap(function (_context15) {
914
- while (1) switch (_context15.prev = _context15.next) {
916
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
917
+ while (1) switch (_context17.prev = _context17.next) {
915
918
  case 0:
916
- recipient = _ref33.recipient, ether = _ref33.ether;
919
+ recipient = _ref35.recipient, ether = _ref35.ether;
917
920
  recipient = ValidateAddress(recipient);
918
- _context15.next = 1;
921
+ _context17.next = 4;
919
922
  return this.signer.sendTransaction({
920
923
  to: recipient,
921
924
  value: Ethers.utils.parseEther(ether.toString())
922
925
  });
923
- case 1:
924
- transaction = _context15.sent;
925
- _context15.next = 2;
926
+ case 4:
927
+ transaction = _context17.sent;
928
+ _context17.next = 7;
926
929
  return transaction.wait();
927
- case 2:
928
- return _context15.abrupt("return", _context15.sent);
929
- case 3:
930
+ case 7:
931
+ return _context17.abrupt("return", _context17.sent);
932
+ case 8:
930
933
  case "end":
931
- return _context15.stop();
934
+ return _context17.stop();
932
935
  }
933
- }, _callee15, this);
936
+ }, _callee17, this);
934
937
  }));
935
- return function (_x13) {
936
- return _ref34.apply(this, arguments);
938
+ return function (_x15) {
939
+ return _ref36.apply(this, arguments);
937
940
  };
938
941
  }();
939
942
  var GetObjectIDAndContractAddress = /*#__PURE__*/function () {
940
- var _ref36 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref35) {
943
+ var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref37) {
941
944
  var contractAddress, objectId, versionHash;
942
- return _regeneratorRuntime.wrap(function (_context16) {
943
- while (1) switch (_context16.prev = _context16.next) {
945
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
946
+ while (1) switch (_context18.prev = _context18.next) {
944
947
  case 0:
945
- contractAddress = _ref35.contractAddress, objectId = _ref35.objectId, versionHash = _ref35.versionHash;
948
+ contractAddress = _ref37.contractAddress, objectId = _ref37.objectId, versionHash = _ref37.versionHash;
946
949
  if (!contractAddress) {
947
- _context16.next = 1;
950
+ _context18.next = 6;
948
951
  break;
949
952
  }
950
953
  ValidateAddress(contractAddress);
951
954
  objectId = Utils.AddressToObjectId(contractAddress);
952
- _context16.next = 4;
955
+ _context18.next = 18;
953
956
  break;
954
- case 1:
957
+ case 6:
955
958
  if (!versionHash) {
956
- _context16.next = 2;
959
+ _context18.next = 12;
957
960
  break;
958
961
  }
959
962
  ValidateVersion(versionHash);
960
963
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
961
964
  contractAddress = Utils.HashToAddress(objectId);
962
- _context16.next = 4;
965
+ _context18.next = 18;
963
966
  break;
964
- case 2:
967
+ case 12:
965
968
  if (!objectId) {
966
- _context16.next = 3;
969
+ _context18.next = 17;
967
970
  break;
968
971
  }
969
972
  ValidateObject(objectId);
970
973
  contractAddress = Utils.HashToAddress(objectId);
971
- _context16.next = 4;
974
+ _context18.next = 18;
972
975
  break;
973
- case 3:
976
+ case 17:
974
977
  throw Error("contractAddress or objectId or versionHash not specified");
975
- case 4:
976
- return _context16.abrupt("return", {
978
+ case 18:
979
+ return _context18.abrupt("return", {
977
980
  contractAddress: contractAddress,
978
981
  objectId: objectId
979
982
  });
980
- case 5:
983
+ case 19:
981
984
  case "end":
982
- return _context16.stop();
985
+ return _context18.stop();
983
986
  }
984
- }, _callee16, this);
987
+ }, _callee18, this);
985
988
  }));
986
- return function GetObjectIDAndContractAddress(_x14) {
987
- return _ref36.apply(this, arguments);
989
+ return function GetObjectIDAndContractAddress(_x16) {
990
+ return _ref38.apply(this, arguments);
988
991
  };
989
992
  }();
990
993
 
@@ -1000,74 +1003,74 @@ var GetObjectIDAndContractAddress = /*#__PURE__*/function () {
1000
1003
  * @returns {Promise<string|undefined>}
1001
1004
  */
1002
1005
  exports.TenantId = /*#__PURE__*/function () {
1003
- var _ref38 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref37) {
1004
- var contractAddress, objectId, versionHash, tenantId, hasGetMetaMethod, libraryId, _t4;
1005
- return _regeneratorRuntime.wrap(function (_context17) {
1006
- while (1) switch (_context17.prev = _context17.next) {
1006
+ var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref39) {
1007
+ var contractAddress, objectId, versionHash, tenantId, hasGetMetaMethod, libraryId;
1008
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1009
+ while (1) switch (_context19.prev = _context19.next) {
1007
1010
  case 0:
1008
- contractAddress = _ref37.contractAddress, objectId = _ref37.objectId, versionHash = _ref37.versionHash;
1009
- _context17.next = 1;
1011
+ contractAddress = _ref39.contractAddress, objectId = _ref39.objectId, versionHash = _ref39.versionHash;
1012
+ _context19.next = 3;
1010
1013
  return GetObjectIDAndContractAddress({
1011
1014
  contractAddress: contractAddress,
1012
1015
  objectId: objectId,
1013
1016
  versionHash: versionHash
1014
1017
  });
1015
- case 1:
1016
- objectInfo = _context17.sent;
1018
+ case 3:
1019
+ objectInfo = _context19.sent;
1017
1020
  contractAddress = objectInfo.contractAddress;
1018
1021
  objectId = objectInfo.objectId;
1019
- _context17.prev = 2;
1020
- _context17.next = 3;
1022
+ _context19.prev = 6;
1023
+ _context19.next = 9;
1021
1024
  return this.authClient.ContractHasMethod({
1022
1025
  contractAddress: contractAddress,
1023
1026
  methodName: "getMeta"
1024
1027
  });
1025
- case 3:
1026
- hasGetMetaMethod = _context17.sent;
1028
+ case 9:
1029
+ hasGetMetaMethod = _context19.sent;
1027
1030
  if (!hasGetMetaMethod) {
1028
- _context17.next = 5;
1031
+ _context19.next = 14;
1029
1032
  break;
1030
1033
  }
1031
- _context17.next = 4;
1034
+ _context19.next = 13;
1032
1035
  return this.ContractMetadata({
1033
1036
  contractAddress: contractAddress,
1034
1037
  metadataKey: "_tenantId"
1035
1038
  });
1036
- case 4:
1037
- tenantId = _context17.sent;
1038
- case 5:
1039
+ case 13:
1040
+ tenantId = _context19.sent;
1041
+ case 14:
1039
1042
  if (!(tenantId === undefined)) {
1040
- _context17.next = 8;
1043
+ _context19.next = 21;
1041
1044
  break;
1042
1045
  }
1043
- _context17.next = 6;
1046
+ _context19.next = 17;
1044
1047
  return this.ContentObjectLibraryId({
1045
1048
  objectId: objectId
1046
1049
  });
1047
- case 6:
1048
- libraryId = _context17.sent;
1049
- _context17.next = 7;
1050
+ case 17:
1051
+ libraryId = _context19.sent;
1052
+ _context19.next = 20;
1050
1053
  return this.ContentObjectMetadata({
1051
1054
  libraryId: libraryId,
1052
1055
  objectId: objectId,
1053
1056
  metadataSubtree: "tenantId"
1054
1057
  });
1055
- case 7:
1056
- tenantId = _context17.sent;
1057
- case 8:
1058
- return _context17.abrupt("return", tenantId);
1059
- case 9:
1060
- _context17.prev = 9;
1061
- _t4 = _context17["catch"](2);
1062
- return _context17.abrupt("return", "");
1063
- case 10:
1058
+ case 20:
1059
+ tenantId = _context19.sent;
1060
+ case 21:
1061
+ return _context19.abrupt("return", tenantId);
1062
+ case 24:
1063
+ _context19.prev = 24;
1064
+ _context19.t0 = _context19["catch"](6);
1065
+ return _context19.abrupt("return", "");
1066
+ case 27:
1064
1067
  case "end":
1065
- return _context17.stop();
1068
+ return _context19.stop();
1066
1069
  }
1067
- }, _callee17, this, [[2, 9]]);
1070
+ }, _callee19, this, [[6, 24]]);
1068
1071
  }));
1069
- return function (_x15) {
1070
- return _ref38.apply(this, arguments);
1072
+ return function (_x17) {
1073
+ return _ref40.apply(this, arguments);
1071
1074
  };
1072
1075
  }();
1073
1076
 
@@ -1083,74 +1086,74 @@ exports.TenantId = /*#__PURE__*/function () {
1083
1086
  * @returns {Promise<string|undefined>}
1084
1087
  */
1085
1088
  exports.TenantContractId = /*#__PURE__*/function () {
1086
- var _ref40 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref39) {
1087
- var contractAddress, objectId, versionHash, hasGetMetaMethod, _tenantContractId, libraryId, _t5;
1088
- return _regeneratorRuntime.wrap(function (_context18) {
1089
- while (1) switch (_context18.prev = _context18.next) {
1089
+ var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref41) {
1090
+ var contractAddress, objectId, versionHash, hasGetMetaMethod, _tenantContractId, libraryId;
1091
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1092
+ while (1) switch (_context20.prev = _context20.next) {
1090
1093
  case 0:
1091
- contractAddress = _ref39.contractAddress, objectId = _ref39.objectId, versionHash = _ref39.versionHash;
1092
- _context18.next = 1;
1094
+ contractAddress = _ref41.contractAddress, objectId = _ref41.objectId, versionHash = _ref41.versionHash;
1095
+ _context20.next = 3;
1093
1096
  return GetObjectIDAndContractAddress({
1094
1097
  contractAddress: contractAddress,
1095
1098
  objectId: objectId,
1096
1099
  versionHash: versionHash
1097
1100
  });
1098
- case 1:
1099
- objectInfo = _context18.sent;
1101
+ case 3:
1102
+ objectInfo = _context20.sent;
1100
1103
  contractAddress = objectInfo.contractAddress;
1101
1104
  objectId = objectInfo.objectId;
1102
- _context18.prev = 2;
1103
- _context18.next = 3;
1105
+ _context20.prev = 6;
1106
+ _context20.next = 9;
1104
1107
  return this.authClient.ContractHasMethod({
1105
1108
  contractAddress: contractAddress,
1106
1109
  methodName: "getMeta"
1107
1110
  });
1108
- case 3:
1109
- hasGetMetaMethod = _context18.sent;
1111
+ case 9:
1112
+ hasGetMetaMethod = _context20.sent;
1110
1113
  if (!hasGetMetaMethod) {
1111
- _context18.next = 5;
1114
+ _context20.next = 14;
1112
1115
  break;
1113
1116
  }
1114
- _context18.next = 4;
1117
+ _context20.next = 13;
1115
1118
  return this.ContractMetadata({
1116
1119
  contractAddress: contractAddress,
1117
1120
  metadataKey: "_ELV_TENANT_ID"
1118
1121
  });
1119
- case 4:
1120
- _tenantContractId = _context18.sent;
1121
- case 5:
1122
+ case 13:
1123
+ _tenantContractId = _context20.sent;
1124
+ case 14:
1122
1125
  if (!(_tenantContractId === undefined)) {
1123
- _context18.next = 8;
1126
+ _context20.next = 21;
1124
1127
  break;
1125
1128
  }
1126
- _context18.next = 6;
1129
+ _context20.next = 17;
1127
1130
  return this.ContentObjectLibraryId({
1128
1131
  objectId: objectId
1129
1132
  });
1130
- case 6:
1131
- libraryId = _context18.sent;
1132
- _context18.next = 7;
1133
+ case 17:
1134
+ libraryId = _context20.sent;
1135
+ _context20.next = 20;
1133
1136
  return this.ContentObjectMetadata({
1134
1137
  libraryId: libraryId,
1135
1138
  objectId: objectId,
1136
1139
  metadataSubtree: "tenantContractId"
1137
1140
  });
1138
- case 7:
1139
- _tenantContractId = _context18.sent;
1140
- case 8:
1141
- return _context18.abrupt("return", _tenantContractId);
1142
- case 9:
1143
- _context18.prev = 9;
1144
- _t5 = _context18["catch"](2);
1145
- return _context18.abrupt("return", "");
1146
- case 10:
1141
+ case 20:
1142
+ _tenantContractId = _context20.sent;
1143
+ case 21:
1144
+ return _context20.abrupt("return", _tenantContractId);
1145
+ case 24:
1146
+ _context20.prev = 24;
1147
+ _context20.t0 = _context20["catch"](6);
1148
+ return _context20.abrupt("return", "");
1149
+ case 27:
1147
1150
  case "end":
1148
- return _context18.stop();
1151
+ return _context20.stop();
1149
1152
  }
1150
- }, _callee18, this, [[2, 9]]);
1153
+ }, _callee20, this, [[6, 24]]);
1151
1154
  }));
1152
- return function (_x16) {
1153
- return _ref40.apply(this, arguments);
1155
+ return function (_x18) {
1156
+ return _ref42.apply(this, arguments);
1154
1157
  };
1155
1158
  }();
1156
1159
 
@@ -1169,78 +1172,78 @@ exports.TenantContractId = /*#__PURE__*/function () {
1169
1172
  * @returns {Promise<{tenantId: (undefined|string), tenantContractId}>}
1170
1173
  */
1171
1174
  exports.SetTenantId = /*#__PURE__*/function () {
1172
- var _ref42 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref41) {
1175
+ var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref43) {
1173
1176
  var contractAddress, objectId, versionHash, tenantId, objectVersion, version;
1174
- return _regeneratorRuntime.wrap(function (_context19) {
1175
- while (1) switch (_context19.prev = _context19.next) {
1177
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1178
+ while (1) switch (_context21.prev = _context21.next) {
1176
1179
  case 0:
1177
- contractAddress = _ref41.contractAddress, objectId = _ref41.objectId, versionHash = _ref41.versionHash, tenantId = _ref41.tenantId;
1178
- _context19.next = 1;
1180
+ contractAddress = _ref43.contractAddress, objectId = _ref43.objectId, versionHash = _ref43.versionHash, tenantId = _ref43.tenantId;
1181
+ _context21.next = 3;
1179
1182
  return GetObjectIDAndContractAddress({
1180
1183
  contractAddress: contractAddress,
1181
1184
  objectId: objectId,
1182
1185
  versionHash: versionHash
1183
1186
  });
1184
- case 1:
1185
- objectInfo = _context19.sent;
1187
+ case 3:
1188
+ objectInfo = _context21.sent;
1186
1189
  contractAddress = objectInfo.contractAddress;
1187
1190
  objectId = objectInfo.objectId;
1188
- _context19.next = 2;
1191
+ _context21.next = 8;
1189
1192
  return this.authClient.AccessType(objectId);
1190
- case 2:
1191
- objectVersion = _context19.sent;
1193
+ case 8:
1194
+ objectVersion = _context21.sent;
1192
1195
  if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
1193
- _context19.next = 3;
1196
+ _context21.next = 11;
1194
1197
  break;
1195
1198
  }
1196
1199
  throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
1197
- case 3:
1200
+ case 11:
1198
1201
  ValidateObject(tenantId);
1199
1202
  if (!(!tenantId.startsWith("iten") || !Utils.ValidHash(tenantId))) {
1200
- _context19.next = 4;
1203
+ _context21.next = 14;
1201
1204
  break;
1202
1205
  }
1203
1206
  throw Error("Invalid tenant ID: ".concat(tenantId));
1204
- case 4:
1205
- _context19.next = 5;
1207
+ case 14:
1208
+ _context21.next = 16;
1206
1209
  return this.authClient.AccessType(tenantId);
1207
- case 5:
1208
- version = _context19.sent;
1210
+ case 16:
1211
+ version = _context21.sent;
1209
1212
  if (!(version !== this.authClient.ACCESS_TYPES.GROUP)) {
1210
- _context19.next = 6;
1213
+ _context21.next = 19;
1211
1214
  break;
1212
1215
  }
1213
1216
  throw Error("Invalid tenant ID: " + tenantId);
1214
- case 6:
1215
- _context19.next = 7;
1217
+ case 19:
1218
+ _context21.next = 21;
1216
1219
  return this.TenantContractId({
1217
1220
  objectId: tenantId
1218
1221
  });
1219
- case 7:
1220
- tenantContractId = _context19.sent;
1222
+ case 21:
1223
+ tenantContractId = _context21.sent;
1221
1224
  if (!tenantContractId) {
1222
- _context19.next = 9;
1225
+ _context21.next = 28;
1223
1226
  break;
1224
1227
  }
1225
- _context19.next = 8;
1228
+ _context21.next = 25;
1226
1229
  return this.SetTenantContractId({
1227
1230
  contractAddress: contractAddress,
1228
1231
  objectId: objectId,
1229
1232
  versionHash: versionHash,
1230
1233
  tenantContractId: tenantContractId
1231
1234
  });
1232
- case 8:
1233
- return _context19.abrupt("return", _context19.sent);
1234
- case 9:
1235
+ case 25:
1236
+ return _context21.abrupt("return", _context21.sent);
1237
+ case 28:
1235
1238
  throw Error("Invalid tenantId: tenant contract id not found");
1236
- case 10:
1239
+ case 29:
1237
1240
  case "end":
1238
- return _context19.stop();
1241
+ return _context21.stop();
1239
1242
  }
1240
- }, _callee19, this);
1243
+ }, _callee21, this);
1241
1244
  }));
1242
- return function (_x17) {
1243
- return _ref42.apply(this, arguments);
1245
+ return function (_x19) {
1246
+ return _ref44.apply(this, arguments);
1244
1247
  };
1245
1248
  }();
1246
1249
 
@@ -1258,111 +1261,107 @@ exports.SetTenantId = /*#__PURE__*/function () {
1258
1261
  * @returns {Promise<{tenantId: (undefined|string), tenantContractId}>}
1259
1262
  */
1260
1263
  exports.SetTenantContractId = /*#__PURE__*/function () {
1261
- var _ref44 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref43) {
1262
- var contractAddress, objectId, versionHash, tenantContractId, objectVersion, tenantAddress, version, tenantAdminGroupAddress, hasPutMetaMethod, libraryId, editRequest;
1263
- return _regeneratorRuntime.wrap(function (_context20) {
1264
- while (1) switch (_context20.prev = _context20.next) {
1264
+ var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref45) {
1265
+ var contractAddress, objectId, versionHash, tenantContractId, objectVersion, version, tenantAdminGroupAddress, hasPutMetaMethod, libraryId, editRequest;
1266
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1267
+ while (1) switch (_context22.prev = _context22.next) {
1265
1268
  case 0:
1266
- contractAddress = _ref43.contractAddress, objectId = _ref43.objectId, versionHash = _ref43.versionHash, tenantContractId = _ref43.tenantContractId;
1267
- _context20.next = 1;
1269
+ contractAddress = _ref45.contractAddress, objectId = _ref45.objectId, versionHash = _ref45.versionHash, tenantContractId = _ref45.tenantContractId;
1270
+ _context22.next = 3;
1268
1271
  return GetObjectIDAndContractAddress({
1269
1272
  contractAddress: contractAddress,
1270
1273
  objectId: objectId,
1271
1274
  versionHash: versionHash
1272
1275
  });
1273
- case 1:
1274
- objectInfo = _context20.sent;
1276
+ case 3:
1277
+ objectInfo = _context22.sent;
1275
1278
  contractAddress = objectInfo.contractAddress;
1276
1279
  objectId = objectInfo.objectId;
1277
- _context20.next = 2;
1280
+ _context22.next = 8;
1278
1281
  return this.authClient.AccessType(objectId);
1279
- case 2:
1280
- objectVersion = _context20.sent;
1282
+ case 8:
1283
+ objectVersion = _context22.sent;
1281
1284
  if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
1282
- _context20.next = 3;
1285
+ _context22.next = 11;
1283
1286
  break;
1284
1287
  }
1285
1288
  throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
1286
- case 3:
1289
+ case 11:
1287
1290
  ValidateObject(tenantContractId);
1288
1291
  if (!(tenantContractId && (!tenantContractId.startsWith("iten") || !Utils.ValidHash(tenantContractId)))) {
1289
- _context20.next = 4;
1292
+ _context22.next = 14;
1290
1293
  break;
1291
1294
  }
1292
1295
  throw Error("Invalid tenant ID: ".concat(tenantContractId));
1293
- case 4:
1294
- tenantAddress = Utils.HashToAddress(tenantContractId);
1295
- _context20.next = 5;
1296
+ case 14:
1297
+ _context22.next = 16;
1296
1298
  return this.authClient.AccessType(tenantContractId);
1297
- case 5:
1298
- version = _context20.sent;
1299
+ case 16:
1300
+ version = _context22.sent;
1299
1301
  if (!(version !== this.authClient.ACCESS_TYPES.TENANT)) {
1300
- _context20.next = 6;
1302
+ _context22.next = 19;
1301
1303
  break;
1302
1304
  }
1303
1305
  throw Error("Invalid tenant ID: " + tenantContractId);
1304
- case 6:
1305
- _context20.next = 7;
1306
- return this.CallContractMethod({
1307
- contractAddress: tenantAddress,
1308
- methodName: "groupsMapping",
1309
- methodArgs: ["tenant_admin", 0],
1310
- formatArguments: true
1306
+ case 19:
1307
+ _context22.next = 21;
1308
+ return this.TenantAdminGroup({
1309
+ tenantContractId: tenantContractId
1311
1310
  });
1312
- case 7:
1313
- tenantAdminGroupAddress = _context20.sent;
1314
- _context20.next = 8;
1311
+ case 21:
1312
+ tenantAdminGroupAddress = _context22.sent;
1313
+ _context22.next = 24;
1315
1314
  return this.authClient.ContractHasMethod({
1316
1315
  contractAddress: contractAddress,
1317
1316
  methodName: "putMeta"
1318
1317
  });
1319
- case 8:
1320
- hasPutMetaMethod = _context20.sent;
1318
+ case 24:
1319
+ hasPutMetaMethod = _context22.sent;
1321
1320
  if (!hasPutMetaMethod) {
1322
- _context20.next = 13;
1321
+ _context22.next = 36;
1323
1322
  break;
1324
1323
  }
1325
- _context20.next = 9;
1324
+ _context22.next = 28;
1326
1325
  return this.ReplaceContractMetadata({
1327
1326
  contractAddress: contractAddress,
1328
1327
  metadataKey: "_ELV_TENANT_ID",
1329
1328
  metadata: tenantContractId
1330
1329
  });
1331
- case 9:
1330
+ case 28:
1332
1331
  if (!tenantAdminGroupAddress) {
1333
- _context20.next = 11;
1332
+ _context22.next = 33;
1334
1333
  break;
1335
1334
  }
1336
- _context20.next = 10;
1335
+ _context22.next = 31;
1337
1336
  return this.ReplaceContractMetadata({
1338
1337
  contractAddress: contractAddress,
1339
1338
  metadataKey: "_tenantId",
1340
1339
  metadata: "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1341
1340
  });
1342
- case 10:
1343
- _context20.next = 12;
1341
+ case 31:
1342
+ _context22.next = 34;
1344
1343
  break;
1345
- case 11:
1344
+ case 33:
1346
1345
  // eslint-disable-next-line no-console
1347
1346
  console.warn("No tenant ID associated with current tenant.");
1348
- case 12:
1349
- _context20.next = 17;
1347
+ case 34:
1348
+ _context22.next = 46;
1350
1349
  break;
1351
- case 13:
1352
- _context20.next = 14;
1350
+ case 36:
1351
+ _context22.next = 38;
1353
1352
  return this.ContentObjectLibraryId({
1354
1353
  objectId: objectId
1355
1354
  });
1356
- case 14:
1357
- libraryId = _context20.sent;
1358
- _context20.next = 15;
1355
+ case 38:
1356
+ libraryId = _context22.sent;
1357
+ _context22.next = 41;
1359
1358
  return this.EditContentObject({
1360
1359
  libraryId: libraryId,
1361
1360
  objectId: objectId
1362
1361
  });
1363
- case 15:
1364
- editRequest = _context20.sent;
1365
- _context20.next = 16;
1362
+ case 41:
1363
+ editRequest = _context22.sent;
1364
+ _context22.next = 44;
1366
1365
  return this.MergeMetadata({
1367
1366
  libraryId: libraryId,
1368
1367
  objectId: objectId,
@@ -1372,27 +1371,27 @@ exports.SetTenantContractId = /*#__PURE__*/function () {
1372
1371
  tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1373
1372
  }
1374
1373
  });
1375
- case 16:
1376
- _context20.next = 17;
1374
+ case 44:
1375
+ _context22.next = 46;
1377
1376
  return this.FinalizeContentObject({
1378
1377
  libraryId: libraryId,
1379
1378
  objectId: objectId,
1380
1379
  writeToken: editRequest.write_token,
1381
1380
  commitMessage: "set tenant_contract_id"
1382
1381
  });
1383
- case 17:
1384
- return _context20.abrupt("return", {
1382
+ case 46:
1383
+ return _context22.abrupt("return", {
1385
1384
  tenantContractId: tenantContractId,
1386
1385
  tenantId: !tenantAdminGroupAddress ? undefined : "iten".concat(Utils.AddressToHash(tenantAdminGroupAddress))
1387
1386
  });
1388
- case 18:
1387
+ case 47:
1389
1388
  case "end":
1390
- return _context20.stop();
1389
+ return _context22.stop();
1391
1390
  }
1392
- }, _callee20, this);
1391
+ }, _callee22, this);
1393
1392
  }));
1394
- return function (_x18) {
1395
- return _ref44.apply(this, arguments);
1393
+ return function (_x20) {
1394
+ return _ref46.apply(this, arguments);
1396
1395
  };
1397
1396
  }();
1398
1397
 
@@ -1408,32 +1407,32 @@ exports.SetTenantContractId = /*#__PURE__*/function () {
1408
1407
  * @returns {Promise<void>}
1409
1408
  */
1410
1409
  exports.ResetTenantId = /*#__PURE__*/function () {
1411
- var _ref46 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref45) {
1410
+ var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref47) {
1412
1411
  var contractAddress, objectId, versionHash, objectVersion, tenantContractId, tenantId, hasPutMetaMethod, libraryId, editRequest;
1413
- return _regeneratorRuntime.wrap(function (_context21) {
1414
- while (1) switch (_context21.prev = _context21.next) {
1412
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1413
+ while (1) switch (_context23.prev = _context23.next) {
1415
1414
  case 0:
1416
- contractAddress = _ref45.contractAddress, objectId = _ref45.objectId, versionHash = _ref45.versionHash;
1417
- _context21.next = 1;
1415
+ contractAddress = _ref47.contractAddress, objectId = _ref47.objectId, versionHash = _ref47.versionHash;
1416
+ _context23.next = 3;
1418
1417
  return GetObjectIDAndContractAddress({
1419
1418
  contractAddress: contractAddress,
1420
1419
  objectId: objectId,
1421
1420
  versionHash: versionHash
1422
1421
  });
1423
- case 1:
1424
- objectInfo = _context21.sent;
1422
+ case 3:
1423
+ objectInfo = _context23.sent;
1425
1424
  contractAddress = objectInfo.contractAddress;
1426
1425
  objectId = objectInfo.objectId;
1427
- _context21.next = 2;
1426
+ _context23.next = 8;
1428
1427
  return this.authClient.AccessType(objectId);
1429
- case 2:
1430
- objectVersion = _context21.sent;
1428
+ case 8:
1429
+ objectVersion = _context23.sent;
1431
1430
  if (!(objectVersion !== this.authClient.ACCESS_TYPES.GROUP && objectVersion !== this.authClient.ACCESS_TYPES.WALLET && objectVersion !== this.authClient.ACCESS_TYPES.LIBRARY && objectVersion !== this.authClient.ACCESS_TYPES.TYPE && objectVersion !== this.authClient.ACCESS_TYPES.TENANT)) {
1432
- _context21.next = 3;
1431
+ _context23.next = 11;
1433
1432
  break;
1434
1433
  }
1435
1434
  throw Error("Invalid object ID: ".concat(objectId, ", \n applicable only for wallet,group, library or content_type object."));
1436
- case 3:
1435
+ case 11:
1437
1436
  tenantContractId = this.TenantContractId({
1438
1437
  objectId: objectId
1439
1438
  });
@@ -1441,51 +1440,51 @@ exports.ResetTenantId = /*#__PURE__*/function () {
1441
1440
  objectId: objectId
1442
1441
  });
1443
1442
  if (!(tenantContractId || tenantId)) {
1444
- _context21.next = 12;
1443
+ _context23.next = 36;
1445
1444
  break;
1446
1445
  }
1447
- _context21.next = 4;
1446
+ _context23.next = 16;
1448
1447
  return this.authClient.ContractHasMethod({
1449
1448
  contractAddress: contractAddress,
1450
1449
  methodName: "putMeta"
1451
1450
  });
1452
- case 4:
1453
- hasPutMetaMethod = _context21.sent;
1451
+ case 16:
1452
+ hasPutMetaMethod = _context23.sent;
1454
1453
  if (!hasPutMetaMethod) {
1455
- _context21.next = 7;
1454
+ _context23.next = 24;
1456
1455
  break;
1457
1456
  }
1458
- _context21.next = 5;
1457
+ _context23.next = 20;
1459
1458
  return this.ReplaceContractMetadata({
1460
1459
  contractAddress: contractAddress,
1461
1460
  metadataKey: "_ELV_TENANT_ID",
1462
1461
  metadata: ""
1463
1462
  });
1464
- case 5:
1465
- _context21.next = 6;
1463
+ case 20:
1464
+ _context23.next = 22;
1466
1465
  return this.ReplaceContractMetadata({
1467
1466
  contractAddress: contractAddress,
1468
1467
  metadataKey: "_tenantId",
1469
1468
  metadata: ""
1470
1469
  });
1471
- case 6:
1472
- _context21.next = 11;
1470
+ case 22:
1471
+ _context23.next = 34;
1473
1472
  break;
1474
- case 7:
1475
- _context21.next = 8;
1473
+ case 24:
1474
+ _context23.next = 26;
1476
1475
  return this.ContentObjectLibraryId({
1477
1476
  objectId: objectId
1478
1477
  });
1479
- case 8:
1480
- libraryId = _context21.sent;
1481
- _context21.next = 9;
1478
+ case 26:
1479
+ libraryId = _context23.sent;
1480
+ _context23.next = 29;
1482
1481
  return this.EditContentObject({
1483
1482
  libraryId: libraryId,
1484
1483
  objectId: objectId
1485
1484
  });
1486
- case 9:
1487
- editRequest = _context21.sent;
1488
- _context21.next = 10;
1485
+ case 29:
1486
+ editRequest = _context23.sent;
1487
+ _context23.next = 32;
1489
1488
  return this.MergeMetadata({
1490
1489
  libraryId: libraryId,
1491
1490
  objectId: objectId,
@@ -1495,28 +1494,183 @@ exports.ResetTenantId = /*#__PURE__*/function () {
1495
1494
  tenantId: undefined
1496
1495
  }
1497
1496
  });
1498
- case 10:
1499
- _context21.next = 11;
1497
+ case 32:
1498
+ _context23.next = 34;
1500
1499
  return this.FinalizeContentObject({
1501
1500
  libraryId: libraryId,
1502
1501
  objectId: objectId,
1503
1502
  writeToken: editRequest.write_token,
1504
1503
  commitMessage: "remove tenant_contract_id"
1505
1504
  });
1506
- case 11:
1507
- _context21.next = 13;
1505
+ case 34:
1506
+ _context23.next = 37;
1508
1507
  break;
1509
- case 12:
1508
+ case 36:
1510
1509
  // eslint-disable-next-line no-console
1511
1510
  console.warn("No tenant ID associated with current tenant.");
1512
- case 13:
1511
+ case 37:
1513
1512
  case "end":
1514
- return _context21.stop();
1513
+ return _context23.stop();
1515
1514
  }
1516
- }, _callee21, this);
1515
+ }, _callee23, this);
1517
1516
  }));
1518
- return function (_x19) {
1519
- return _ref46.apply(this, arguments);
1517
+ return function (_x21) {
1518
+ return _ref48.apply(this, arguments);
1519
+ };
1520
+ }();
1521
+ function GetTenantGroupAddress(_x22) {
1522
+ return _GetTenantGroupAddress.apply(this, arguments);
1523
+ }
1524
+ /**
1525
+ * Returns the tenant_admin group address for a given tenant contract.
1526
+ *
1527
+ * @methodGroup Tenant
1528
+ * @namedParams
1529
+ * @param {string=} tenantContractId - The ID of the tenant contract
1530
+ * @returns {Promise<*|undefined>}
1531
+ */
1532
+ function _GetTenantGroupAddress() {
1533
+ _GetTenantGroupAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(_ref49) {
1534
+ var ctx, tenantContractId, groupName, tenantAddress, version, groupAddress;
1535
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
1536
+ while (1) switch (_context33.prev = _context33.next) {
1537
+ case 0:
1538
+ ctx = _ref49.ctx, tenantContractId = _ref49.tenantContractId, groupName = _ref49.groupName;
1539
+ if (tenantContractId) {
1540
+ _context33.next = 3;
1541
+ break;
1542
+ }
1543
+ throw new Error("tenantContractId is required");
1544
+ case 3:
1545
+ if (tenantContractId.startsWith("iten")) {
1546
+ _context33.next = 5;
1547
+ break;
1548
+ }
1549
+ throw new Error("Invalid Tenant Contract ID format: ".concat(tenantContractId));
1550
+ case 5:
1551
+ tenantAddress = Utils.HashToAddress(tenantContractId); // Needs to be tenant type
1552
+ _context33.next = 8;
1553
+ return ctx.authClient.AccessType(tenantContractId);
1554
+ case 8:
1555
+ version = _context33.sent;
1556
+ if (!(version !== ctx.authClient.ACCESS_TYPES.TENANT)) {
1557
+ _context33.next = 11;
1558
+ break;
1559
+ }
1560
+ throw new Error("Contract ".concat(tenantContractId, " is not a Tenant. Actual version: ").concat(version));
1561
+ case 11:
1562
+ _context33.prev = 11;
1563
+ _context33.next = 14;
1564
+ return ctx.CallContractMethod({
1565
+ contractAddress: tenantAddress,
1566
+ methodName: "groupsMapping",
1567
+ methodArgs: [groupName, 0],
1568
+ formatArguments: true
1569
+ });
1570
+ case 14:
1571
+ groupAddress = _context33.sent;
1572
+ if (groupAddress) {
1573
+ _context33.next = 17;
1574
+ break;
1575
+ }
1576
+ throw new Error("".concat(groupName, " group address not set."));
1577
+ case 17:
1578
+ return _context33.abrupt("return", groupAddress);
1579
+ case 20:
1580
+ _context33.prev = 20;
1581
+ _context33.t0 = _context33["catch"](11);
1582
+ this.Log(_context33.t0);
1583
+ throw new Error("Failed to retrieve ".concat(groupName, " group address."));
1584
+ case 24:
1585
+ case "end":
1586
+ return _context33.stop();
1587
+ }
1588
+ }, _callee33, this, [[11, 20]]);
1589
+ }));
1590
+ return _GetTenantGroupAddress.apply(this, arguments);
1591
+ }
1592
+ exports.TenantAdminGroup = /*#__PURE__*/function () {
1593
+ var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref50) {
1594
+ var tenantContractId;
1595
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1596
+ while (1) switch (_context24.prev = _context24.next) {
1597
+ case 0:
1598
+ tenantContractId = _ref50.tenantContractId;
1599
+ return _context24.abrupt("return", GetTenantGroupAddress({
1600
+ ctx: this,
1601
+ tenantContractId: tenantContractId,
1602
+ groupName: "tenant_admin"
1603
+ }));
1604
+ case 2:
1605
+ case "end":
1606
+ return _context24.stop();
1607
+ }
1608
+ }, _callee24, this);
1609
+ }));
1610
+ return function (_x23) {
1611
+ return _ref51.apply(this, arguments);
1612
+ };
1613
+ }();
1614
+
1615
+ /**
1616
+ * Returns the content_admin group address for a given tenant contract.
1617
+ *
1618
+ * @methodGroup Tenant
1619
+ * @namedParams
1620
+ * @param {string=} tenantContractId - The ID of the tenant contract
1621
+ * @returns {Promise<*|undefined>}
1622
+ */
1623
+ exports.ContentAdminGroup = /*#__PURE__*/function () {
1624
+ var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref52) {
1625
+ var tenantContractId;
1626
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1627
+ while (1) switch (_context25.prev = _context25.next) {
1628
+ case 0:
1629
+ tenantContractId = _ref52.tenantContractId;
1630
+ return _context25.abrupt("return", GetTenantGroupAddress({
1631
+ ctx: this,
1632
+ tenantContractId: tenantContractId,
1633
+ groupName: "content_admin"
1634
+ }));
1635
+ case 2:
1636
+ case "end":
1637
+ return _context25.stop();
1638
+ }
1639
+ }, _callee25, this);
1640
+ }));
1641
+ return function (_x24) {
1642
+ return _ref53.apply(this, arguments);
1643
+ };
1644
+ }();
1645
+
1646
+ /**
1647
+ * Returns the tenant_users group address for a given tenant contract.
1648
+ *
1649
+ * @methodGroup Tenant
1650
+ * @namedParams
1651
+ * @param {string=} tenantContractId - The ID of the tenant contract
1652
+ * @returns {Promise<*|undefined>}
1653
+ */
1654
+ exports.TenantUsersGroup = /*#__PURE__*/function () {
1655
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref54) {
1656
+ var tenantContractId;
1657
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1658
+ while (1) switch (_context26.prev = _context26.next) {
1659
+ case 0:
1660
+ tenantContractId = _ref54.tenantContractId;
1661
+ return _context26.abrupt("return", GetTenantGroupAddress({
1662
+ ctx: this,
1663
+ tenantContractId: tenantContractId,
1664
+ groupName: "tenant_users"
1665
+ }));
1666
+ case 2:
1667
+ case "end":
1668
+ return _context26.stop();
1669
+ }
1670
+ }, _callee26, this);
1671
+ }));
1672
+ return function (_x25) {
1673
+ return _ref55.apply(this, arguments);
1520
1674
  };
1521
1675
  }();
1522
1676
 
@@ -1593,288 +1747,288 @@ var ObjectTypesToClean = Object.freeze({
1593
1747
  * }
1594
1748
  */
1595
1749
  exports.ObjectCleanup = /*#__PURE__*/function () {
1596
- var _ref48 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref47) {
1750
+ var _ref57 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(_ref56) {
1597
1751
  var _this = this;
1598
- var contractAddress, objectId, versionHash, _ref47$objectTypeToCl, objectTypeToClean, isUserWallet, userAddress, allowedTypes, cleanupTasks, runCleanupTasks, results, res, groupsLength, groupAddressPromises, i, groupAddresses, cleanupResults, _iterator, _step, _step$value, addr, _res2, _t7, _t8;
1599
- return _regeneratorRuntime.wrap(function (_context27) {
1600
- while (1) switch (_context27.prev = _context27.next) {
1752
+ var contractAddress, objectId, versionHash, _ref56$objectTypeToCl, objectTypeToClean, isUserWallet, userAddress, allowedTypes, cleanupTasks, runCleanupTasks, results, res, groupsLength, groupAddressPromises, i, groupAddresses, cleanupResults, _iterator, _step, _step$value, addr, _res2;
1753
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
1754
+ while (1) switch (_context32.prev = _context32.next) {
1601
1755
  case 0:
1602
- contractAddress = _ref47.contractAddress, objectId = _ref47.objectId, versionHash = _ref47.versionHash, _ref47$objectTypeToCl = _ref47.objectTypeToClean, objectTypeToClean = _ref47$objectTypeToCl === void 0 ? ObjectTypesToClean.ALL : _ref47$objectTypeToCl;
1603
- _context27.next = 1;
1756
+ contractAddress = _ref56.contractAddress, objectId = _ref56.objectId, versionHash = _ref56.versionHash, _ref56$objectTypeToCl = _ref56.objectTypeToClean, objectTypeToClean = _ref56$objectTypeToCl === void 0 ? ObjectTypesToClean.ALL : _ref56$objectTypeToCl;
1757
+ _context32.next = 3;
1604
1758
  return GetObjectIDAndContractAddress({
1605
1759
  contractAddress: contractAddress,
1606
1760
  objectId: objectId,
1607
1761
  versionHash: versionHash
1608
1762
  });
1609
- case 1:
1610
- objectInfo = _context27.sent;
1763
+ case 3:
1764
+ objectInfo = _context32.sent;
1611
1765
  contractAddress = objectInfo.contractAddress;
1612
1766
  isUserWallet = false;
1613
- _context27.prev = 2;
1614
- _context27.next = 3;
1767
+ _context32.prev = 6;
1768
+ _context32.next = 9;
1615
1769
  return this.CallContractMethod({
1616
1770
  contractAddress: contractAddress,
1617
1771
  methodName: "getLibrariesLength",
1618
1772
  formatArguments: false
1619
1773
  });
1620
- case 3:
1621
- _context27.next = 8;
1774
+ case 9:
1775
+ _context32.next = 24;
1622
1776
  break;
1623
- case 4:
1624
- _context27.prev = 4;
1625
- _t7 = _context27["catch"](2);
1626
- _context27.prev = 5;
1777
+ case 11:
1778
+ _context32.prev = 11;
1779
+ _context32.t0 = _context32["catch"](6);
1780
+ _context32.prev = 13;
1627
1781
  userAddress = contractAddress;
1628
- _context27.next = 6;
1782
+ _context32.next = 17;
1629
1783
  return this.userProfileClient.UserWalletAddress({
1630
1784
  address: contractAddress
1631
1785
  });
1632
- case 6:
1633
- contractAddress = _context27.sent;
1786
+ case 17:
1787
+ contractAddress = _context32.sent;
1634
1788
  isUserWallet = true;
1635
- _context27.next = 8;
1789
+ _context32.next = 24;
1636
1790
  break;
1637
- case 7:
1638
- _context27.prev = 7;
1639
- _t8 = _context27["catch"](5);
1640
- throw new Error("Invalid object: ".concat(_t8.message));
1641
- case 8:
1791
+ case 21:
1792
+ _context32.prev = 21;
1793
+ _context32.t1 = _context32["catch"](13);
1794
+ throw new Error("Invalid object: ".concat(_context32.t1.message));
1795
+ case 24:
1642
1796
  allowedTypes = Object.values(ObjectTypesToClean);
1643
1797
  if (allowedTypes.includes(objectTypeToClean)) {
1644
- _context27.next = 9;
1798
+ _context32.next = 27;
1645
1799
  break;
1646
1800
  }
1647
1801
  throw Error("Invalid objectType '".concat(objectTypeToClean, "'. Allowed types: ").concat(allowedTypes.join(", ")));
1648
- case 9:
1802
+ case 27:
1649
1803
  cleanupTasks = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ObjectTypesToClean.LIBRARY, function () {
1650
- var _ref50 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref49) {
1804
+ var _ref59 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(_ref58) {
1651
1805
  var contractAddress, res, before, after;
1652
- return _regeneratorRuntime.wrap(function (_context22) {
1653
- while (1) switch (_context22.prev = _context22.next) {
1806
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
1807
+ while (1) switch (_context27.prev = _context27.next) {
1654
1808
  case 0:
1655
- contractAddress = _ref49.contractAddress, res = _ref49.res;
1656
- _context22.next = 1;
1809
+ contractAddress = _ref58.contractAddress, res = _ref58.res;
1810
+ _context27.next = 3;
1657
1811
  return _this.CallContractMethod({
1658
1812
  contractAddress: contractAddress,
1659
1813
  methodName: "getLibrariesLength",
1660
1814
  formatArguments: false
1661
1815
  });
1662
- case 1:
1663
- before = _context22.sent;
1816
+ case 3:
1817
+ before = _context27.sent;
1664
1818
  res.beforeCleanup.librariesLength = before.toNumber();
1665
- _context22.next = 2;
1819
+ _context27.next = 7;
1666
1820
  return _this.CallContractMethodAndWait({
1667
1821
  contractAddress: contractAddress,
1668
1822
  methodName: "cleanUpLibraries",
1669
1823
  formatArguments: true
1670
1824
  });
1671
- case 2:
1672
- _context22.next = 3;
1825
+ case 7:
1826
+ _context27.next = 9;
1673
1827
  return _this.CallContractMethod({
1674
1828
  contractAddress: contractAddress,
1675
1829
  methodName: "getLibrariesLength",
1676
1830
  formatArguments: false
1677
1831
  });
1678
- case 3:
1679
- after = _context22.sent;
1832
+ case 9:
1833
+ after = _context27.sent;
1680
1834
  res.afterCleanup.librariesLength = after.toNumber();
1681
- case 4:
1835
+ case 11:
1682
1836
  case "end":
1683
- return _context22.stop();
1837
+ return _context27.stop();
1684
1838
  }
1685
- }, _callee22);
1839
+ }, _callee27);
1686
1840
  }));
1687
- return function (_x21) {
1688
- return _ref50.apply(this, arguments);
1841
+ return function (_x27) {
1842
+ return _ref59.apply(this, arguments);
1689
1843
  };
1690
1844
  }()), ObjectTypesToClean.CONTENT_OBJECT, function () {
1691
- var _ref52 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref51) {
1845
+ var _ref61 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(_ref60) {
1692
1846
  var contractAddress, res, before, after;
1693
- return _regeneratorRuntime.wrap(function (_context23) {
1694
- while (1) switch (_context23.prev = _context23.next) {
1847
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
1848
+ while (1) switch (_context28.prev = _context28.next) {
1695
1849
  case 0:
1696
- contractAddress = _ref51.contractAddress, res = _ref51.res;
1697
- _context23.next = 1;
1850
+ contractAddress = _ref60.contractAddress, res = _ref60.res;
1851
+ _context28.next = 3;
1698
1852
  return _this.CallContractMethod({
1699
1853
  contractAddress: contractAddress,
1700
1854
  methodName: "getContentObjectsLength",
1701
1855
  formatArguments: false
1702
1856
  });
1703
- case 1:
1704
- before = _context23.sent;
1857
+ case 3:
1858
+ before = _context28.sent;
1705
1859
  res.beforeCleanup.contentObjectsLength = before.toNumber();
1706
- _context23.next = 2;
1860
+ _context28.next = 7;
1707
1861
  return _this.CallContractMethodAndWait({
1708
1862
  contractAddress: contractAddress,
1709
1863
  methodName: "cleanUpContentObjects",
1710
1864
  formatArguments: true
1711
1865
  });
1712
- case 2:
1713
- _context23.next = 3;
1866
+ case 7:
1867
+ _context28.next = 9;
1714
1868
  return _this.CallContractMethod({
1715
1869
  contractAddress: contractAddress,
1716
1870
  methodName: "getContentObjectsLength",
1717
1871
  formatArguments: false
1718
1872
  });
1719
- case 3:
1720
- after = _context23.sent;
1873
+ case 9:
1874
+ after = _context28.sent;
1721
1875
  res.afterCleanup.contentObjectsLength = after.toNumber();
1722
- case 4:
1876
+ case 11:
1723
1877
  case "end":
1724
- return _context23.stop();
1878
+ return _context28.stop();
1725
1879
  }
1726
- }, _callee23);
1880
+ }, _callee28);
1727
1881
  }));
1728
- return function (_x22) {
1729
- return _ref52.apply(this, arguments);
1882
+ return function (_x28) {
1883
+ return _ref61.apply(this, arguments);
1730
1884
  };
1731
1885
  }()), ObjectTypesToClean.GROUP, function () {
1732
- var _ref54 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref53) {
1886
+ var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(_ref62) {
1733
1887
  var contractAddress, res, before, after;
1734
- return _regeneratorRuntime.wrap(function (_context24) {
1735
- while (1) switch (_context24.prev = _context24.next) {
1888
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
1889
+ while (1) switch (_context29.prev = _context29.next) {
1736
1890
  case 0:
1737
- contractAddress = _ref53.contractAddress, res = _ref53.res;
1738
- _context24.next = 1;
1891
+ contractAddress = _ref62.contractAddress, res = _ref62.res;
1892
+ _context29.next = 3;
1739
1893
  return _this.CallContractMethod({
1740
1894
  contractAddress: contractAddress,
1741
1895
  methodName: "getAccessGroupsLength",
1742
1896
  formatArguments: false
1743
1897
  });
1744
- case 1:
1745
- before = _context24.sent;
1898
+ case 3:
1899
+ before = _context29.sent;
1746
1900
  res.beforeCleanup.accessGroupsLength = before.toNumber();
1747
- _context24.next = 2;
1901
+ _context29.next = 7;
1748
1902
  return _this.CallContractMethodAndWait({
1749
1903
  contractAddress: contractAddress,
1750
1904
  methodName: "cleanUpAccessGroups",
1751
1905
  formatArguments: true
1752
1906
  });
1753
- case 2:
1754
- _context24.next = 3;
1907
+ case 7:
1908
+ _context29.next = 9;
1755
1909
  return _this.CallContractMethod({
1756
1910
  contractAddress: contractAddress,
1757
1911
  methodName: "getAccessGroupsLength",
1758
1912
  formatArguments: false
1759
1913
  });
1760
- case 3:
1761
- after = _context24.sent;
1914
+ case 9:
1915
+ after = _context29.sent;
1762
1916
  res.afterCleanup.accessGroupsLength = after.toNumber();
1763
- case 4:
1917
+ case 11:
1764
1918
  case "end":
1765
- return _context24.stop();
1919
+ return _context29.stop();
1766
1920
  }
1767
- }, _callee24);
1921
+ }, _callee29);
1768
1922
  }));
1769
- return function (_x23) {
1770
- return _ref54.apply(this, arguments);
1923
+ return function (_x29) {
1924
+ return _ref63.apply(this, arguments);
1771
1925
  };
1772
1926
  }()), ObjectTypesToClean.CONTENT_TYPE, function () {
1773
- var _ref56 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref55) {
1927
+ var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(_ref64) {
1774
1928
  var contractAddress, res, before, after;
1775
- return _regeneratorRuntime.wrap(function (_context25) {
1776
- while (1) switch (_context25.prev = _context25.next) {
1929
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
1930
+ while (1) switch (_context30.prev = _context30.next) {
1777
1931
  case 0:
1778
- contractAddress = _ref55.contractAddress, res = _ref55.res;
1779
- _context25.next = 1;
1932
+ contractAddress = _ref64.contractAddress, res = _ref64.res;
1933
+ _context30.next = 3;
1780
1934
  return _this.CallContractMethod({
1781
1935
  contractAddress: contractAddress,
1782
1936
  methodName: "getContentTypesLength",
1783
1937
  formatArguments: false
1784
1938
  });
1785
- case 1:
1786
- before = _context25.sent;
1939
+ case 3:
1940
+ before = _context30.sent;
1787
1941
  res.beforeCleanup.contentTypesLength = before.toNumber();
1788
- _context25.next = 2;
1942
+ _context30.next = 7;
1789
1943
  return _this.CallContractMethodAndWait({
1790
1944
  contractAddress: contractAddress,
1791
1945
  methodName: "cleanUpContentTypes",
1792
1946
  formatArguments: true
1793
1947
  });
1794
- case 2:
1795
- _context25.next = 3;
1948
+ case 7:
1949
+ _context30.next = 9;
1796
1950
  return _this.CallContractMethod({
1797
1951
  contractAddress: contractAddress,
1798
1952
  methodName: "getContentTypesLength",
1799
1953
  formatArguments: false
1800
1954
  });
1801
- case 3:
1802
- after = _context25.sent;
1955
+ case 9:
1956
+ after = _context30.sent;
1803
1957
  res.afterCleanup.contentTypesLength = after.toNumber();
1804
- case 4:
1958
+ case 11:
1805
1959
  case "end":
1806
- return _context25.stop();
1960
+ return _context30.stop();
1807
1961
  }
1808
- }, _callee25);
1962
+ }, _callee30);
1809
1963
  }));
1810
- return function (_x24) {
1811
- return _ref56.apply(this, arguments);
1964
+ return function (_x30) {
1965
+ return _ref65.apply(this, arguments);
1812
1966
  };
1813
1967
  }());
1814
1968
  runCleanupTasks = /*#__PURE__*/function () {
1815
- var _ref58 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref57) {
1816
- var contractAddress, _res, _i, _Object$keys, type, _t6;
1817
- return _regeneratorRuntime.wrap(function (_context26) {
1818
- while (1) switch (_context26.prev = _context26.next) {
1969
+ var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(_ref66) {
1970
+ var contractAddress, _res, _i, _Object$keys, type;
1971
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
1972
+ while (1) switch (_context31.prev = _context31.next) {
1819
1973
  case 0:
1820
- contractAddress = _ref57.contractAddress;
1821
- _context26.prev = 1;
1974
+ contractAddress = _ref66.contractAddress;
1975
+ _context31.prev = 1;
1822
1976
  _res = {
1823
1977
  beforeCleanup: {},
1824
1978
  afterCleanup: {}
1825
1979
  };
1826
1980
  if (!(objectTypeToClean === ObjectTypesToClean.ALL)) {
1827
- _context26.next = 5;
1981
+ _context31.next = 14;
1828
1982
  break;
1829
1983
  }
1830
1984
  _i = 0, _Object$keys = Object.keys(cleanupTasks);
1831
- case 2:
1985
+ case 5:
1832
1986
  if (!(_i < _Object$keys.length)) {
1833
- _context26.next = 4;
1987
+ _context31.next = 12;
1834
1988
  break;
1835
1989
  }
1836
1990
  type = _Object$keys[_i];
1837
- _context26.next = 3;
1991
+ _context31.next = 9;
1838
1992
  return cleanupTasks[type]({
1839
1993
  contractAddress: contractAddress,
1840
1994
  res: _res
1841
1995
  });
1842
- case 3:
1996
+ case 9:
1843
1997
  _i++;
1844
- _context26.next = 2;
1998
+ _context31.next = 5;
1845
1999
  break;
1846
- case 4:
1847
- _context26.next = 6;
2000
+ case 12:
2001
+ _context31.next = 16;
1848
2002
  break;
1849
- case 5:
1850
- _context26.next = 6;
2003
+ case 14:
2004
+ _context31.next = 16;
1851
2005
  return cleanupTasks[objectTypeToClean]({
1852
2006
  contractAddress: contractAddress,
1853
2007
  res: _res
1854
2008
  });
1855
- case 6:
1856
- return _context26.abrupt("return", _res);
1857
- case 7:
1858
- _context26.prev = 7;
1859
- _t6 = _context26["catch"](1);
1860
- throw new Error("Error during '".concat(objectTypeToClean, "' cleanup for ").concat(contractAddress, ": ").concat(_t6.message));
1861
- case 8:
2009
+ case 16:
2010
+ return _context31.abrupt("return", _res);
2011
+ case 19:
2012
+ _context31.prev = 19;
2013
+ _context31.t0 = _context31["catch"](1);
2014
+ throw new Error("Error during '".concat(objectTypeToClean, "' cleanup for ").concat(contractAddress, ": ").concat(_context31.t0.message));
2015
+ case 22:
1862
2016
  case "end":
1863
- return _context26.stop();
2017
+ return _context31.stop();
1864
2018
  }
1865
- }, _callee26, null, [[1, 7]]);
2019
+ }, _callee31, null, [[1, 19]]);
1866
2020
  }));
1867
- return function runCleanupTasks(_x25) {
1868
- return _ref58.apply(this, arguments);
2021
+ return function runCleanupTasks(_x31) {
2022
+ return _ref67.apply(this, arguments);
1869
2023
  };
1870
2024
  }();
1871
2025
  results = {}; // run cleanup on main contract
1872
- _context27.next = 10;
2026
+ _context32.next = 32;
1873
2027
  return runCleanupTasks({
1874
2028
  contractAddress: contractAddress
1875
2029
  });
1876
- case 10:
1877
- res = _context27.sent;
2030
+ case 32:
2031
+ res = _context32.sent;
1878
2032
  if (isUserWallet) {
1879
2033
  results[userAddress] = res;
1880
2034
  } else {
@@ -1883,17 +2037,17 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1883
2037
 
1884
2038
  // run cleanup on access group contracts if this is a user wallet
1885
2039
  if (!isUserWallet) {
1886
- _context27.next = 14;
2040
+ _context32.next = 49;
1887
2041
  break;
1888
2042
  }
1889
- _context27.next = 11;
2043
+ _context32.next = 37;
1890
2044
  return this.CallContractMethod({
1891
2045
  contractAddress: contractAddress,
1892
2046
  methodName: "getAccessGroupsLength",
1893
2047
  formatArguments: false
1894
2048
  });
1895
- case 11:
1896
- groupsLength = _context27.sent;
2049
+ case 37:
2050
+ groupsLength = _context32.sent;
1897
2051
  if (groupsLength > 0) {
1898
2052
  results["groups"] = {};
1899
2053
  }
@@ -1906,11 +2060,11 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1906
2060
  formatArguments: false
1907
2061
  }));
1908
2062
  }
1909
- _context27.next = 12;
2063
+ _context32.next = 43;
1910
2064
  return Promise.all(groupAddressPromises);
1911
- case 12:
1912
- groupAddresses = _context27.sent;
1913
- _context27.next = 13;
2065
+ case 43:
2066
+ groupAddresses = _context32.sent;
2067
+ _context32.next = 46;
1914
2068
  return Promise.all(groupAddresses.map(function (addr) {
1915
2069
  return runCleanupTasks({
1916
2070
  contractAddress: addr
@@ -1918,8 +2072,8 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1918
2072
  return [addr, res];
1919
2073
  });
1920
2074
  }));
1921
- case 13:
1922
- cleanupResults = _context27.sent;
2075
+ case 46:
2076
+ cleanupResults = _context32.sent;
1923
2077
  _iterator = _createForOfIteratorHelper(cleanupResults);
1924
2078
  try {
1925
2079
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1931,15 +2085,15 @@ exports.ObjectCleanup = /*#__PURE__*/function () {
1931
2085
  } finally {
1932
2086
  _iterator.f();
1933
2087
  }
1934
- case 14:
1935
- return _context27.abrupt("return", results);
1936
- case 15:
2088
+ case 49:
2089
+ return _context32.abrupt("return", results);
2090
+ case 50:
1937
2091
  case "end":
1938
- return _context27.stop();
2092
+ return _context32.stop();
1939
2093
  }
1940
- }, _callee27, this, [[2, 4], [5, 7]]);
2094
+ }, _callee32, this, [[6, 11], [13, 21]]);
1941
2095
  }));
1942
- return function (_x20) {
1943
- return _ref48.apply(this, arguments);
2096
+ return function (_x26) {
2097
+ return _ref57.apply(this, arguments);
1944
2098
  };
1945
2099
  }();