@eluvio/elv-client-js 4.2.13 → 4.2.15

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 (52) 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 +17 -13
  44. package/src/client/Contracts.js +88 -7
  45. package/src/walletClient/index.js +15 -4
  46. package/utilities/ChannelCreate.js +1 -1
  47. package/utilities/CompositionCreate.js +517 -0
  48. package/utilities/LibraryDownloadMp4.js +371 -0
  49. package/utilities/MezDownloadMp4.js +177 -0
  50. package/utilities/lib/DownloadFile.js +88 -0
  51. package/utilities/lib/FrameAccurateVideo.js +431 -0
  52. package/utilities/lib/concerns/Metadata.js +2 -1
@@ -57,7 +57,7 @@ var EthClient = /*#__PURE__*/function () {
57
57
 
58
58
  //Ethers.errors.setLogLevel("error");
59
59
  }
60
- return _createClass(EthClient, [{
60
+ _createClass(EthClient, [{
61
61
  key: "Log",
62
62
  value: function Log(message) {
63
63
  var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -82,8 +82,8 @@ var EthClient = /*#__PURE__*/function () {
82
82
  // Ethers.js uses eth_getCode to ensure a contract is deployed and nothing else - this pulls a large chunk of pointless
83
83
  // data every time a contract is initialized in the client (often). Ethers.js just checks that the code isn't == "0x", so
84
84
  // we can give it some dummy string instead and assume the contract is fine
85
- this.provider.getCode = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
86
- return _regeneratorRuntime.wrap(function (_context) {
85
+ this.provider.getCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
86
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
87
87
  while (1) switch (_context.prev = _context.next) {
88
88
  case 0:
89
89
  return _context.abrupt("return", "0x123");
@@ -100,67 +100,67 @@ var EthClient = /*#__PURE__*/function () {
100
100
  }, {
101
101
  key: "ContractName",
102
102
  value: function () {
103
- var _ContractName = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(contractAddress) {
103
+ var _ContractName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(contractAddress) {
104
104
  var _this = this;
105
105
  var full,
106
106
  versionContract,
107
107
  version,
108
108
  _args3 = arguments;
109
- return _regeneratorRuntime.wrap(function (_context3) {
109
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
110
110
  while (1) switch (_context3.prev = _context3.next) {
111
111
  case 0:
112
112
  full = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
113
113
  versionContract = new Ethers.Contract(contractAddress, AccessibleContract.abi, this.Provider());
114
114
  if (!this.contractNames[contractAddress]) {
115
- this.contractNames[contractAddress] = new Promise(/*#__PURE__*/function () {
116
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
117
- var versionBytes32, _version, _t;
118
- return _regeneratorRuntime.wrap(function (_context2) {
115
+ this.contractNames[contractAddress] = new Promise( /*#__PURE__*/function () {
116
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
117
+ var versionBytes32, _version;
118
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
119
119
  while (1) switch (_context2.prev = _context2.next) {
120
120
  case 0:
121
121
  _context2.prev = 0;
122
- _context2.next = 1;
122
+ _context2.next = 3;
123
123
  return _this.CallContractMethod({
124
124
  contract: versionContract,
125
125
  abi: AccessibleContract.abi,
126
126
  methodName: "version",
127
127
  cacheContract: false
128
128
  });
129
- case 1:
129
+ case 3:
130
130
  versionBytes32 = _context2.sent;
131
131
  _version = Ethers.utils.parseBytes32String(
132
132
  // Ensure bytes32 string is null terminated
133
133
  versionBytes32.slice(0, -2) + "00");
134
134
  resolve(_version);
135
- _context2.next = 3;
135
+ _context2.next = 11;
136
136
  break;
137
- case 2:
138
- _context2.prev = 2;
139
- _t = _context2["catch"](0);
137
+ case 8:
138
+ _context2.prev = 8;
139
+ _context2.t0 = _context2["catch"](0);
140
140
  resolve("Unknown");
141
- case 3:
141
+ case 11:
142
142
  case "end":
143
143
  return _context2.stop();
144
144
  }
145
- }, _callee2, null, [[0, 2]]);
145
+ }, _callee2, null, [[0, 8]]);
146
146
  }));
147
147
  return function (_x2) {
148
148
  return _ref3.apply(this, arguments);
149
149
  };
150
150
  }());
151
151
  }
152
- _context3.next = 1;
152
+ _context3.next = 5;
153
153
  return this.contractNames[contractAddress];
154
- case 1:
154
+ case 5:
155
155
  version = _context3.sent;
156
156
  if (!full) {
157
- _context3.next = 2;
157
+ _context3.next = 10;
158
158
  break;
159
159
  }
160
160
  return _context3.abrupt("return", version);
161
- case 2:
161
+ case 10:
162
162
  return _context3.abrupt("return", version.split(/\d+/)[0]);
163
- case 3:
163
+ case 11:
164
164
  case "end":
165
165
  return _context3.stop();
166
166
  }
@@ -197,29 +197,29 @@ var EthClient = /*#__PURE__*/function () {
197
197
  }, {
198
198
  key: "MakeProviderCall",
199
199
  value: function () {
200
- var _MakeProviderCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
201
- var methodName, _ref5$args, args, _ref5$attempts, attempts, provider, _t2;
202
- return _regeneratorRuntime.wrap(function (_context4) {
200
+ var _MakeProviderCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
201
+ var methodName, _ref5$args, args, _ref5$attempts, attempts, provider;
202
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
203
203
  while (1) switch (_context4.prev = _context4.next) {
204
204
  case 0:
205
205
  methodName = _ref5.methodName, _ref5$args = _ref5.args, args = _ref5$args === void 0 ? [] : _ref5$args, _ref5$attempts = _ref5.attempts, attempts = _ref5$attempts === void 0 ? 0 : _ref5$attempts;
206
206
  _context4.prev = 1;
207
207
  provider = this.Provider();
208
- _context4.next = 2;
208
+ _context4.next = 5;
209
209
  return this.provider.getNetwork();
210
- case 2:
210
+ case 5:
211
211
  this.Log("ETH ".concat(provider.connection.url, " ").concat(methodName, " [").concat(args.join(", "), "]"));
212
- _context4.next = 3;
212
+ _context4.next = 8;
213
213
  return provider[methodName].apply(provider, _toConsumableArray(args));
214
- case 3:
214
+ case 8:
215
215
  return _context4.abrupt("return", _context4.sent);
216
- case 4:
217
- _context4.prev = 4;
218
- _t2 = _context4["catch"](1);
216
+ case 11:
217
+ _context4.prev = 11;
218
+ _context4.t0 = _context4["catch"](1);
219
219
  // eslint-disable-next-line no-console
220
- console.error(_t2);
220
+ console.error(_context4.t0);
221
221
  if (!(attempts < this.ethereumURIs.length)) {
222
- _context4.next = 5;
222
+ _context4.next = 19;
223
223
  break;
224
224
  }
225
225
  this.Log("EthClient failing over: ".concat(attempts + 1, " attempts"), true);
@@ -230,13 +230,13 @@ var EthClient = /*#__PURE__*/function () {
230
230
  args: args,
231
231
  attempts: attempts + 1
232
232
  }));
233
- case 5:
233
+ case 19:
234
234
  return _context4.abrupt("return", {});
235
- case 6:
235
+ case 20:
236
236
  case "end":
237
237
  return _context4.stop();
238
238
  }
239
- }, _callee4, this, [[1, 4]]);
239
+ }, _callee4, this, [[1, 11]]);
240
240
  }));
241
241
  function MakeProviderCall(_x3) {
242
242
  return _MakeProviderCall.apply(this, arguments);
@@ -315,9 +315,9 @@ var EthClient = /*#__PURE__*/function () {
315
315
  }, {
316
316
  key: "DeployContract",
317
317
  value: function () {
318
- var _DeployContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
318
+ var _DeployContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
319
319
  var abi, bytecode, _ref8$constructorArgs, constructorArgs, _ref8$overrides, overrides, provider, signer, contractFactory, contract;
320
- return _regeneratorRuntime.wrap(function (_context5) {
320
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
321
321
  while (1) switch (_context5.prev = _context5.next) {
322
322
  case 0:
323
323
  abi = _ref8.abi, bytecode = _ref8.bytecode, _ref8$constructorArgs = _ref8.constructorArgs, constructorArgs = _ref8$constructorArgs === void 0 ? [] : _ref8$constructorArgs, _ref8$overrides = _ref8.overrides, overrides = _ref8$overrides === void 0 ? {} : _ref8$overrides;
@@ -327,19 +327,19 @@ var EthClient = /*#__PURE__*/function () {
327
327
  signer = this.client.signer.connect(provider);
328
328
  this.ValidateSigner(signer);
329
329
  contractFactory = new Ethers.ContractFactory(abi, bytecode, signer);
330
- _context5.next = 1;
330
+ _context5.next = 9;
331
331
  return contractFactory.deploy.apply(contractFactory, _toConsumableArray(constructorArgs).concat([overrides]));
332
- case 1:
332
+ case 9:
333
333
  contract = _context5.sent;
334
- _context5.next = 2;
334
+ _context5.next = 12;
335
335
  return contract.deployed();
336
- case 2:
336
+ case 12:
337
337
  this.Log("Deployed: ".concat(contract.address));
338
338
  return _context5.abrupt("return", {
339
339
  contractAddress: Utils.FormatAddress(contract.address),
340
340
  transactionHash: contract.deployTransaction.hash
341
341
  });
342
- case 3:
342
+ case 14:
343
343
  case "end":
344
344
  return _context5.stop();
345
345
  }
@@ -353,23 +353,23 @@ var EthClient = /*#__PURE__*/function () {
353
353
  }, {
354
354
  key: "CallContractMethod",
355
355
  value: function () {
356
- var _CallContractMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref9) {
357
- var contract, contractAddress, abi, methodName, _ref9$methodArgs, methodArgs, value, _ref9$overrides, overrides, _ref9$formatArguments, formatArguments, _ref9$cacheContract, cacheContract, _ref9$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract, latestBlock, _t3;
358
- return _regeneratorRuntime.wrap(function (_context6) {
356
+ var _CallContractMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref9) {
357
+ var contract, contractAddress, abi, methodName, _ref9$methodArgs, methodArgs, value, _ref9$overrides, overrides, _ref9$formatArguments, formatArguments, _ref9$cacheContract, cacheContract, _ref9$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract, latestBlock;
358
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
359
359
  while (1) switch (_context6.prev = _context6.next) {
360
360
  case 0:
361
361
  contract = _ref9.contract, contractAddress = _ref9.contractAddress, abi = _ref9.abi, methodName = _ref9.methodName, _ref9$methodArgs = _ref9.methodArgs, methodArgs = _ref9$methodArgs === void 0 ? [] : _ref9$methodArgs, value = _ref9.value, _ref9$overrides = _ref9.overrides, overrides = _ref9$overrides === void 0 ? {} : _ref9$overrides, _ref9$formatArguments = _ref9.formatArguments, formatArguments = _ref9$formatArguments === void 0 ? true : _ref9$formatArguments, _ref9$cacheContract = _ref9.cacheContract, cacheContract = _ref9$cacheContract === void 0 ? true : _ref9$cacheContract, _ref9$overrideCachedC = _ref9.overrideCachedContract, overrideCachedContract = _ref9$overrideCachedC === void 0 ? false : _ref9$overrideCachedC;
362
362
  if (abi) {
363
- _context6.next = 2;
363
+ _context6.next = 5;
364
364
  break;
365
365
  }
366
- _context6.next = 1;
366
+ _context6.next = 4;
367
367
  return this.client.ContractAbi({
368
368
  contractAddress: contractAddress
369
369
  });
370
- case 1:
370
+ case 4:
371
371
  abi = _context6.sent;
372
- case 2:
372
+ case 5:
373
373
  contract = contract || this.Contract({
374
374
  contractAddress: contractAddress,
375
375
  abi: abi,
@@ -391,99 +391,99 @@ var EthClient = /*#__PURE__*/function () {
391
391
  overrides.value = "0x" + Utils.EtherToWei(value.toString()).toString(16);
392
392
  }
393
393
  if (!(contract.functions[methodName] === undefined)) {
394
- _context6.next = 3;
394
+ _context6.next = 11;
395
395
  break;
396
396
  }
397
397
  throw Error("Unknown method: " + methodName);
398
- case 3:
398
+ case 11:
399
399
  this.Log("Calling contract method:\n Provider: ".concat(this.Provider().connection.url, "\n Address: ").concat(contract.address, "\n Method: ").concat(methodName, "\n Args: [").concat(methodArgs.join(", "), "]"));
400
400
  methodAbi = contract["interface"].fragments.find(function (method) {
401
401
  return method.name === methodName;
402
402
  }); // Lock if performing a transaction
403
403
  if (!(!methodAbi || !methodAbi.constant)) {
404
- _context6.next = 7;
404
+ _context6.next = 20;
405
405
  break;
406
406
  }
407
- case 4:
407
+ case 14:
408
408
  if (!this.locked) {
409
- _context6.next = 6;
409
+ _context6.next = 19;
410
410
  break;
411
411
  }
412
- _context6.next = 5;
412
+ _context6.next = 17;
413
413
  return new Promise(function (resolve) {
414
414
  return setTimeout(resolve, 100);
415
415
  });
416
- case 5:
417
- _context6.next = 4;
416
+ case 17:
417
+ _context6.next = 14;
418
418
  break;
419
- case 6:
419
+ case 19:
420
420
  this.locked = true;
421
- case 7:
422
- _context6.prev = 7;
421
+ case 20:
422
+ _context6.prev = 20;
423
423
  success = false;
424
- case 8:
424
+ case 22:
425
425
  if (success) {
426
- _context6.next = 16;
426
+ _context6.next = 49;
427
427
  break;
428
428
  }
429
- _context6.prev = 9;
430
- _context6.next = 10;
429
+ _context6.prev = 23;
430
+ _context6.next = 26;
431
431
  return (_contract = contract)[methodName].apply(_contract, _toConsumableArray(methodArgs).concat([overrides]));
432
- case 10:
432
+ case 26:
433
433
  result = _context6.sent;
434
434
  success = true;
435
- _context6.next = 15;
435
+ _context6.next = 47;
436
436
  break;
437
- case 11:
438
- _context6.prev = 11;
439
- _t3 = _context6["catch"](9);
440
- if (!(_t3.code === -32000 || _t3.code === "REPLACEMENT_UNDERPRICED")) {
441
- _context6.next = 13;
437
+ case 30:
438
+ _context6.prev = 30;
439
+ _context6.t0 = _context6["catch"](23);
440
+ if (!(_context6.t0.code === -32000 || _context6.t0.code === "REPLACEMENT_UNDERPRICED")) {
441
+ _context6.next = 40;
442
442
  break;
443
443
  }
444
- _context6.next = 12;
444
+ _context6.next = 35;
445
445
  return this.MakeProviderCall({
446
446
  methodName: "getBlock",
447
447
  args: ["latest"]
448
448
  });
449
- case 12:
449
+ case 35:
450
450
  latestBlock = _context6.sent;
451
451
  overrides.gasLimit = latestBlock.gasLimit;
452
452
  overrides.gasPrice = overrides.gasPrice ? overrides.gasPrice * 1.50 : 8000000000;
453
- _context6.next = 15;
453
+ _context6.next = 47;
454
454
  break;
455
- case 13:
456
- if (!(_t3.code === "NONCE_EXPIRED" && _t3.reason === "nonce has already been used")) {
457
- _context6.next = 14;
455
+ case 40:
456
+ if (!(_context6.t0.code === "NONCE_EXPIRED" && _context6.t0.reason === "nonce has already been used")) {
457
+ _context6.next = 44;
458
458
  break;
459
459
  }
460
460
  this.Log("Retrying method call ".concat(methodName));
461
- _context6.next = 15;
461
+ _context6.next = 47;
462
462
  break;
463
- case 14:
464
- if ((_t3.message || _t3).includes("invalid response")) {
465
- _context6.next = 15;
463
+ case 44:
464
+ if ((_context6.t0.message || _context6.t0).includes("invalid response")) {
465
+ _context6.next = 47;
466
466
  break;
467
467
  }
468
- this.Log(_typeof(_t3) === "object" ? JSON.stringify(_t3, null, 2) : _t3, true);
469
- throw _t3;
470
- case 15:
471
- _context6.next = 8;
468
+ this.Log(_typeof(_context6.t0) === "object" ? JSON.stringify(_context6.t0, null, 2) : _context6.t0, true);
469
+ throw _context6.t0;
470
+ case 47:
471
+ _context6.next = 22;
472
472
  break;
473
- case 16:
473
+ case 49:
474
474
  return _context6.abrupt("return", result);
475
- case 17:
476
- _context6.prev = 17;
475
+ case 50:
476
+ _context6.prev = 50;
477
477
  // Unlock if performing a transaction
478
478
  if (!methodAbi || !methodAbi.constant) {
479
479
  this.locked = false;
480
480
  }
481
- return _context6.finish(17);
482
- case 18:
481
+ return _context6.finish(50);
482
+ case 53:
483
483
  case "end":
484
484
  return _context6.stop();
485
485
  }
486
- }, _callee6, this, [[7,, 17, 18], [9, 11]]);
486
+ }, _callee6, this, [[20,, 50, 53], [23, 30]]);
487
487
  }));
488
488
  function CallContractMethod(_x5) {
489
489
  return _CallContractMethod.apply(this, arguments);
@@ -493,31 +493,31 @@ var EthClient = /*#__PURE__*/function () {
493
493
  }, {
494
494
  key: "CallContractMethodAndWait",
495
495
  value: function () {
496
- var _CallContractMethodAndWait = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref0) {
497
- var contractAddress, abi, methodName, methodArgs, value, timeout, _ref0$formatArguments, formatArguments, _ref0$cacheContract, cacheContract, _ref0$overrideCachedC, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
498
- return _regeneratorRuntime.wrap(function (_context7) {
496
+ var _CallContractMethodAndWait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
497
+ var contractAddress, abi, methodName, methodArgs, value, timeout, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
498
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
499
499
  while (1) switch (_context7.prev = _context7.next) {
500
500
  case 0:
501
- contractAddress = _ref0.contractAddress, abi = _ref0.abi, methodName = _ref0.methodName, methodArgs = _ref0.methodArgs, value = _ref0.value, timeout = _ref0.timeout, _ref0$formatArguments = _ref0.formatArguments, formatArguments = _ref0$formatArguments === void 0 ? true : _ref0$formatArguments, _ref0$cacheContract = _ref0.cacheContract, cacheContract = _ref0$cacheContract === void 0 ? true : _ref0$cacheContract, _ref0$overrideCachedC = _ref0.overrideCachedContract, overrideCachedContract = _ref0$overrideCachedC === void 0 ? false : _ref0$overrideCachedC;
501
+ contractAddress = _ref10.contractAddress, abi = _ref10.abi, methodName = _ref10.methodName, methodArgs = _ref10.methodArgs, value = _ref10.value, timeout = _ref10.timeout, _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;
502
502
  timeout = timeout || this.timeout || 10000;
503
503
  if (abi) {
504
- _context7.next = 2;
504
+ _context7.next = 6;
505
505
  break;
506
506
  }
507
- _context7.next = 1;
507
+ _context7.next = 5;
508
508
  return this.client.ContractAbi({
509
509
  contractAddress: contractAddress
510
510
  });
511
- case 1:
511
+ case 5:
512
512
  abi = _context7.sent;
513
- case 2:
513
+ case 6:
514
514
  contract = this.Contract({
515
515
  contractAddress: contractAddress,
516
516
  abi: abi,
517
517
  cacheContract: cacheContract,
518
518
  overrideCachedContract: overrideCachedContract
519
519
  }); // Make method call
520
- _context7.next = 3;
520
+ _context7.next = 9;
521
521
  return this.CallContractMethod({
522
522
  contract: contract,
523
523
  abi: abi,
@@ -527,27 +527,27 @@ var EthClient = /*#__PURE__*/function () {
527
527
  formatArguments: formatArguments,
528
528
  cacheContract: cacheContract
529
529
  });
530
- case 3:
530
+ case 9:
531
531
  createMethodCall = _context7.sent;
532
532
  this.Log("Awaiting transaction completion: ".concat(createMethodCall.hash));
533
533
 
534
534
  // Poll for transaction completion
535
535
  interval = this.Provider().pollingInterval;
536
536
  elapsed = 0;
537
- case 4:
537
+ case 13:
538
538
  if (!(elapsed < timeout)) {
539
- _context7.next = 8;
539
+ _context7.next = 25;
540
540
  break;
541
541
  }
542
- _context7.next = 5;
542
+ _context7.next = 16;
543
543
  return this.MakeProviderCall({
544
544
  methodName: "getTransactionReceipt",
545
545
  args: [createMethodCall.hash]
546
546
  });
547
- case 5:
547
+ case 16:
548
548
  methodEvent = _context7.sent;
549
549
  if (!methodEvent) {
550
- _context7.next = 6;
550
+ _context7.next = 20;
551
551
  break;
552
552
  }
553
553
  methodEvent.logs = methodEvent.logs.map(function (log) {
@@ -558,25 +558,25 @@ var EthClient = /*#__PURE__*/function () {
558
558
  } catch (error) {}
559
559
  return _objectSpread(_objectSpread({}, log), parsedLogs);
560
560
  });
561
- return _context7.abrupt("continue", 8);
562
- case 6:
561
+ return _context7.abrupt("break", 25);
562
+ case 20:
563
563
  elapsed += interval;
564
- _context7.next = 7;
564
+ _context7.next = 23;
565
565
  return new Promise(function (resolve) {
566
566
  return setTimeout(resolve, interval);
567
567
  });
568
- case 7:
569
- _context7.next = 4;
568
+ case 23:
569
+ _context7.next = 13;
570
570
  break;
571
- case 8:
571
+ case 25:
572
572
  if (methodEvent) {
573
- _context7.next = 9;
573
+ _context7.next = 27;
574
574
  break;
575
575
  }
576
576
  throw Error("Timed out waiting for completion of ".concat(methodName, ". TXID: ").concat(createMethodCall.hash));
577
- case 9:
577
+ case 27:
578
578
  return _context7.abrupt("return", methodEvent);
579
- case 10:
579
+ case 28:
580
580
  case "end":
581
581
  return _context7.stop();
582
582
  }
@@ -590,26 +590,26 @@ var EthClient = /*#__PURE__*/function () {
590
590
  }, {
591
591
  key: "AwaitEvent",
592
592
  value: function () {
593
- var _AwaitEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref1) {
593
+ var _AwaitEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref11) {
594
594
  var contractAddress, abi, eventName, contract;
595
- return _regeneratorRuntime.wrap(function (_context8) {
595
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
596
596
  while (1) switch (_context8.prev = _context8.next) {
597
597
  case 0:
598
- contractAddress = _ref1.contractAddress, abi = _ref1.abi, eventName = _ref1.eventName;
598
+ contractAddress = _ref11.contractAddress, abi = _ref11.abi, eventName = _ref11.eventName;
599
599
  contract = this.Contract({
600
600
  contractAddress: contractAddress,
601
601
  abi: abi
602
602
  });
603
- _context8.next = 1;
603
+ _context8.next = 4;
604
604
  return new Promise(function (resolve) {
605
605
  contract.on(eventName, function (_, __, event) {
606
606
  contract.removeAllListeners(eventName);
607
607
  resolve(event);
608
608
  });
609
609
  });
610
- case 1:
610
+ case 4:
611
611
  return _context8.abrupt("return", _context8.sent);
612
- case 2:
612
+ case 5:
613
613
  case "end":
614
614
  return _context8.stop();
615
615
  }
@@ -622,10 +622,10 @@ var EthClient = /*#__PURE__*/function () {
622
622
  }()
623
623
  }, {
624
624
  key: "ExtractEventFromLogs",
625
- value: function ExtractEventFromLogs(_ref10) {
626
- var abi = _ref10.abi,
627
- event = _ref10.event,
628
- eventName = _ref10.eventName;
625
+ value: function ExtractEventFromLogs(_ref12) {
626
+ var abi = _ref12.abi,
627
+ event = _ref12.event,
628
+ eventName = _ref12.eventName;
629
629
  var contractInterface = new Ethers.utils.Interface(abi);
630
630
  // Loop through logs to find the desired log
631
631
  var _iterator = _createForOfIteratorHelper(event.logs),
@@ -650,26 +650,26 @@ var EthClient = /*#__PURE__*/function () {
650
650
  }, {
651
651
  key: "DeployDependentContract",
652
652
  value: function () {
653
- var _DeployDependentContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref11) {
654
- var contractAddress, methodName, _ref11$args, args, eventName, eventValue, abi, event, eventLog, newContractAddress;
655
- return _regeneratorRuntime.wrap(function (_context9) {
653
+ var _DeployDependentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
654
+ var contractAddress, methodName, _ref13$args, args, eventName, eventValue, abi, event, eventLog, newContractAddress;
655
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
656
656
  while (1) switch (_context9.prev = _context9.next) {
657
657
  case 0:
658
- contractAddress = _ref11.contractAddress, methodName = _ref11.methodName, _ref11$args = _ref11.args, args = _ref11$args === void 0 ? [] : _ref11$args, eventName = _ref11.eventName, eventValue = _ref11.eventValue;
659
- _context9.next = 1;
658
+ contractAddress = _ref13.contractAddress, methodName = _ref13.methodName, _ref13$args = _ref13.args, args = _ref13$args === void 0 ? [] : _ref13$args, eventName = _ref13.eventName, eventValue = _ref13.eventValue;
659
+ _context9.next = 3;
660
660
  return this.client.ContractAbi({
661
661
  contractAddress: contractAddress
662
662
  });
663
- case 1:
663
+ case 3:
664
664
  abi = _context9.sent;
665
- _context9.next = 2;
665
+ _context9.next = 6;
666
666
  return this.CallContractMethodAndWait({
667
667
  contractAddress: contractAddress,
668
668
  abi: abi,
669
669
  methodName: methodName,
670
670
  methodArgs: args
671
671
  });
672
- case 2:
672
+ case 6:
673
673
  event = _context9.sent;
674
674
  eventLog = this.ExtractEventFromLogs({
675
675
  abi: abi,
@@ -678,17 +678,17 @@ var EthClient = /*#__PURE__*/function () {
678
678
  eventValue: eventValue
679
679
  });
680
680
  if (eventLog) {
681
- _context9.next = 3;
681
+ _context9.next = 10;
682
682
  break;
683
683
  }
684
684
  throw Error("".concat(methodName, " failed - Log not present in transaction"));
685
- case 3:
685
+ case 10:
686
686
  newContractAddress = eventLog.args[eventValue];
687
687
  return _context9.abrupt("return", {
688
688
  contractAddress: Utils.FormatAddress(newContractAddress),
689
689
  transactionHash: event.transactionHash
690
690
  });
691
- case 4:
691
+ case 12:
692
692
  case "end":
693
693
  return _context9.stop();
694
694
  }
@@ -701,54 +701,54 @@ var EthClient = /*#__PURE__*/function () {
701
701
  }() /* Specific contract management */
702
702
  }, {
703
703
  key: "DeployAccessGroupContract",
704
- value: (function () {
705
- var _DeployAccessGroupContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref12) {
704
+ value: function () {
705
+ var _DeployAccessGroupContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
706
706
  var contentSpaceAddress;
707
- return _regeneratorRuntime.wrap(function (_context0) {
708
- while (1) switch (_context0.prev = _context0.next) {
707
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
708
+ while (1) switch (_context10.prev = _context10.next) {
709
709
  case 0:
710
- contentSpaceAddress = _ref12.contentSpaceAddress;
711
- return _context0.abrupt("return", this.DeployDependentContract({
710
+ contentSpaceAddress = _ref14.contentSpaceAddress;
711
+ return _context10.abrupt("return", this.DeployDependentContract({
712
712
  contractAddress: contentSpaceAddress,
713
713
  methodName: "createGroup",
714
714
  args: [],
715
715
  eventName: "CreateGroup",
716
716
  eventValue: "groupAddress"
717
717
  }));
718
- case 1:
718
+ case 2:
719
719
  case "end":
720
- return _context0.stop();
720
+ return _context10.stop();
721
721
  }
722
- }, _callee0, this);
722
+ }, _callee10, this);
723
723
  }));
724
724
  function DeployAccessGroupContract(_x9) {
725
725
  return _DeployAccessGroupContract.apply(this, arguments);
726
726
  }
727
727
  return DeployAccessGroupContract;
728
- }())
728
+ }()
729
729
  }, {
730
730
  key: "DeployTypeContract",
731
731
  value: function () {
732
- var _DeployTypeContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(_ref13) {
732
+ var _DeployTypeContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref15) {
733
733
  var contentSpaceAddress;
734
- return _regeneratorRuntime.wrap(function (_context1) {
735
- while (1) switch (_context1.prev = _context1.next) {
734
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
735
+ while (1) switch (_context11.prev = _context11.next) {
736
736
  case 0:
737
- contentSpaceAddress = _ref13.contentSpaceAddress;
738
- return _context1.abrupt("return", this.DeployDependentContract({
737
+ contentSpaceAddress = _ref15.contentSpaceAddress;
738
+ return _context11.abrupt("return", this.DeployDependentContract({
739
739
  contractAddress: contentSpaceAddress,
740
740
  methodName: "createContentType",
741
741
  args: [],
742
742
  eventName: "CreateContentType",
743
743
  eventValue: "contentTypeAddress"
744
744
  }));
745
- case 1:
745
+ case 2:
746
746
  case "end":
747
- return _context1.stop();
747
+ return _context11.stop();
748
748
  }
749
- }, _callee1, this);
749
+ }, _callee11, this);
750
750
  }));
751
- function DeployTypeContract(_x0) {
751
+ function DeployTypeContract(_x10) {
752
752
  return _DeployTypeContract.apply(this, arguments);
753
753
  }
754
754
  return DeployTypeContract;
@@ -756,27 +756,27 @@ var EthClient = /*#__PURE__*/function () {
756
756
  }, {
757
757
  key: "DeployLibraryContract",
758
758
  value: function () {
759
- var _DeployLibraryContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
759
+ var _DeployLibraryContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref16) {
760
760
  var contentSpaceAddress, kmsId, kmsAddress;
761
- return _regeneratorRuntime.wrap(function (_context10) {
762
- while (1) switch (_context10.prev = _context10.next) {
761
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
762
+ while (1) switch (_context12.prev = _context12.next) {
763
763
  case 0:
764
- contentSpaceAddress = _ref14.contentSpaceAddress, kmsId = _ref14.kmsId;
764
+ contentSpaceAddress = _ref16.contentSpaceAddress, kmsId = _ref16.kmsId;
765
765
  kmsAddress = Utils.HashToAddress(kmsId);
766
- return _context10.abrupt("return", this.DeployDependentContract({
766
+ return _context12.abrupt("return", this.DeployDependentContract({
767
767
  contractAddress: contentSpaceAddress,
768
768
  methodName: "createLibrary",
769
769
  args: [kmsAddress],
770
770
  eventName: "CreateLibrary",
771
771
  eventValue: "libraryAddress"
772
772
  }));
773
- case 1:
773
+ case 3:
774
774
  case "end":
775
- return _context10.stop();
775
+ return _context12.stop();
776
776
  }
777
- }, _callee10, this);
777
+ }, _callee12, this);
778
778
  }));
779
- function DeployLibraryContract(_x1) {
779
+ function DeployLibraryContract(_x11) {
780
780
  return _DeployLibraryContract.apply(this, arguments);
781
781
  }
782
782
  return DeployLibraryContract;
@@ -784,28 +784,28 @@ var EthClient = /*#__PURE__*/function () {
784
784
  }, {
785
785
  key: "DeployContentContract",
786
786
  value: function () {
787
- var _DeployContentContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref15) {
787
+ var _DeployContentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
788
788
  var contentLibraryAddress, typeAddress;
789
- return _regeneratorRuntime.wrap(function (_context11) {
790
- while (1) switch (_context11.prev = _context11.next) {
789
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
790
+ while (1) switch (_context13.prev = _context13.next) {
791
791
  case 0:
792
- contentLibraryAddress = _ref15.contentLibraryAddress, typeAddress = _ref15.typeAddress;
792
+ contentLibraryAddress = _ref17.contentLibraryAddress, typeAddress = _ref17.typeAddress;
793
793
  // If type is not specified, use null address
794
794
  typeAddress = typeAddress || Utils.nullAddress;
795
- return _context11.abrupt("return", this.DeployDependentContract({
795
+ return _context13.abrupt("return", this.DeployDependentContract({
796
796
  contractAddress: contentLibraryAddress,
797
797
  methodName: "createContent",
798
798
  args: [typeAddress],
799
799
  eventName: "ContentObjectCreated",
800
800
  eventValue: "contentAddress"
801
801
  }));
802
- case 1:
802
+ case 3:
803
803
  case "end":
804
- return _context11.stop();
804
+ return _context13.stop();
805
805
  }
806
- }, _callee11, this);
806
+ }, _callee13, this);
807
807
  }));
808
- function DeployContentContract(_x10) {
808
+ function DeployContentContract(_x12) {
809
809
  return _DeployContentContract.apply(this, arguments);
810
810
  }
811
811
  return DeployContentContract;
@@ -813,28 +813,28 @@ var EthClient = /*#__PURE__*/function () {
813
813
  }, {
814
814
  key: "CommitContent",
815
815
  value: function () {
816
- var _CommitContent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref16) {
816
+ var _CommitContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
817
817
  var contentObjectAddress, versionHash;
818
- return _regeneratorRuntime.wrap(function (_context12) {
819
- while (1) switch (_context12.prev = _context12.next) {
818
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
819
+ while (1) switch (_context14.prev = _context14.next) {
820
820
  case 0:
821
- contentObjectAddress = _ref16.contentObjectAddress, versionHash = _ref16.versionHash;
822
- _context12.next = 1;
821
+ contentObjectAddress = _ref18.contentObjectAddress, versionHash = _ref18.versionHash;
822
+ _context14.next = 3;
823
823
  return this.CallContractMethodAndWait({
824
824
  contractAddress: contentObjectAddress,
825
825
  methodName: "commit",
826
826
  methodArgs: [versionHash],
827
827
  eventName: "CommitPending"
828
828
  });
829
- case 1:
830
- return _context12.abrupt("return", _context12.sent);
831
- case 2:
829
+ case 3:
830
+ return _context14.abrupt("return", _context14.sent);
831
+ case 4:
832
832
  case "end":
833
- return _context12.stop();
833
+ return _context14.stop();
834
834
  }
835
- }, _callee12, this);
835
+ }, _callee14, this);
836
836
  }));
837
- function CommitContent(_x11) {
837
+ function CommitContent(_x13) {
838
838
  return _CommitContent.apply(this, arguments);
839
839
  }
840
840
  return CommitContent;
@@ -842,24 +842,24 @@ var EthClient = /*#__PURE__*/function () {
842
842
  }, {
843
843
  key: "EngageAccountLibrary",
844
844
  value: function () {
845
- var _EngageAccountLibrary = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
845
+ var _EngageAccountLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
846
846
  var contentSpaceAddress;
847
- return _regeneratorRuntime.wrap(function (_context13) {
848
- while (1) switch (_context13.prev = _context13.next) {
847
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
848
+ while (1) switch (_context15.prev = _context15.next) {
849
849
  case 0:
850
- contentSpaceAddress = _ref17.contentSpaceAddress;
851
- return _context13.abrupt("return", this.CallContractMethodAndWait({
850
+ contentSpaceAddress = _ref19.contentSpaceAddress;
851
+ return _context15.abrupt("return", this.CallContractMethodAndWait({
852
852
  contractAddress: contentSpaceAddress,
853
853
  methodName: "engageAccountLibrary",
854
854
  args: []
855
855
  }));
856
- case 1:
856
+ case 2:
857
857
  case "end":
858
- return _context13.stop();
858
+ return _context15.stop();
859
859
  }
860
- }, _callee13, this);
860
+ }, _callee15, this);
861
861
  }));
862
- function EngageAccountLibrary(_x12) {
862
+ function EngageAccountLibrary(_x14) {
863
863
  return _EngageAccountLibrary.apply(this, arguments);
864
864
  }
865
865
  return EngageAccountLibrary;
@@ -867,28 +867,28 @@ var EthClient = /*#__PURE__*/function () {
867
867
  }, {
868
868
  key: "SetCustomContentContract",
869
869
  value: function () {
870
- var _SetCustomContentContract = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
871
- var contentContractAddress, customContractAddress, _ref18$overrides, overrides;
872
- return _regeneratorRuntime.wrap(function (_context14) {
873
- while (1) switch (_context14.prev = _context14.next) {
870
+ var _SetCustomContentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
871
+ var contentContractAddress, customContractAddress, _ref20$overrides, overrides;
872
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
873
+ while (1) switch (_context16.prev = _context16.next) {
874
874
  case 0:
875
- contentContractAddress = _ref18.contentContractAddress, customContractAddress = _ref18.customContractAddress, _ref18$overrides = _ref18.overrides, overrides = _ref18$overrides === void 0 ? {} : _ref18$overrides;
876
- _context14.next = 1;
875
+ contentContractAddress = _ref20.contentContractAddress, customContractAddress = _ref20.customContractAddress, _ref20$overrides = _ref20.overrides, overrides = _ref20$overrides === void 0 ? {} : _ref20$overrides;
876
+ _context16.next = 3;
877
877
  return this.CallContractMethodAndWait({
878
878
  contractAddress: contentContractAddress,
879
879
  methodName: "setContentContractAddress",
880
880
  methodArgs: [customContractAddress],
881
881
  overrides: overrides
882
882
  });
883
- case 1:
884
- return _context14.abrupt("return", _context14.sent);
885
- case 2:
883
+ case 3:
884
+ return _context16.abrupt("return", _context16.sent);
885
+ case 4:
886
886
  case "end":
887
- return _context14.stop();
887
+ return _context16.stop();
888
888
  }
889
- }, _callee14, this);
889
+ }, _callee16, this);
890
890
  }));
891
- function SetCustomContentContract(_x13) {
891
+ function SetCustomContentContract(_x15) {
892
892
  return _SetCustomContentContract.apply(this, arguments);
893
893
  }
894
894
  return SetCustomContentContract;
@@ -896,13 +896,13 @@ var EthClient = /*#__PURE__*/function () {
896
896
  }, {
897
897
  key: "ContractEvents",
898
898
  value: function () {
899
- var _ContractEvents = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref19) {
899
+ var _ContractEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref21) {
900
900
  var _this4 = this;
901
- var contractAddress, abi, _ref19$fromBlock, fromBlock, toBlock, topics, _ref19$includeTransac, includeTransaction, filter, contractLogs, blocks, _t7;
902
- return _regeneratorRuntime.wrap(function (_context16) {
903
- while (1) switch (_context16.prev = _context16.next) {
901
+ var contractAddress, abi, _ref21$fromBlock, fromBlock, toBlock, topics, _ref21$includeTransac, includeTransaction, filter, contractLogs, blocks;
902
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
903
+ while (1) switch (_context18.prev = _context18.next) {
904
904
  case 0:
905
- contractAddress = _ref19.contractAddress, abi = _ref19.abi, _ref19$fromBlock = _ref19.fromBlock, fromBlock = _ref19$fromBlock === void 0 ? 0 : _ref19$fromBlock, toBlock = _ref19.toBlock, topics = _ref19.topics, _ref19$includeTransac = _ref19.includeTransaction, includeTransaction = _ref19$includeTransac === void 0 ? false : _ref19$includeTransac;
905
+ contractAddress = _ref21.contractAddress, abi = _ref21.abi, _ref21$fromBlock = _ref21.fromBlock, fromBlock = _ref21$fromBlock === void 0 ? 0 : _ref21$fromBlock, toBlock = _ref21.toBlock, topics = _ref21.topics, _ref21$includeTransac = _ref21.includeTransaction, includeTransaction = _ref21$includeTransac === void 0 ? false : _ref21$includeTransac;
906
906
  filter = {
907
907
  address: contractAddress,
908
908
  fromBlock: fromBlock,
@@ -911,81 +911,81 @@ var EthClient = /*#__PURE__*/function () {
911
911
  if (topics) {
912
912
  filter.topics = topics;
913
913
  }
914
- _context16.next = 1;
914
+ _context18.next = 5;
915
915
  return this.MakeProviderCall({
916
916
  methodName: "getLogs",
917
917
  args: [filter]
918
918
  });
919
- case 1:
920
- _t7 = _context16.sent;
921
- if (_t7) {
922
- _context16.next = 2;
919
+ case 5:
920
+ _context18.t0 = _context18.sent;
921
+ if (_context18.t0) {
922
+ _context18.next = 8;
923
923
  break;
924
924
  }
925
- _t7 = [];
926
- case 2:
927
- contractLogs = _t7;
925
+ _context18.t0 = [];
926
+ case 8:
927
+ contractLogs = _context18.t0;
928
928
  if (Array.isArray(contractLogs)) {
929
- _context16.next = 3;
929
+ _context18.next = 11;
930
930
  break;
931
931
  }
932
- return _context16.abrupt("return", []);
933
- case 3:
932
+ return _context18.abrupt("return", []);
933
+ case 11:
934
934
  blocks = {};
935
- _context16.next = 4;
935
+ _context18.next = 14;
936
936
  return Utils.LimitedMap(5, contractLogs, /*#__PURE__*/function () {
937
- var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(log) {
938
- var eventInterface, parsedLog, _t4, _t5, _t6;
939
- return _regeneratorRuntime.wrap(function (_context15) {
940
- while (1) switch (_context15.prev = _context15.next) {
937
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(log) {
938
+ var eventInterface, parsedLog;
939
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
940
+ while (1) switch (_context17.prev = _context17.next) {
941
941
  case 0:
942
942
  eventInterface = new Ethers.utils.Interface(abi);
943
943
  parsedLog = _objectSpread(_objectSpread({}, log), eventInterface.parseLog(log));
944
944
  if (!includeTransaction) {
945
- _context15.next = 2;
945
+ _context17.next = 9;
946
946
  break;
947
947
  }
948
- _t4 = _objectSpread;
949
- _t5 = _objectSpread({}, parsedLog);
950
- _context15.next = 1;
948
+ _context17.t0 = _objectSpread;
949
+ _context17.t1 = _objectSpread({}, parsedLog);
950
+ _context17.next = 7;
951
951
  return _this4.MakeProviderCall({
952
952
  methodName: "getTransaction",
953
953
  args: [log.transactionHash]
954
954
  });
955
- case 1:
956
- _t6 = _context15.sent;
957
- parsedLog = _t4(_t5, _t6);
958
- case 2:
955
+ case 7:
956
+ _context17.t2 = _context17.sent;
957
+ parsedLog = (0, _context17.t0)(_context17.t1, _context17.t2);
958
+ case 9:
959
959
  blocks[log.blockNumber] = [parsedLog].concat(blocks[log.blockNumber] || []);
960
- case 3:
960
+ case 10:
961
961
  case "end":
962
- return _context15.stop();
962
+ return _context17.stop();
963
963
  }
964
- }, _callee15);
964
+ }, _callee17);
965
965
  }));
966
- return function (_x15) {
967
- return _ref20.apply(this, arguments);
966
+ return function (_x17) {
967
+ return _ref22.apply(this, arguments);
968
968
  };
969
969
  }());
970
- case 4:
971
- return _context16.abrupt("return", Object.values(blocks).sort(function (a, b) {
970
+ case 14:
971
+ return _context18.abrupt("return", Object.values(blocks).sort(function (a, b) {
972
972
  return a[0].blockNumber < b[0].blockNumber ? 1 : -1;
973
973
  }));
974
- case 5:
974
+ case 15:
975
975
  case "end":
976
- return _context16.stop();
976
+ return _context18.stop();
977
977
  }
978
- }, _callee16, this);
978
+ }, _callee18, this);
979
979
  }));
980
- function ContractEvents(_x14) {
980
+ function ContractEvents(_x16) {
981
981
  return _ContractEvents.apply(this, arguments);
982
982
  }
983
983
  return ContractEvents;
984
984
  }() // Look up the log topic and see if it is known. If so, parse it and inject it into the log
985
985
  }, {
986
986
  key: "ParseUnknownLog",
987
- value: function ParseUnknownLog(_ref21) {
988
- var log = _ref21.log;
987
+ value: function ParseUnknownLog(_ref23) {
988
+ var log = _ref23.log;
989
989
  if (log.topics && log.topics.length > 0) {
990
990
  var topicHash = log.topics[0];
991
991
  var topicInfo = Topics[topicHash];
@@ -1006,22 +1006,22 @@ var EthClient = /*#__PURE__*/function () {
1006
1006
  }, {
1007
1007
  key: "Events",
1008
1008
  value: function () {
1009
- var _Events = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref22) {
1009
+ var _Events = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref24) {
1010
1010
  var _this5 = this;
1011
- var toBlock, fromBlock, _ref22$includeTransac, includeTransaction, logs, i, newLogs, blocks, output;
1012
- return _regeneratorRuntime.wrap(function (_context19) {
1013
- while (1) switch (_context19.prev = _context19.next) {
1011
+ var toBlock, fromBlock, _ref24$includeTransac, includeTransaction, logs, i, newLogs, blocks, output;
1012
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1013
+ while (1) switch (_context21.prev = _context21.next) {
1014
1014
  case 0:
1015
- toBlock = _ref22.toBlock, fromBlock = _ref22.fromBlock, _ref22$includeTransac = _ref22.includeTransaction, includeTransaction = _ref22$includeTransac === void 0 ? false : _ref22$includeTransac;
1015
+ toBlock = _ref24.toBlock, fromBlock = _ref24.fromBlock, _ref24$includeTransac = _ref24.includeTransaction, includeTransaction = _ref24$includeTransac === void 0 ? false : _ref24$includeTransac;
1016
1016
  // Pull logs in batches of 100
1017
1017
  logs = [];
1018
1018
  i = fromBlock;
1019
- case 1:
1019
+ case 3:
1020
1020
  if (!(i < toBlock)) {
1021
- _context19.next = 4;
1021
+ _context21.next = 11;
1022
1022
  break;
1023
1023
  }
1024
- _context19.next = 2;
1024
+ _context21.next = 6;
1025
1025
  return this.MakeProviderCall({
1026
1026
  methodName: "getLogs",
1027
1027
  args: [{
@@ -1029,14 +1029,14 @@ var EthClient = /*#__PURE__*/function () {
1029
1029
  toBlock: Math.min(toBlock, i + 100)
1030
1030
  }]
1031
1031
  });
1032
- case 2:
1033
- newLogs = _context19.sent;
1032
+ case 6:
1033
+ newLogs = _context21.sent;
1034
1034
  logs = logs.concat(newLogs || []);
1035
- case 3:
1035
+ case 8:
1036
1036
  i += 101;
1037
- _context19.next = 1;
1037
+ _context21.next = 3;
1038
1038
  break;
1039
- case 4:
1039
+ case 11:
1040
1040
  // Group logs by blocknumber
1041
1041
  blocks = {};
1042
1042
  logs.forEach(function (log) {
@@ -1045,26 +1045,26 @@ var EthClient = /*#__PURE__*/function () {
1045
1045
  })].concat(blocks[log.blockNumber] || []);
1046
1046
  });
1047
1047
  output = [];
1048
- _context19.next = 5;
1048
+ _context21.next = 16;
1049
1049
  return Utils.LimitedMap(3, _toConsumableArray(Array(toBlock - fromBlock + 1).keys()), /*#__PURE__*/function () {
1050
- var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(i) {
1050
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(i) {
1051
1051
  var blockNumber, blockInfo, transactionInfo;
1052
- return _regeneratorRuntime.wrap(function (_context18) {
1053
- while (1) switch (_context18.prev = _context18.next) {
1052
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1053
+ while (1) switch (_context20.prev = _context20.next) {
1054
1054
  case 0:
1055
1055
  blockNumber = toBlock - i;
1056
1056
  blockInfo = blocks[blockNumber];
1057
1057
  if (blockInfo) {
1058
- _context18.next = 2;
1058
+ _context20.next = 8;
1059
1059
  break;
1060
1060
  }
1061
- _context18.next = 1;
1061
+ _context20.next = 5;
1062
1062
  return _this5.MakeProviderCall({
1063
1063
  methodName: "getBlock",
1064
1064
  args: [blockNumber]
1065
1065
  });
1066
- case 1:
1067
- blockInfo = _context18.sent;
1066
+ case 5:
1067
+ blockInfo = _context20.sent;
1068
1068
  blockInfo = blockInfo.transactions.map(function (transactionHash) {
1069
1069
  return _objectSpread(_objectSpread({
1070
1070
  blockNumber: blockInfo.number,
@@ -1074,81 +1074,81 @@ var EthClient = /*#__PURE__*/function () {
1074
1074
  });
1075
1075
  });
1076
1076
  blocks[blockNumber] = blockInfo;
1077
- case 2:
1077
+ case 8:
1078
1078
  if (!includeTransaction) {
1079
- _context18.next = 4;
1079
+ _context20.next = 13;
1080
1080
  break;
1081
1081
  }
1082
1082
  transactionInfo = {};
1083
- _context18.next = 3;
1084
- return Promise.all(blockInfo.map(/*#__PURE__*/function () {
1085
- var _ref24 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(block) {
1086
- var _t8, _t9, _t0, _t1, _t10, _t11;
1087
- return _regeneratorRuntime.wrap(function (_context17) {
1088
- while (1) switch (_context17.prev = _context17.next) {
1083
+ _context20.next = 12;
1084
+ return Promise.all(blockInfo.map( /*#__PURE__*/function () {
1085
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(block) {
1086
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1087
+ while (1) switch (_context19.prev = _context19.next) {
1089
1088
  case 0:
1090
1089
  if (transactionInfo[block.transactionHash]) {
1091
- _context17.next = 3;
1090
+ _context19.next = 12;
1092
1091
  break;
1093
1092
  }
1094
- _t8 = _objectSpread;
1095
- _t9 = _objectSpread;
1096
- _t0 = {};
1097
- _context17.next = 1;
1093
+ _context19.t0 = _objectSpread;
1094
+ _context19.t1 = _objectSpread;
1095
+ _context19.t2 = {};
1096
+ _context19.next = 6;
1098
1097
  return _this5.MakeProviderCall({
1099
1098
  methodName: "getTransaction",
1100
1099
  args: [block.transactionHash]
1101
1100
  });
1102
- case 1:
1103
- _t1 = _context17.sent;
1104
- _t10 = _t9(_t0, _t1);
1105
- _context17.next = 2;
1101
+ case 6:
1102
+ _context19.t3 = _context19.sent;
1103
+ _context19.t4 = (0, _context19.t1)(_context19.t2, _context19.t3);
1104
+ _context19.next = 10;
1106
1105
  return _this5.MakeProviderCall({
1107
1106
  methodName: "getTransactionReceipt",
1108
1107
  args: [block.transactionHash]
1109
1108
  });
1110
- case 2:
1111
- _t11 = _context17.sent;
1112
- transactionInfo[block.transactionHash] = _t8(_t10, _t11);
1113
- case 3:
1114
- return _context17.abrupt("return", _objectSpread(_objectSpread({}, block), transactionInfo[block.transactionHash]));
1115
- case 4:
1109
+ case 10:
1110
+ _context19.t5 = _context19.sent;
1111
+ transactionInfo[block.transactionHash] = (0, _context19.t0)(_context19.t4, _context19.t5);
1112
+ case 12:
1113
+ return _context19.abrupt("return", _objectSpread(_objectSpread({}, block), transactionInfo[block.transactionHash]));
1114
+ case 13:
1116
1115
  case "end":
1117
- return _context17.stop();
1116
+ return _context19.stop();
1118
1117
  }
1119
- }, _callee17);
1118
+ }, _callee19);
1120
1119
  }));
1121
- return function (_x18) {
1122
- return _ref24.apply(this, arguments);
1120
+ return function (_x20) {
1121
+ return _ref26.apply(this, arguments);
1123
1122
  };
1124
1123
  }()));
1125
- case 3:
1126
- blocks[blockNumber] = _context18.sent;
1127
- case 4:
1124
+ case 12:
1125
+ blocks[blockNumber] = _context20.sent;
1126
+ case 13:
1128
1127
  output.push(blocks[blockNumber]);
1129
- case 5:
1128
+ case 14:
1130
1129
  case "end":
1131
- return _context18.stop();
1130
+ return _context20.stop();
1132
1131
  }
1133
- }, _callee18);
1132
+ }, _callee20);
1134
1133
  }));
1135
- return function (_x17) {
1136
- return _ref23.apply(this, arguments);
1134
+ return function (_x19) {
1135
+ return _ref25.apply(this, arguments);
1137
1136
  };
1138
1137
  }());
1139
- case 5:
1140
- return _context19.abrupt("return", output);
1141
- case 6:
1138
+ case 16:
1139
+ return _context21.abrupt("return", output);
1140
+ case 17:
1142
1141
  case "end":
1143
- return _context19.stop();
1142
+ return _context21.stop();
1144
1143
  }
1145
- }, _callee19, this);
1144
+ }, _callee21, this);
1146
1145
  }));
1147
- function Events(_x16) {
1146
+ function Events(_x18) {
1148
1147
  return _Events.apply(this, arguments);
1149
1148
  }
1150
1149
  return Events;
1151
1150
  }()
1152
1151
  }]);
1152
+ return EthClient;
1153
1153
  }();
1154
1154
  module.exports = EthClient;