@eluvio/elv-client-js 3.2.2 → 3.2.6

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 (35) hide show
  1. package/dist/ElvClient-min.js +15 -11
  2. package/dist/ElvClient-node-min.js +17 -13
  3. package/dist/ElvFrameClient-min.js +12 -8
  4. package/dist/ElvPermissionsClient-min.js +13 -9
  5. package/dist/ElvWalletClient-min.js +58 -0
  6. package/dist/ElvWalletClient-node-min.js +78 -0
  7. package/dist/src/AuthorizationClient.js +2248 -1990
  8. package/dist/src/ContentObjectVerification.js +164 -173
  9. package/dist/src/Crypto.js +376 -324
  10. package/dist/src/ElvClient.js +1182 -1019
  11. package/dist/src/ElvWallet.js +119 -95
  12. package/dist/src/EthClient.js +1040 -896
  13. package/dist/src/FrameClient.js +331 -300
  14. package/dist/src/HttpClient.js +153 -147
  15. package/dist/src/Id.js +1 -3
  16. package/dist/src/PermissionsClient.js +1294 -1168
  17. package/dist/src/RemoteSigner.js +263 -211
  18. package/dist/src/UserProfileClient.js +1164 -1023
  19. package/dist/src/Utils.js +209 -181
  20. package/dist/src/client/ABRPublishing.js +895 -858
  21. package/dist/src/client/AccessGroups.js +1102 -959
  22. package/dist/src/client/ContentAccess.js +3724 -3431
  23. package/dist/src/client/ContentManagement.js +2252 -2068
  24. package/dist/src/client/Contracts.js +647 -563
  25. package/dist/src/client/Files.js +1886 -1757
  26. package/dist/src/client/NFT.js +126 -112
  27. package/dist/src/client/NTP.js +478 -422
  28. package/dist/src/walletClient/ClientMethods.js +1029 -879
  29. package/dist/src/walletClient/Utils.js +84 -70
  30. package/dist/src/walletClient/index.js +1203 -1087
  31. package/package.json +4 -2
  32. package/src/Utils.js +0 -1
  33. package/src/walletClient/ClientMethods.js +34 -2
  34. package/src/walletClient/index.js +3 -3
  35. package/utilities/ProductionMasterCreate.js +2 -2
@@ -6,13 +6,21 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
6
6
 
7
7
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
8
8
 
9
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
10
+
9
11
  var _classCallCheck = require("@babel/runtime/helpers/classCallCheck");
10
12
 
11
13
  var _createClass = require("@babel/runtime/helpers/createClass");
12
14
 
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
15
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
16
+
17
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
+
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
+
21
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
22
 
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
24
 
17
25
  // NOTE: Querying Ethereum requires CORS enabled
18
26
  // Use --rpccorsdomain "http[s]://hostname:port" or set up proxy
@@ -36,19 +44,9 @@ var _require = require("./LogMessage"),
36
44
 
37
45
  var Topics = require("./events/Topics");
38
46
 
39
- var EthClient =
40
- /*#__PURE__*/
41
- function () {
47
+ var EthClient = /*#__PURE__*/function () {
42
48
  "use strict";
43
49
 
44
- _createClass(EthClient, [{
45
- key: "Log",
46
- value: function Log(message) {
47
- var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
48
- LogMessage(this, message, error);
49
- }
50
- }]);
51
-
52
50
  function EthClient(_ref) {
53
51
  var client = _ref.client,
54
52
  uris = _ref.uris,
@@ -78,6 +76,12 @@ function () {
78
76
  }
79
77
 
80
78
  _createClass(EthClient, [{
79
+ key: "Log",
80
+ value: function Log(message) {
81
+ var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
82
+ LogMessage(this, message, error);
83
+ }
84
+ }, {
81
85
  key: "SetEthereumURIs",
82
86
  value: function SetEthereumURIs(uris) {
83
87
  this.ethereumURIs = uris;
@@ -95,8 +99,8 @@ function () {
95
99
  // data every time a contract is initialized in the client (often). Ethers.js just checks that the code isn't == "0x", so
96
100
  // we can give it some dummy string instead and assume the contract is fine
97
101
 
98
- this.provider.getCode = function _callee() {
99
- return _regeneratorRuntime.async(function _callee$(_context) {
102
+ this.provider.getCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
103
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
100
104
  while (1) {
101
105
  switch (_context.prev = _context.next) {
102
106
  case 0:
@@ -107,9 +111,8 @@ function () {
107
111
  return _context.stop();
108
112
  }
109
113
  }
110
- });
111
- };
112
-
114
+ }, _callee);
115
+ }));
113
116
  this.provider.pollingInterval = 500;
114
117
  }
115
118
 
@@ -117,89 +120,103 @@ function () {
117
120
  }
118
121
  }, {
119
122
  key: "ContractName",
120
- value: function ContractName(contractAddress) {
121
- var _this = this;
122
-
123
- var full,
124
- versionContract,
125
- version,
126
- _args3 = arguments;
127
- return _regeneratorRuntime.async(function ContractName$(_context3) {
128
- while (1) {
129
- switch (_context3.prev = _context3.next) {
130
- case 0:
131
- full = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
132
- versionContract = new Ethers.Contract(contractAddress, AccessibleContract.abi, this.Provider());
133
-
134
- if (!this.contractNames[contractAddress]) {
135
- this.contractNames[contractAddress] = new Promise(function _callee2(resolve) {
136
- var versionBytes32, _version;
137
-
138
- return _regeneratorRuntime.async(function _callee2$(_context2) {
139
- while (1) {
140
- switch (_context2.prev = _context2.next) {
141
- case 0:
142
- _context2.prev = 0;
143
- _context2.next = 3;
144
- return _regeneratorRuntime.awrap(_this.CallContractMethod({
145
- contract: versionContract,
146
- abi: AccessibleContract.abi,
147
- methodName: "version",
148
- cacheContract: false
149
- }));
150
-
151
- case 3:
152
- versionBytes32 = _context2.sent;
153
- _version = Ethers.utils.parseBytes32String( // Ensure bytes32 string is null terminated
154
- versionBytes32.slice(0, -2) + "00");
155
- resolve(_version);
156
- _context2.next = 11;
157
- break;
158
-
159
- case 8:
160
- _context2.prev = 8;
161
- _context2.t0 = _context2["catch"](0);
162
- resolve("Unknown");
163
-
164
- case 11:
165
- case "end":
166
- return _context2.stop();
167
- }
168
- }
169
- }, null, null, [[0, 8]]);
170
- });
171
- }
123
+ value: function () {
124
+ var _ContractName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(contractAddress) {
125
+ var _this = this;
126
+
127
+ var full,
128
+ versionContract,
129
+ version,
130
+ _args3 = arguments;
131
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
132
+ while (1) {
133
+ switch (_context3.prev = _context3.next) {
134
+ case 0:
135
+ full = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
136
+ versionContract = new Ethers.Contract(contractAddress, AccessibleContract.abi, this.Provider());
137
+
138
+ if (!this.contractNames[contractAddress]) {
139
+ this.contractNames[contractAddress] = new Promise( /*#__PURE__*/function () {
140
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
141
+ var versionBytes32, _version;
142
+
143
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
144
+ while (1) {
145
+ switch (_context2.prev = _context2.next) {
146
+ case 0:
147
+ _context2.prev = 0;
148
+ _context2.next = 3;
149
+ return _this.CallContractMethod({
150
+ contract: versionContract,
151
+ abi: AccessibleContract.abi,
152
+ methodName: "version",
153
+ cacheContract: false
154
+ });
155
+
156
+ case 3:
157
+ versionBytes32 = _context2.sent;
158
+ _version = Ethers.utils.parseBytes32String( // Ensure bytes32 string is null terminated
159
+ versionBytes32.slice(0, -2) + "00");
160
+ resolve(_version);
161
+ _context2.next = 11;
162
+ break;
163
+
164
+ case 8:
165
+ _context2.prev = 8;
166
+ _context2.t0 = _context2["catch"](0);
167
+ resolve("Unknown");
168
+
169
+ case 11:
170
+ case "end":
171
+ return _context2.stop();
172
+ }
173
+ }
174
+ }, _callee2, null, [[0, 8]]);
175
+ }));
172
176
 
173
- _context3.next = 5;
174
- return _regeneratorRuntime.awrap(this.contractNames[contractAddress]);
177
+ return function (_x2) {
178
+ return _ref3.apply(this, arguments);
179
+ };
180
+ }());
181
+ }
175
182
 
176
- case 5:
177
- version = _context3.sent;
183
+ _context3.next = 5;
184
+ return this.contractNames[contractAddress];
178
185
 
179
- if (!full) {
180
- _context3.next = 10;
181
- break;
182
- }
186
+ case 5:
187
+ version = _context3.sent;
183
188
 
184
- return _context3.abrupt("return", version);
189
+ if (!full) {
190
+ _context3.next = 10;
191
+ break;
192
+ }
185
193
 
186
- case 10:
187
- return _context3.abrupt("return", version.split(/\d+/)[0]);
194
+ return _context3.abrupt("return", version);
188
195
 
189
- case 11:
190
- case "end":
191
- return _context3.stop();
196
+ case 10:
197
+ return _context3.abrupt("return", version.split(/\d+/)[0]);
198
+
199
+ case 11:
200
+ case "end":
201
+ return _context3.stop();
202
+ }
192
203
  }
193
- }
194
- }, null, this);
195
- }
204
+ }, _callee3, this);
205
+ }));
206
+
207
+ function ContractName(_x) {
208
+ return _ContractName.apply(this, arguments);
209
+ }
210
+
211
+ return ContractName;
212
+ }()
196
213
  }, {
197
214
  key: "Contract",
198
- value: function Contract(_ref2) {
199
- var contractAddress = _ref2.contractAddress,
200
- abi = _ref2.abi,
201
- cacheContract = _ref2.cacheContract,
202
- overrideCachedContract = _ref2.overrideCachedContract;
215
+ value: function Contract(_ref4) {
216
+ var contractAddress = _ref4.contractAddress,
217
+ abi = _ref4.abi,
218
+ cacheContract = _ref4.cacheContract,
219
+ overrideCachedContract = _ref4.overrideCachedContract;
203
220
  var contract;
204
221
 
205
222
  if (!overrideCachedContract) {
@@ -223,66 +240,74 @@ function () {
223
240
  }
224
241
  }, {
225
242
  key: "MakeProviderCall",
226
- value: function MakeProviderCall(_ref3) {
227
- var methodName, _ref3$args, args, _ref3$attempts, attempts, provider;
228
-
229
- return _regeneratorRuntime.async(function MakeProviderCall$(_context4) {
230
- while (1) {
231
- switch (_context4.prev = _context4.next) {
232
- case 0:
233
- methodName = _ref3.methodName, _ref3$args = _ref3.args, args = _ref3$args === void 0 ? [] : _ref3$args, _ref3$attempts = _ref3.attempts, attempts = _ref3$attempts === void 0 ? 0 : _ref3$attempts;
234
- _context4.prev = 1;
235
- provider = this.Provider();
236
- _context4.next = 5;
237
- return _regeneratorRuntime.awrap(this.provider.getNetwork());
238
-
239
- case 5:
240
- this.Log("ETH ".concat(provider.connection.url, " ").concat(methodName, " [").concat(args.join(", "), "]"));
241
- _context4.next = 8;
242
- return _regeneratorRuntime.awrap(provider[methodName].apply(provider, _toConsumableArray(args)));
243
-
244
- case 8:
245
- return _context4.abrupt("return", _context4.sent);
246
-
247
- case 11:
248
- _context4.prev = 11;
249
- _context4.t0 = _context4["catch"](1);
250
- // eslint-disable-next-line no-console
251
- console.error(_context4.t0);
252
-
253
- if (!(attempts < this.ethereumURIs.length)) {
254
- _context4.next = 19;
255
- break;
256
- }
243
+ value: function () {
244
+ var _MakeProviderCall = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
245
+ var methodName, _ref5$args, args, _ref5$attempts, attempts, provider;
246
+
247
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
248
+ while (1) {
249
+ switch (_context4.prev = _context4.next) {
250
+ case 0:
251
+ 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;
252
+ _context4.prev = 1;
253
+ provider = this.Provider();
254
+ _context4.next = 5;
255
+ return this.provider.getNetwork();
256
+
257
+ case 5:
258
+ this.Log("ETH ".concat(provider.connection.url, " ").concat(methodName, " [").concat(args.join(", "), "]"));
259
+ _context4.next = 8;
260
+ return provider[methodName].apply(provider, _toConsumableArray(args));
261
+
262
+ case 8:
263
+ return _context4.abrupt("return", _context4.sent);
264
+
265
+ case 11:
266
+ _context4.prev = 11;
267
+ _context4.t0 = _context4["catch"](1);
268
+ // eslint-disable-next-line no-console
269
+ console.error(_context4.t0);
270
+
271
+ if (!(attempts < this.ethereumURIs.length)) {
272
+ _context4.next = 19;
273
+ break;
274
+ }
275
+
276
+ this.Log("EthClient failing over: ".concat(attempts + 1, " attempts"), true);
277
+ this.provider = undefined;
278
+ this.ethereumURIIndex = (this.ethereumURIIndex + 1) % this.ethereumURIs.length;
279
+ return _context4.abrupt("return", this.MakeProviderCall({
280
+ methodName: methodName,
281
+ args: args,
282
+ attempts: attempts + 1
283
+ }));
257
284
 
258
- this.Log("EthClient failing over: ".concat(attempts + 1, " attempts"), true);
259
- this.provider = undefined;
260
- this.ethereumURIIndex = (this.ethereumURIIndex + 1) % this.ethereumURIs.length;
261
- return _context4.abrupt("return", this.MakeProviderCall({
262
- methodName: methodName,
263
- args: args,
264
- attempts: attempts + 1
265
- }));
266
-
267
- case 19:
268
- return _context4.abrupt("return", {});
269
-
270
- case 20:
271
- case "end":
272
- return _context4.stop();
285
+ case 19:
286
+ return _context4.abrupt("return", {});
287
+
288
+ case 20:
289
+ case "end":
290
+ return _context4.stop();
291
+ }
273
292
  }
274
- }
275
- }, null, this, [[1, 11]]);
276
- }
293
+ }, _callee4, this, [[1, 11]]);
294
+ }));
295
+
296
+ function MakeProviderCall(_x3) {
297
+ return _MakeProviderCall.apply(this, arguments);
298
+ }
299
+
300
+ return MakeProviderCall;
301
+ }()
277
302
  /* General contract management */
278
303
 
279
304
  }, {
280
305
  key: "FormatContractArgument",
281
- value: function FormatContractArgument(_ref4) {
306
+ value: function FormatContractArgument(_ref6) {
282
307
  var _this2 = this;
283
308
 
284
- var type = _ref4.type,
285
- value = _ref4.value;
309
+ var type = _ref6.type,
310
+ value = _ref6.value;
286
311
 
287
312
  // For array types, parse into array if necessary, then format each value.
288
313
  if (type.endsWith("[]")) {
@@ -322,12 +347,12 @@ function () {
322
347
 
323
348
  }, {
324
349
  key: "FormatContractArguments",
325
- value: function FormatContractArguments(_ref5) {
350
+ value: function FormatContractArguments(_ref7) {
326
351
  var _this3 = this;
327
352
 
328
- var abi = _ref5.abi,
329
- methodName = _ref5.methodName,
330
- args = _ref5.args;
353
+ var abi = _ref7.abi,
354
+ methodName = _ref7.methodName,
355
+ args = _ref7.args;
331
356
  var method = abi.find(function (func) {
332
357
  // Constructor has type=constructor but no name
333
358
  return func.name === methodName || func.type === methodName;
@@ -355,360 +380,391 @@ function () {
355
380
  }
356
381
  }, {
357
382
  key: "DeployContract",
358
- value: function DeployContract(_ref6) {
359
- var abi, bytecode, _ref6$constructorArgs, constructorArgs, _ref6$overrides, overrides, provider, signer, contractFactory, contract;
360
-
361
- return _regeneratorRuntime.async(function DeployContract$(_context5) {
362
- while (1) {
363
- switch (_context5.prev = _context5.next) {
364
- case 0:
365
- abi = _ref6.abi, bytecode = _ref6.bytecode, _ref6$constructorArgs = _ref6.constructorArgs, constructorArgs = _ref6$constructorArgs === void 0 ? [] : _ref6$constructorArgs, _ref6$overrides = _ref6.overrides, overrides = _ref6$overrides === void 0 ? {} : _ref6$overrides;
366
- this.Log("Deploying contract with args [".concat(constructorArgs.join(", "), "]"));
367
- provider = this.Provider();
368
- provider.getNetwork();
369
- signer = this.client.signer.connect(provider);
370
- this.ValidateSigner(signer);
371
- contractFactory = new Ethers.ContractFactory(abi, bytecode, signer);
372
- _context5.next = 9;
373
- return _regeneratorRuntime.awrap(contractFactory.deploy.apply(contractFactory, _toConsumableArray(constructorArgs).concat([overrides])));
374
-
375
- case 9:
376
- contract = _context5.sent;
377
- _context5.next = 12;
378
- return _regeneratorRuntime.awrap(contract.deployed());
379
-
380
- case 12:
381
- this.Log("Deployed: ".concat(contract.address));
382
- return _context5.abrupt("return", {
383
- contractAddress: Utils.FormatAddress(contract.address),
384
- transactionHash: contract.deployTransaction.hash
385
- });
386
-
387
- case 14:
388
- case "end":
389
- return _context5.stop();
383
+ value: function () {
384
+ var _DeployContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
385
+ var abi, bytecode, _ref8$constructorArgs, constructorArgs, _ref8$overrides, overrides, provider, signer, contractFactory, contract;
386
+
387
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
388
+ while (1) {
389
+ switch (_context5.prev = _context5.next) {
390
+ case 0:
391
+ 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;
392
+ this.Log("Deploying contract with args [".concat(constructorArgs.join(", "), "]"));
393
+ provider = this.Provider();
394
+ provider.getNetwork();
395
+ signer = this.client.signer.connect(provider);
396
+ this.ValidateSigner(signer);
397
+ contractFactory = new Ethers.ContractFactory(abi, bytecode, signer);
398
+ _context5.next = 9;
399
+ return contractFactory.deploy.apply(contractFactory, _toConsumableArray(constructorArgs).concat([overrides]));
400
+
401
+ case 9:
402
+ contract = _context5.sent;
403
+ _context5.next = 12;
404
+ return contract.deployed();
405
+
406
+ case 12:
407
+ this.Log("Deployed: ".concat(contract.address));
408
+ return _context5.abrupt("return", {
409
+ contractAddress: Utils.FormatAddress(contract.address),
410
+ transactionHash: contract.deployTransaction.hash
411
+ });
412
+
413
+ case 14:
414
+ case "end":
415
+ return _context5.stop();
416
+ }
390
417
  }
391
- }
392
- }, null, this);
393
- } // Accepts either contract object or contract address
418
+ }, _callee5, this);
419
+ }));
420
+
421
+ function DeployContract(_x4) {
422
+ return _DeployContract.apply(this, arguments);
423
+ }
424
+
425
+ return DeployContract;
426
+ }() // Accepts either contract object or contract address
394
427
 
395
428
  }, {
396
429
  key: "CallContractMethod",
397
- value: function CallContractMethod(_ref7) {
398
- var contract, contractAddress, abi, methodName, _ref7$methodArgs, methodArgs, value, _ref7$overrides, overrides, _ref7$formatArguments, formatArguments, _ref7$cacheContract, cacheContract, _ref7$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract$functions, latestBlock;
399
-
400
- return _regeneratorRuntime.async(function CallContractMethod$(_context6) {
401
- while (1) {
402
- switch (_context6.prev = _context6.next) {
403
- case 0:
404
- contract = _ref7.contract, contractAddress = _ref7.contractAddress, abi = _ref7.abi, methodName = _ref7.methodName, _ref7$methodArgs = _ref7.methodArgs, methodArgs = _ref7$methodArgs === void 0 ? [] : _ref7$methodArgs, value = _ref7.value, _ref7$overrides = _ref7.overrides, overrides = _ref7$overrides === void 0 ? {} : _ref7$overrides, _ref7$formatArguments = _ref7.formatArguments, formatArguments = _ref7$formatArguments === void 0 ? true : _ref7$formatArguments, _ref7$cacheContract = _ref7.cacheContract, cacheContract = _ref7$cacheContract === void 0 ? true : _ref7$cacheContract, _ref7$overrideCachedC = _ref7.overrideCachedContract, overrideCachedContract = _ref7$overrideCachedC === void 0 ? false : _ref7$overrideCachedC;
430
+ value: function () {
431
+ var _CallContractMethod = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref9) {
432
+ var contract, contractAddress, abi, methodName, _ref9$methodArgs, methodArgs, value, _ref9$overrides, overrides, _ref9$formatArguments, formatArguments, _ref9$cacheContract, cacheContract, _ref9$overrideCachedC, overrideCachedContract, methodAbi, result, success, _contract$functions, latestBlock;
433
+
434
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
435
+ while (1) {
436
+ switch (_context6.prev = _context6.next) {
437
+ case 0:
438
+ 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;
439
+
440
+ if (abi) {
441
+ _context6.next = 5;
442
+ break;
443
+ }
444
+
445
+ _context6.next = 4;
446
+ return this.client.ContractAbi({
447
+ contractAddress: contractAddress
448
+ });
405
449
 
406
- if (abi) {
407
- _context6.next = 5;
408
- break;
409
- }
450
+ case 4:
451
+ abi = _context6.sent;
410
452
 
411
- _context6.next = 4;
412
- return _regeneratorRuntime.awrap(this.client.ContractAbi({
413
- contractAddress: contractAddress
414
- }));
415
-
416
- case 4:
417
- abi = _context6.sent;
418
-
419
- case 5:
420
- contract = contract || this.Contract({
421
- contractAddress: contractAddress,
422
- abi: abi,
423
- cacheContract: cacheContract,
424
- overrideCachedContract: overrideCachedContract
425
- });
426
- abi = contract["interface"].abi; // Automatically format contract arguments
427
-
428
- if (formatArguments) {
429
- methodArgs = this.FormatContractArguments({
453
+ case 5:
454
+ contract = contract || this.Contract({
455
+ contractAddress: contractAddress,
430
456
  abi: abi,
431
- methodName: methodName,
432
- args: methodArgs
457
+ cacheContract: cacheContract,
458
+ overrideCachedContract: overrideCachedContract
459
+ });
460
+ abi = contract["interface"].abi; // Automatically format contract arguments
461
+
462
+ if (formatArguments) {
463
+ methodArgs = this.FormatContractArguments({
464
+ abi: abi,
465
+ methodName: methodName,
466
+ args: methodArgs
467
+ });
468
+ }
469
+
470
+ if (value) {
471
+ // Convert Ether to Wei
472
+ overrides.value = "0x" + Utils.EtherToWei(value.toString()).toString(16);
473
+ }
474
+
475
+ if (!(contract.functions[methodName] === undefined)) {
476
+ _context6.next = 11;
477
+ break;
478
+ }
479
+
480
+ throw Error("Unknown method: " + methodName);
481
+
482
+ case 11:
483
+ this.Log("Calling contract method:\n Provider: ".concat(this.Provider().connection.url, "\n Address: ").concat(contract.address, "\n Method: ").concat(methodName, "\n Args: [").concat(methodArgs.join(", "), "]"));
484
+ methodAbi = contract["interface"].abi.find(function (method) {
485
+ return method.name === methodName;
486
+ }); // Lock if performing a transaction
487
+
488
+ if (!(!methodAbi || !methodAbi.constant)) {
489
+ _context6.next = 20;
490
+ break;
491
+ }
492
+
493
+ case 14:
494
+ if (!this.locked) {
495
+ _context6.next = 19;
496
+ break;
497
+ }
498
+
499
+ _context6.next = 17;
500
+ return new Promise(function (resolve) {
501
+ return setTimeout(resolve, 100);
433
502
  });
434
- }
435
-
436
- if (value) {
437
- // Convert Ether to Wei
438
- overrides.value = "0x" + Utils.EtherToWei(value.toString()).toString(16);
439
- }
440
503
 
441
- if (!(contract.functions[methodName] === undefined)) {
442
- _context6.next = 11;
504
+ case 17:
505
+ _context6.next = 14;
443
506
  break;
444
- }
445
507
 
446
- throw Error("Unknown method: " + methodName);
508
+ case 19:
509
+ this.locked = true;
447
510
 
448
- case 11:
449
- 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(", "), "]"));
450
- methodAbi = contract["interface"].abi.find(function (method) {
451
- return method.name === methodName;
452
- }); // Lock if performing a transaction
511
+ case 20:
512
+ _context6.prev = 20;
513
+ success = false;
453
514
 
454
- if (!(!methodAbi || !methodAbi.constant)) {
455
- _context6.next = 20;
456
- break;
457
- }
515
+ case 22:
516
+ if (success) {
517
+ _context6.next = 49;
518
+ break;
519
+ }
458
520
 
459
- case 14:
460
- if (!this.locked) {
461
- _context6.next = 19;
462
- break;
463
- }
521
+ _context6.prev = 23;
522
+ _context6.next = 26;
523
+ return (_contract$functions = contract.functions)[methodName].apply(_contract$functions, _toConsumableArray(methodArgs).concat([overrides]));
464
524
 
465
- _context6.next = 17;
466
- return _regeneratorRuntime.awrap(new Promise(function (resolve) {
467
- return setTimeout(resolve, 100);
468
- }));
525
+ case 26:
526
+ result = _context6.sent;
527
+ success = true;
528
+ _context6.next = 47;
529
+ break;
469
530
 
470
- case 17:
471
- _context6.next = 14;
472
- break;
531
+ case 30:
532
+ _context6.prev = 30;
533
+ _context6.t0 = _context6["catch"](23);
473
534
 
474
- case 19:
475
- this.locked = true;
535
+ if (!(_context6.t0.code === -32000 || _context6.t0.code === "REPLACEMENT_UNDERPRICED")) {
536
+ _context6.next = 40;
537
+ break;
538
+ }
476
539
 
477
- case 20:
478
- _context6.prev = 20;
479
- success = false;
540
+ _context6.next = 35;
541
+ return this.MakeProviderCall({
542
+ methodName: "getBlock",
543
+ args: ["latest"]
544
+ });
480
545
 
481
- case 22:
482
- if (success) {
483
- _context6.next = 49;
546
+ case 35:
547
+ latestBlock = _context6.sent;
548
+ overrides.gasLimit = latestBlock.gasLimit;
549
+ overrides.gasPrice = overrides.gasPrice ? overrides.gasPrice * 1.50 : 8000000000;
550
+ _context6.next = 47;
484
551
  break;
485
- }
486
-
487
- _context6.prev = 23;
488
- _context6.next = 26;
489
- return _regeneratorRuntime.awrap((_contract$functions = contract.functions)[methodName].apply(_contract$functions, _toConsumableArray(methodArgs).concat([overrides])));
490
-
491
- case 26:
492
- result = _context6.sent;
493
- success = true;
494
- _context6.next = 47;
495
- break;
496
552
 
497
- case 30:
498
- _context6.prev = 30;
499
- _context6.t0 = _context6["catch"](23);
553
+ case 40:
554
+ if (!(_context6.t0.code === "NONCE_EXPIRED" && _context6.t0.reason === "nonce has already been used")) {
555
+ _context6.next = 44;
556
+ break;
557
+ }
500
558
 
501
- if (!(_context6.t0.code === -32000 || _context6.t0.code === "REPLACEMENT_UNDERPRICED")) {
502
- _context6.next = 40;
559
+ this.Log("Retrying method call ".concat(methodName));
560
+ _context6.next = 47;
503
561
  break;
504
- }
505
562
 
506
- _context6.next = 35;
507
- return _regeneratorRuntime.awrap(this.MakeProviderCall({
508
- methodName: "getBlock",
509
- args: ["latest"]
510
- }));
511
-
512
- case 35:
513
- latestBlock = _context6.sent;
514
- overrides.gasLimit = latestBlock.gasLimit;
515
- overrides.gasPrice = overrides.gasPrice ? overrides.gasPrice * 1.50 : 8000000000;
516
- _context6.next = 47;
517
- break;
518
-
519
- case 40:
520
- if (!(_context6.t0.code === "NONCE_EXPIRED" && _context6.t0.reason === "nonce has already been used")) {
521
- _context6.next = 44;
522
- break;
523
- }
563
+ case 44:
564
+ if ((_context6.t0.message || _context6.t0).includes("invalid response")) {
565
+ _context6.next = 47;
566
+ break;
567
+ }
524
568
 
525
- this.Log("Retrying method call ".concat(methodName));
526
- _context6.next = 47;
527
- break;
569
+ this.Log(_typeof(_context6.t0) === "object" ? JSON.stringify(_context6.t0, null, 2) : _context6.t0, true);
570
+ throw _context6.t0;
528
571
 
529
- case 44:
530
- if ((_context6.t0.message || _context6.t0).includes("invalid response")) {
531
- _context6.next = 47;
572
+ case 47:
573
+ _context6.next = 22;
532
574
  break;
533
- }
534
575
 
535
- this.Log(_typeof(_context6.t0) === "object" ? JSON.stringify(_context6.t0, null, 2) : _context6.t0, true);
536
- throw _context6.t0;
576
+ case 49:
577
+ return _context6.abrupt("return", result);
537
578
 
538
- case 47:
539
- _context6.next = 22;
540
- break;
579
+ case 50:
580
+ _context6.prev = 50;
541
581
 
542
- case 49:
543
- return _context6.abrupt("return", result);
582
+ // Unlock if performing a transaction
583
+ if (!methodAbi || !methodAbi.constant) {
584
+ this.locked = false;
585
+ }
544
586
 
545
- case 50:
546
- _context6.prev = 50;
587
+ return _context6.finish(50);
547
588
 
548
- // Unlock if performing a transaction
549
- if (!methodAbi || !methodAbi.constant) {
550
- this.locked = false;
551
- }
589
+ case 53:
590
+ case "end":
591
+ return _context6.stop();
592
+ }
593
+ }
594
+ }, _callee6, this, [[20,, 50, 53], [23, 30]]);
595
+ }));
552
596
 
553
- return _context6.finish(50);
597
+ function CallContractMethod(_x5) {
598
+ return _CallContractMethod.apply(this, arguments);
599
+ }
554
600
 
555
- case 53:
556
- case "end":
557
- return _context6.stop();
558
- }
559
- }
560
- }, null, this, [[20,, 50, 53], [23, 30]]);
561
- }
601
+ return CallContractMethod;
602
+ }()
562
603
  }, {
563
604
  key: "CallContractMethodAndWait",
564
- value: function CallContractMethodAndWait(_ref8) {
565
- var contractAddress, abi, methodName, methodArgs, value, timeout, _ref8$formatArguments, formatArguments, _ref8$cacheContract, cacheContract, _ref8$overrideCachedC, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
566
-
567
- return _regeneratorRuntime.async(function CallContractMethodAndWait$(_context7) {
568
- while (1) {
569
- switch (_context7.prev = _context7.next) {
570
- case 0:
571
- contractAddress = _ref8.contractAddress, abi = _ref8.abi, methodName = _ref8.methodName, methodArgs = _ref8.methodArgs, value = _ref8.value, timeout = _ref8.timeout, _ref8$formatArguments = _ref8.formatArguments, formatArguments = _ref8$formatArguments === void 0 ? true : _ref8$formatArguments, _ref8$cacheContract = _ref8.cacheContract, cacheContract = _ref8$cacheContract === void 0 ? true : _ref8$cacheContract, _ref8$overrideCachedC = _ref8.overrideCachedContract, overrideCachedContract = _ref8$overrideCachedC === void 0 ? false : _ref8$overrideCachedC;
572
- timeout = timeout || this.timeout || 10000;
573
-
574
- if (abi) {
575
- _context7.next = 6;
576
- break;
577
- }
605
+ value: function () {
606
+ var _CallContractMethodAndWait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
607
+ var contractAddress, abi, methodName, methodArgs, value, timeout, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract, contract, createMethodCall, interval, elapsed, methodEvent;
608
+
609
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
610
+ while (1) {
611
+ switch (_context7.prev = _context7.next) {
612
+ case 0:
613
+ 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;
614
+ timeout = timeout || this.timeout || 10000;
615
+
616
+ if (abi) {
617
+ _context7.next = 6;
618
+ break;
619
+ }
620
+
621
+ _context7.next = 5;
622
+ return this.client.ContractAbi({
623
+ contractAddress: contractAddress
624
+ });
578
625
 
579
- _context7.next = 5;
580
- return _regeneratorRuntime.awrap(this.client.ContractAbi({
581
- contractAddress: contractAddress
582
- }));
583
-
584
- case 5:
585
- abi = _context7.sent;
586
-
587
- case 6:
588
- contract = this.Contract({
589
- contractAddress: contractAddress,
590
- abi: abi,
591
- cacheContract: cacheContract,
592
- overrideCachedContract: overrideCachedContract
593
- }); // Make method call
594
-
595
- _context7.next = 9;
596
- return _regeneratorRuntime.awrap(this.CallContractMethod({
597
- contract: contract,
598
- abi: abi,
599
- methodName: methodName,
600
- methodArgs: methodArgs,
601
- value: value,
602
- formatArguments: formatArguments,
603
- cacheContract: cacheContract
604
- }));
605
-
606
- case 9:
607
- createMethodCall = _context7.sent;
608
- this.Log("Awaiting transaction completion: ".concat(createMethodCall.hash)); // Poll for transaction completion
609
-
610
- interval = this.Provider().pollingInterval;
611
- elapsed = 0;
612
-
613
- case 13:
614
- if (!(elapsed < timeout)) {
615
- _context7.next = 25;
616
- break;
617
- }
626
+ case 5:
627
+ abi = _context7.sent;
628
+
629
+ case 6:
630
+ contract = this.Contract({
631
+ contractAddress: contractAddress,
632
+ abi: abi,
633
+ cacheContract: cacheContract,
634
+ overrideCachedContract: overrideCachedContract
635
+ }); // Make method call
636
+
637
+ _context7.next = 9;
638
+ return this.CallContractMethod({
639
+ contract: contract,
640
+ abi: abi,
641
+ methodName: methodName,
642
+ methodArgs: methodArgs,
643
+ value: value,
644
+ formatArguments: formatArguments,
645
+ cacheContract: cacheContract
646
+ });
618
647
 
619
- _context7.next = 16;
620
- return _regeneratorRuntime.awrap(this.MakeProviderCall({
621
- methodName: "getTransactionReceipt",
622
- args: [createMethodCall.hash]
623
- }));
648
+ case 9:
649
+ createMethodCall = _context7.sent;
650
+ this.Log("Awaiting transaction completion: ".concat(createMethodCall.hash)); // Poll for transaction completion
624
651
 
625
- case 16:
626
- methodEvent = _context7.sent;
652
+ interval = this.Provider().pollingInterval;
653
+ elapsed = 0;
627
654
 
628
- if (!methodEvent) {
629
- _context7.next = 20;
630
- break;
631
- }
655
+ case 13:
656
+ if (!(elapsed < timeout)) {
657
+ _context7.next = 25;
658
+ break;
659
+ }
660
+
661
+ _context7.next = 16;
662
+ return this.MakeProviderCall({
663
+ methodName: "getTransactionReceipt",
664
+ args: [createMethodCall.hash]
665
+ });
632
666
 
633
- methodEvent.logs = methodEvent.logs.map(function (log) {
634
- return _objectSpread({}, log, {}, contract["interface"].parseLog(log));
635
- });
636
- return _context7.abrupt("break", 25);
637
-
638
- case 20:
639
- elapsed += interval;
640
- _context7.next = 23;
641
- return _regeneratorRuntime.awrap(new Promise(function (resolve) {
642
- return setTimeout(resolve, interval);
643
- }));
644
-
645
- case 23:
646
- _context7.next = 13;
647
- break;
648
-
649
- case 25:
650
- if (methodEvent) {
651
- _context7.next = 27;
667
+ case 16:
668
+ methodEvent = _context7.sent;
669
+
670
+ if (!methodEvent) {
671
+ _context7.next = 20;
672
+ break;
673
+ }
674
+
675
+ methodEvent.logs = methodEvent.logs.map(function (log) {
676
+ return _objectSpread(_objectSpread({}, log), contract["interface"].parseLog(log));
677
+ });
678
+ return _context7.abrupt("break", 25);
679
+
680
+ case 20:
681
+ elapsed += interval;
682
+ _context7.next = 23;
683
+ return new Promise(function (resolve) {
684
+ return setTimeout(resolve, interval);
685
+ });
686
+
687
+ case 23:
688
+ _context7.next = 13;
652
689
  break;
653
- }
654
690
 
655
- throw Error("Timed out waiting for completion of ".concat(methodName, ". TXID: ").concat(createMethodCall.hash));
691
+ case 25:
692
+ if (methodEvent) {
693
+ _context7.next = 27;
694
+ break;
695
+ }
656
696
 
657
- case 27:
658
- return _context7.abrupt("return", methodEvent);
697
+ throw Error("Timed out waiting for completion of ".concat(methodName, ". TXID: ").concat(createMethodCall.hash));
659
698
 
660
- case 28:
661
- case "end":
662
- return _context7.stop();
699
+ case 27:
700
+ return _context7.abrupt("return", methodEvent);
701
+
702
+ case 28:
703
+ case "end":
704
+ return _context7.stop();
705
+ }
663
706
  }
664
- }
665
- }, null, this);
666
- }
707
+ }, _callee7, this);
708
+ }));
709
+
710
+ function CallContractMethodAndWait(_x6) {
711
+ return _CallContractMethodAndWait.apply(this, arguments);
712
+ }
713
+
714
+ return CallContractMethodAndWait;
715
+ }()
667
716
  }, {
668
717
  key: "AwaitEvent",
669
- value: function AwaitEvent(_ref9) {
670
- var contractAddress, abi, eventName, contract;
671
- return _regeneratorRuntime.async(function AwaitEvent$(_context8) {
672
- while (1) {
673
- switch (_context8.prev = _context8.next) {
674
- case 0:
675
- contractAddress = _ref9.contractAddress, abi = _ref9.abi, eventName = _ref9.eventName;
676
- contract = this.Contract({
677
- contractAddress: contractAddress,
678
- abi: abi
679
- });
680
- _context8.next = 4;
681
- return _regeneratorRuntime.awrap(new Promise(function (resolve) {
682
- contract.on(eventName, function (_, __, event) {
683
- contract.removeAllListeners(eventName);
684
- resolve(event);
718
+ value: function () {
719
+ var _AwaitEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref11) {
720
+ var contractAddress, abi, eventName, contract;
721
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
722
+ while (1) {
723
+ switch (_context8.prev = _context8.next) {
724
+ case 0:
725
+ contractAddress = _ref11.contractAddress, abi = _ref11.abi, eventName = _ref11.eventName;
726
+ contract = this.Contract({
727
+ contractAddress: contractAddress,
728
+ abi: abi
729
+ });
730
+ _context8.next = 4;
731
+ return new Promise(function (resolve) {
732
+ contract.on(eventName, function (_, __, event) {
733
+ contract.removeAllListeners(eventName);
734
+ resolve(event);
735
+ });
685
736
  });
686
- }));
687
737
 
688
- case 4:
689
- return _context8.abrupt("return", _context8.sent);
738
+ case 4:
739
+ return _context8.abrupt("return", _context8.sent);
690
740
 
691
- case 5:
692
- case "end":
693
- return _context8.stop();
741
+ case 5:
742
+ case "end":
743
+ return _context8.stop();
744
+ }
694
745
  }
695
- }
696
- }, null, this);
697
- }
746
+ }, _callee8, this);
747
+ }));
748
+
749
+ function AwaitEvent(_x7) {
750
+ return _AwaitEvent.apply(this, arguments);
751
+ }
752
+
753
+ return AwaitEvent;
754
+ }()
698
755
  }, {
699
756
  key: "ExtractEventFromLogs",
700
- value: function ExtractEventFromLogs(_ref10) {
701
- var abi = _ref10.abi,
702
- event = _ref10.event,
703
- eventName = _ref10.eventName;
757
+ value: function ExtractEventFromLogs(_ref12) {
758
+ var abi = _ref12.abi,
759
+ event = _ref12.event,
760
+ eventName = _ref12.eventName;
704
761
  var contractInterface = new Ethers.utils.Interface(abi); // Loop through logs to find the desired log
705
762
 
706
- var _iteratorNormalCompletion = true;
707
- var _didIteratorError = false;
708
- var _iteratorError = undefined;
763
+ var _iterator = _createForOfIteratorHelper(event.logs),
764
+ _step;
709
765
 
710
766
  try {
711
- for (var _iterator = event.logs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
767
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
712
768
  var log = _step.value;
713
769
  var parsedLog = contractInterface.parseLog(log);
714
770
 
@@ -717,361 +773,428 @@ function () {
717
773
  }
718
774
  }
719
775
  } catch (err) {
720
- _didIteratorError = true;
721
- _iteratorError = err;
776
+ _iterator.e(err);
722
777
  } finally {
723
- try {
724
- if (!_iteratorNormalCompletion && _iterator["return"] != null) {
725
- _iterator["return"]();
726
- }
727
- } finally {
728
- if (_didIteratorError) {
729
- throw _iteratorError;
730
- }
731
- }
778
+ _iterator.f();
732
779
  }
733
780
  }
734
781
  }, {
735
782
  key: "DeployDependentContract",
736
- value: function DeployDependentContract(_ref11) {
737
- var contractAddress, methodName, _ref11$args, args, eventName, eventValue, abi, event, eventLog, newContractAddress;
738
-
739
- return _regeneratorRuntime.async(function DeployDependentContract$(_context9) {
740
- while (1) {
741
- switch (_context9.prev = _context9.next) {
742
- case 0:
743
- contractAddress = _ref11.contractAddress, methodName = _ref11.methodName, _ref11$args = _ref11.args, args = _ref11$args === void 0 ? [] : _ref11$args, eventName = _ref11.eventName, eventValue = _ref11.eventValue;
744
- _context9.next = 3;
745
- return _regeneratorRuntime.awrap(this.client.ContractAbi({
746
- contractAddress: contractAddress
747
- }));
748
-
749
- case 3:
750
- abi = _context9.sent;
751
- _context9.next = 6;
752
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
753
- contractAddress: contractAddress,
754
- abi: abi,
755
- methodName: methodName,
756
- methodArgs: args
757
- }));
758
-
759
- case 6:
760
- event = _context9.sent;
761
- eventLog = this.ExtractEventFromLogs({
762
- abi: abi,
763
- event: event,
764
- eventName: eventName,
765
- eventValue: eventValue
766
- });
767
-
768
- if (eventLog) {
769
- _context9.next = 10;
770
- break;
771
- }
783
+ value: function () {
784
+ var _DeployDependentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref13) {
785
+ var contractAddress, methodName, _ref13$args, args, eventName, eventValue, abi, event, eventLog, newContractAddress;
786
+
787
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
788
+ while (1) {
789
+ switch (_context9.prev = _context9.next) {
790
+ case 0:
791
+ contractAddress = _ref13.contractAddress, methodName = _ref13.methodName, _ref13$args = _ref13.args, args = _ref13$args === void 0 ? [] : _ref13$args, eventName = _ref13.eventName, eventValue = _ref13.eventValue;
792
+ _context9.next = 3;
793
+ return this.client.ContractAbi({
794
+ contractAddress: contractAddress
795
+ });
796
+
797
+ case 3:
798
+ abi = _context9.sent;
799
+ _context9.next = 6;
800
+ return this.CallContractMethodAndWait({
801
+ contractAddress: contractAddress,
802
+ abi: abi,
803
+ methodName: methodName,
804
+ methodArgs: args
805
+ });
806
+
807
+ case 6:
808
+ event = _context9.sent;
809
+ eventLog = this.ExtractEventFromLogs({
810
+ abi: abi,
811
+ event: event,
812
+ eventName: eventName,
813
+ eventValue: eventValue
814
+ });
815
+
816
+ if (eventLog) {
817
+ _context9.next = 10;
818
+ break;
819
+ }
772
820
 
773
- throw Error("".concat(methodName, " failed - Log not present in transaction"));
821
+ throw Error("".concat(methodName, " failed - Log not present in transaction"));
774
822
 
775
- case 10:
776
- newContractAddress = eventLog.values[eventValue];
777
- return _context9.abrupt("return", {
778
- contractAddress: Utils.FormatAddress(newContractAddress),
779
- transactionHash: event.transactionHash
780
- });
823
+ case 10:
824
+ newContractAddress = eventLog.values[eventValue];
825
+ return _context9.abrupt("return", {
826
+ contractAddress: Utils.FormatAddress(newContractAddress),
827
+ transactionHash: event.transactionHash
828
+ });
781
829
 
782
- case 12:
783
- case "end":
784
- return _context9.stop();
830
+ case 12:
831
+ case "end":
832
+ return _context9.stop();
833
+ }
785
834
  }
786
- }
787
- }, null, this);
788
- }
835
+ }, _callee9, this);
836
+ }));
837
+
838
+ function DeployDependentContract(_x8) {
839
+ return _DeployDependentContract.apply(this, arguments);
840
+ }
841
+
842
+ return DeployDependentContract;
843
+ }()
789
844
  /* Specific contract management */
790
845
 
791
846
  }, {
792
847
  key: "DeployAccessGroupContract",
793
- value: function DeployAccessGroupContract(_ref12) {
794
- var contentSpaceAddress;
795
- return _regeneratorRuntime.async(function DeployAccessGroupContract$(_context10) {
796
- while (1) {
797
- switch (_context10.prev = _context10.next) {
798
- case 0:
799
- contentSpaceAddress = _ref12.contentSpaceAddress;
800
- return _context10.abrupt("return", this.DeployDependentContract({
801
- contractAddress: contentSpaceAddress,
802
- methodName: "createGroup",
803
- args: [],
804
- eventName: "CreateGroup",
805
- eventValue: "groupAddress"
806
- }));
807
-
808
- case 2:
809
- case "end":
810
- return _context10.stop();
848
+ value: function () {
849
+ var _DeployAccessGroupContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref14) {
850
+ var contentSpaceAddress;
851
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
852
+ while (1) {
853
+ switch (_context10.prev = _context10.next) {
854
+ case 0:
855
+ contentSpaceAddress = _ref14.contentSpaceAddress;
856
+ return _context10.abrupt("return", this.DeployDependentContract({
857
+ contractAddress: contentSpaceAddress,
858
+ methodName: "createGroup",
859
+ args: [],
860
+ eventName: "CreateGroup",
861
+ eventValue: "groupAddress"
862
+ }));
863
+
864
+ case 2:
865
+ case "end":
866
+ return _context10.stop();
867
+ }
811
868
  }
812
- }
813
- }, null, this);
814
- }
869
+ }, _callee10, this);
870
+ }));
871
+
872
+ function DeployAccessGroupContract(_x9) {
873
+ return _DeployAccessGroupContract.apply(this, arguments);
874
+ }
875
+
876
+ return DeployAccessGroupContract;
877
+ }()
815
878
  }, {
816
879
  key: "DeployTypeContract",
817
- value: function DeployTypeContract(_ref13) {
818
- var contentSpaceAddress;
819
- return _regeneratorRuntime.async(function DeployTypeContract$(_context11) {
820
- while (1) {
821
- switch (_context11.prev = _context11.next) {
822
- case 0:
823
- contentSpaceAddress = _ref13.contentSpaceAddress;
824
- return _context11.abrupt("return", this.DeployDependentContract({
825
- contractAddress: contentSpaceAddress,
826
- methodName: "createContentType",
827
- args: [],
828
- eventName: "CreateContentType",
829
- eventValue: "contentTypeAddress"
830
- }));
831
-
832
- case 2:
833
- case "end":
834
- return _context11.stop();
880
+ value: function () {
881
+ var _DeployTypeContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref15) {
882
+ var contentSpaceAddress;
883
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
884
+ while (1) {
885
+ switch (_context11.prev = _context11.next) {
886
+ case 0:
887
+ contentSpaceAddress = _ref15.contentSpaceAddress;
888
+ return _context11.abrupt("return", this.DeployDependentContract({
889
+ contractAddress: contentSpaceAddress,
890
+ methodName: "createContentType",
891
+ args: [],
892
+ eventName: "CreateContentType",
893
+ eventValue: "contentTypeAddress"
894
+ }));
895
+
896
+ case 2:
897
+ case "end":
898
+ return _context11.stop();
899
+ }
835
900
  }
836
- }
837
- }, null, this);
838
- }
901
+ }, _callee11, this);
902
+ }));
903
+
904
+ function DeployTypeContract(_x10) {
905
+ return _DeployTypeContract.apply(this, arguments);
906
+ }
907
+
908
+ return DeployTypeContract;
909
+ }()
839
910
  }, {
840
911
  key: "DeployLibraryContract",
841
- value: function DeployLibraryContract(_ref14) {
842
- var contentSpaceAddress, kmsId, kmsAddress;
843
- return _regeneratorRuntime.async(function DeployLibraryContract$(_context12) {
844
- while (1) {
845
- switch (_context12.prev = _context12.next) {
846
- case 0:
847
- contentSpaceAddress = _ref14.contentSpaceAddress, kmsId = _ref14.kmsId;
848
- kmsAddress = Utils.HashToAddress(kmsId);
849
- return _context12.abrupt("return", this.DeployDependentContract({
850
- contractAddress: contentSpaceAddress,
851
- methodName: "createLibrary",
852
- args: [kmsAddress],
853
- eventName: "CreateLibrary",
854
- eventValue: "libraryAddress"
855
- }));
856
-
857
- case 3:
858
- case "end":
859
- return _context12.stop();
912
+ value: function () {
913
+ var _DeployLibraryContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref16) {
914
+ var contentSpaceAddress, kmsId, kmsAddress;
915
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
916
+ while (1) {
917
+ switch (_context12.prev = _context12.next) {
918
+ case 0:
919
+ contentSpaceAddress = _ref16.contentSpaceAddress, kmsId = _ref16.kmsId;
920
+ kmsAddress = Utils.HashToAddress(kmsId);
921
+ return _context12.abrupt("return", this.DeployDependentContract({
922
+ contractAddress: contentSpaceAddress,
923
+ methodName: "createLibrary",
924
+ args: [kmsAddress],
925
+ eventName: "CreateLibrary",
926
+ eventValue: "libraryAddress"
927
+ }));
928
+
929
+ case 3:
930
+ case "end":
931
+ return _context12.stop();
932
+ }
860
933
  }
861
- }
862
- }, null, this);
863
- }
934
+ }, _callee12, this);
935
+ }));
936
+
937
+ function DeployLibraryContract(_x11) {
938
+ return _DeployLibraryContract.apply(this, arguments);
939
+ }
940
+
941
+ return DeployLibraryContract;
942
+ }()
864
943
  }, {
865
944
  key: "DeployContentContract",
866
- value: function DeployContentContract(_ref15) {
867
- var contentLibraryAddress, typeAddress;
868
- return _regeneratorRuntime.async(function DeployContentContract$(_context13) {
869
- while (1) {
870
- switch (_context13.prev = _context13.next) {
871
- case 0:
872
- contentLibraryAddress = _ref15.contentLibraryAddress, typeAddress = _ref15.typeAddress;
873
- // If type is not specified, use null address
874
- typeAddress = typeAddress || Utils.nullAddress;
875
- return _context13.abrupt("return", this.DeployDependentContract({
876
- contractAddress: contentLibraryAddress,
877
- methodName: "createContent",
878
- args: [typeAddress],
879
- eventName: "ContentObjectCreated",
880
- eventValue: "contentAddress"
881
- }));
882
-
883
- case 3:
884
- case "end":
885
- return _context13.stop();
945
+ value: function () {
946
+ var _DeployContentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref17) {
947
+ var contentLibraryAddress, typeAddress;
948
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
949
+ while (1) {
950
+ switch (_context13.prev = _context13.next) {
951
+ case 0:
952
+ contentLibraryAddress = _ref17.contentLibraryAddress, typeAddress = _ref17.typeAddress;
953
+ // If type is not specified, use null address
954
+ typeAddress = typeAddress || Utils.nullAddress;
955
+ return _context13.abrupt("return", this.DeployDependentContract({
956
+ contractAddress: contentLibraryAddress,
957
+ methodName: "createContent",
958
+ args: [typeAddress],
959
+ eventName: "ContentObjectCreated",
960
+ eventValue: "contentAddress"
961
+ }));
962
+
963
+ case 3:
964
+ case "end":
965
+ return _context13.stop();
966
+ }
886
967
  }
887
- }
888
- }, null, this);
889
- }
968
+ }, _callee13, this);
969
+ }));
970
+
971
+ function DeployContentContract(_x12) {
972
+ return _DeployContentContract.apply(this, arguments);
973
+ }
974
+
975
+ return DeployContentContract;
976
+ }()
890
977
  }, {
891
978
  key: "CommitContent",
892
- value: function CommitContent(_ref16) {
893
- var contentObjectAddress, versionHash;
894
- return _regeneratorRuntime.async(function CommitContent$(_context14) {
895
- while (1) {
896
- switch (_context14.prev = _context14.next) {
897
- case 0:
898
- contentObjectAddress = _ref16.contentObjectAddress, versionHash = _ref16.versionHash;
899
- _context14.next = 3;
900
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
901
- contractAddress: contentObjectAddress,
902
- methodName: "commit",
903
- methodArgs: [versionHash],
904
- eventName: "CommitPending"
905
- }));
906
-
907
- case 3:
908
- return _context14.abrupt("return", _context14.sent);
909
-
910
- case 4:
911
- case "end":
912
- return _context14.stop();
979
+ value: function () {
980
+ var _CommitContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref18) {
981
+ var contentObjectAddress, versionHash;
982
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
983
+ while (1) {
984
+ switch (_context14.prev = _context14.next) {
985
+ case 0:
986
+ contentObjectAddress = _ref18.contentObjectAddress, versionHash = _ref18.versionHash;
987
+ _context14.next = 3;
988
+ return this.CallContractMethodAndWait({
989
+ contractAddress: contentObjectAddress,
990
+ methodName: "commit",
991
+ methodArgs: [versionHash],
992
+ eventName: "CommitPending"
993
+ });
994
+
995
+ case 3:
996
+ return _context14.abrupt("return", _context14.sent);
997
+
998
+ case 4:
999
+ case "end":
1000
+ return _context14.stop();
1001
+ }
913
1002
  }
914
- }
915
- }, null, this);
916
- }
1003
+ }, _callee14, this);
1004
+ }));
1005
+
1006
+ function CommitContent(_x13) {
1007
+ return _CommitContent.apply(this, arguments);
1008
+ }
1009
+
1010
+ return CommitContent;
1011
+ }()
917
1012
  }, {
918
1013
  key: "EngageAccountLibrary",
919
- value: function EngageAccountLibrary(_ref17) {
920
- var contentSpaceAddress;
921
- return _regeneratorRuntime.async(function EngageAccountLibrary$(_context15) {
922
- while (1) {
923
- switch (_context15.prev = _context15.next) {
924
- case 0:
925
- contentSpaceAddress = _ref17.contentSpaceAddress;
926
- return _context15.abrupt("return", this.CallContractMethodAndWait({
927
- contractAddress: contentSpaceAddress,
928
- methodName: "engageAccountLibrary",
929
- args: []
930
- }));
931
-
932
- case 2:
933
- case "end":
934
- return _context15.stop();
1014
+ value: function () {
1015
+ var _EngageAccountLibrary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref19) {
1016
+ var contentSpaceAddress;
1017
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1018
+ while (1) {
1019
+ switch (_context15.prev = _context15.next) {
1020
+ case 0:
1021
+ contentSpaceAddress = _ref19.contentSpaceAddress;
1022
+ return _context15.abrupt("return", this.CallContractMethodAndWait({
1023
+ contractAddress: contentSpaceAddress,
1024
+ methodName: "engageAccountLibrary",
1025
+ args: []
1026
+ }));
1027
+
1028
+ case 2:
1029
+ case "end":
1030
+ return _context15.stop();
1031
+ }
935
1032
  }
936
- }
937
- }, null, this);
938
- }
1033
+ }, _callee15, this);
1034
+ }));
1035
+
1036
+ function EngageAccountLibrary(_x14) {
1037
+ return _EngageAccountLibrary.apply(this, arguments);
1038
+ }
1039
+
1040
+ return EngageAccountLibrary;
1041
+ }()
939
1042
  }, {
940
1043
  key: "SetCustomContentContract",
941
- value: function SetCustomContentContract(_ref18) {
942
- var contentContractAddress, customContractAddress, _ref18$overrides, overrides;
943
-
944
- return _regeneratorRuntime.async(function SetCustomContentContract$(_context16) {
945
- while (1) {
946
- switch (_context16.prev = _context16.next) {
947
- case 0:
948
- contentContractAddress = _ref18.contentContractAddress, customContractAddress = _ref18.customContractAddress, _ref18$overrides = _ref18.overrides, overrides = _ref18$overrides === void 0 ? {} : _ref18$overrides;
949
- _context16.next = 3;
950
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
951
- contractAddress: contentContractAddress,
952
- methodName: "setContentContractAddress",
953
- methodArgs: [customContractAddress],
954
- overrides: overrides
955
- }));
956
-
957
- case 3:
958
- return _context16.abrupt("return", _context16.sent);
959
-
960
- case 4:
961
- case "end":
962
- return _context16.stop();
1044
+ value: function () {
1045
+ var _SetCustomContentContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref20) {
1046
+ var contentContractAddress, customContractAddress, _ref20$overrides, overrides;
1047
+
1048
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1049
+ while (1) {
1050
+ switch (_context16.prev = _context16.next) {
1051
+ case 0:
1052
+ contentContractAddress = _ref20.contentContractAddress, customContractAddress = _ref20.customContractAddress, _ref20$overrides = _ref20.overrides, overrides = _ref20$overrides === void 0 ? {} : _ref20$overrides;
1053
+ _context16.next = 3;
1054
+ return this.CallContractMethodAndWait({
1055
+ contractAddress: contentContractAddress,
1056
+ methodName: "setContentContractAddress",
1057
+ methodArgs: [customContractAddress],
1058
+ overrides: overrides
1059
+ });
1060
+
1061
+ case 3:
1062
+ return _context16.abrupt("return", _context16.sent);
1063
+
1064
+ case 4:
1065
+ case "end":
1066
+ return _context16.stop();
1067
+ }
963
1068
  }
964
- }
965
- }, null, this);
966
- } // Get all logs for the specified contract in the specified range
1069
+ }, _callee16, this);
1070
+ }));
967
1071
 
968
- }, {
969
- key: "ContractEvents",
970
- value: function ContractEvents(_ref19) {
971
- var _this4 = this;
972
-
973
- var contractAddress, abi, _ref19$fromBlock, fromBlock, toBlock, topics, _ref19$includeTransac, includeTransaction, filter, contractLogs, blocks;
974
-
975
- return _regeneratorRuntime.async(function ContractEvents$(_context18) {
976
- while (1) {
977
- switch (_context18.prev = _context18.next) {
978
- case 0:
979
- 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;
980
- filter = {
981
- address: contractAddress,
982
- fromBlock: fromBlock,
983
- toBlock: toBlock
984
- };
985
-
986
- if (topics) {
987
- filter.topics = topics;
988
- }
1072
+ function SetCustomContentContract(_x15) {
1073
+ return _SetCustomContentContract.apply(this, arguments);
1074
+ }
989
1075
 
990
- _context18.next = 5;
991
- return _regeneratorRuntime.awrap(this.MakeProviderCall({
992
- methodName: "getLogs",
993
- args: [filter]
994
- }));
1076
+ return SetCustomContentContract;
1077
+ }() // Get all logs for the specified contract in the specified range
995
1078
 
996
- case 5:
997
- _context18.t0 = _context18.sent;
1079
+ }, {
1080
+ key: "ContractEvents",
1081
+ value: function () {
1082
+ var _ContractEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref21) {
1083
+ var _this4 = this;
1084
+
1085
+ var contractAddress, abi, _ref21$fromBlock, fromBlock, toBlock, topics, _ref21$includeTransac, includeTransaction, filter, contractLogs, blocks;
1086
+
1087
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1088
+ while (1) {
1089
+ switch (_context18.prev = _context18.next) {
1090
+ case 0:
1091
+ 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;
1092
+ filter = {
1093
+ address: contractAddress,
1094
+ fromBlock: fromBlock,
1095
+ toBlock: toBlock
1096
+ };
1097
+
1098
+ if (topics) {
1099
+ filter.topics = topics;
1100
+ }
1101
+
1102
+ _context18.next = 5;
1103
+ return this.MakeProviderCall({
1104
+ methodName: "getLogs",
1105
+ args: [filter]
1106
+ });
998
1107
 
999
- if (_context18.t0) {
1000
- _context18.next = 8;
1001
- break;
1002
- }
1108
+ case 5:
1109
+ _context18.t0 = _context18.sent;
1110
+
1111
+ if (_context18.t0) {
1112
+ _context18.next = 8;
1113
+ break;
1114
+ }
1115
+
1116
+ _context18.t0 = [];
1117
+
1118
+ case 8:
1119
+ contractLogs = _context18.t0;
1120
+
1121
+ if (Array.isArray(contractLogs)) {
1122
+ _context18.next = 11;
1123
+ break;
1124
+ }
1125
+
1126
+ return _context18.abrupt("return", []);
1127
+
1128
+ case 11:
1129
+ blocks = {};
1130
+ _context18.next = 14;
1131
+ return Utils.LimitedMap(5, contractLogs, /*#__PURE__*/function () {
1132
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(log) {
1133
+ var eventInterface, parsedLog;
1134
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1135
+ while (1) {
1136
+ switch (_context17.prev = _context17.next) {
1137
+ case 0:
1138
+ eventInterface = new Ethers.utils.Interface(abi);
1139
+ parsedLog = _objectSpread(_objectSpread({}, log), eventInterface.parseLog(log));
1140
+
1141
+ if (!includeTransaction) {
1142
+ _context17.next = 9;
1143
+ break;
1144
+ }
1003
1145
 
1004
- _context18.t0 = [];
1146
+ _context17.t0 = _objectSpread;
1147
+ _context17.t1 = _objectSpread({}, parsedLog);
1148
+ _context17.next = 7;
1149
+ return _this4.MakeProviderCall({
1150
+ methodName: "getTransaction",
1151
+ args: [log.transactionHash]
1152
+ });
1005
1153
 
1006
- case 8:
1007
- contractLogs = _context18.t0;
1154
+ case 7:
1155
+ _context17.t2 = _context17.sent;
1156
+ parsedLog = (0, _context17.t0)(_context17.t1, _context17.t2);
1008
1157
 
1009
- if (Array.isArray(contractLogs)) {
1010
- _context18.next = 11;
1011
- break;
1012
- }
1158
+ case 9:
1159
+ blocks[log.blockNumber] = [parsedLog].concat(blocks[log.blockNumber] || []);
1013
1160
 
1014
- return _context18.abrupt("return", []);
1015
-
1016
- case 11:
1017
- blocks = {};
1018
- _context18.next = 14;
1019
- return _regeneratorRuntime.awrap(Utils.LimitedMap(5, contractLogs, function _callee3(log) {
1020
- var eventInterface, parsedLog;
1021
- return _regeneratorRuntime.async(function _callee3$(_context17) {
1022
- while (1) {
1023
- switch (_context17.prev = _context17.next) {
1024
- case 0:
1025
- eventInterface = new Ethers.utils.Interface(abi);
1026
- parsedLog = _objectSpread({}, log, {}, eventInterface.parseLog(log));
1027
-
1028
- if (!includeTransaction) {
1029
- _context17.next = 11;
1030
- break;
1161
+ case 10:
1162
+ case "end":
1163
+ return _context17.stop();
1031
1164
  }
1165
+ }
1166
+ }, _callee17);
1167
+ }));
1168
+
1169
+ return function (_x17) {
1170
+ return _ref22.apply(this, arguments);
1171
+ };
1172
+ }());
1173
+
1174
+ case 14:
1175
+ return _context18.abrupt("return", Object.values(blocks).sort(function (a, b) {
1176
+ return a[0].blockNumber < b[0].blockNumber ? 1 : -1;
1177
+ }));
1178
+
1179
+ case 15:
1180
+ case "end":
1181
+ return _context18.stop();
1182
+ }
1183
+ }
1184
+ }, _callee18, this);
1185
+ }));
1032
1186
 
1033
- _context17.t0 = _objectSpread;
1034
- _context17.t1 = {};
1035
- _context17.t2 = parsedLog;
1036
- _context17.t3 = {};
1037
- _context17.next = 9;
1038
- return _regeneratorRuntime.awrap(_this4.MakeProviderCall({
1039
- methodName: "getTransaction",
1040
- args: [log.transactionHash]
1041
- }));
1042
-
1043
- case 9:
1044
- _context17.t4 = _context17.sent;
1045
- parsedLog = (0, _context17.t0)(_context17.t1, _context17.t2, _context17.t3, _context17.t4);
1046
-
1047
- case 11:
1048
- blocks[log.blockNumber] = [parsedLog].concat(blocks[log.blockNumber] || []);
1049
-
1050
- case 12:
1051
- case "end":
1052
- return _context17.stop();
1053
- }
1054
- }
1055
- });
1056
- }));
1057
-
1058
- case 14:
1059
- return _context18.abrupt("return", Object.values(blocks).sort(function (a, b) {
1060
- return a[0].blockNumber < b[0].blockNumber ? 1 : -1;
1061
- }));
1187
+ function ContractEvents(_x16) {
1188
+ return _ContractEvents.apply(this, arguments);
1189
+ }
1062
1190
 
1063
- case 15:
1064
- case "end":
1065
- return _context18.stop();
1066
- }
1067
- }
1068
- }, null, this);
1069
- } // Look up the log topic and see if it is known. If so, parse it and inject it into the log
1191
+ return ContractEvents;
1192
+ }() // Look up the log topic and see if it is known. If so, parse it and inject it into the log
1070
1193
 
1071
1194
  }, {
1072
1195
  key: "ParseUnknownLog",
1073
- value: function ParseUnknownLog(_ref20) {
1074
- var log = _ref20.log;
1196
+ value: function ParseUnknownLog(_ref23) {
1197
+ var log = _ref23.log;
1075
1198
 
1076
1199
  if (log.topics && log.topics.length > 0) {
1077
1200
  var topicHash = log.topics[0];
@@ -1081,7 +1204,7 @@ function () {
1081
1204
  var eventInterface = new Ethers.utils.Interface(topicInfo.abi);
1082
1205
 
1083
1206
  if (eventInterface) {
1084
- log = _objectSpread({}, log, {}, eventInterface.parseLog(log), {
1207
+ log = _objectSpread(_objectSpread(_objectSpread({}, log), eventInterface.parseLog(log)), {}, {
1085
1208
  contract: topicInfo.contract
1086
1209
  });
1087
1210
  }
@@ -1094,160 +1217,181 @@ function () {
1094
1217
 
1095
1218
  }, {
1096
1219
  key: "Events",
1097
- value: function Events(_ref21) {
1098
- var _this5 = this;
1099
-
1100
- var toBlock, fromBlock, _ref21$includeTransac, includeTransaction, logs, i, newLogs, blocks, output;
1101
-
1102
- return _regeneratorRuntime.async(function Events$(_context21) {
1103
- while (1) {
1104
- switch (_context21.prev = _context21.next) {
1105
- case 0:
1106
- toBlock = _ref21.toBlock, fromBlock = _ref21.fromBlock, _ref21$includeTransac = _ref21.includeTransaction, includeTransaction = _ref21$includeTransac === void 0 ? false : _ref21$includeTransac;
1107
- // Pull logs in batches of 100
1108
- logs = [];
1109
- i = fromBlock;
1110
-
1111
- case 3:
1112
- if (!(i < toBlock)) {
1113
- _context21.next = 11;
1220
+ value: function () {
1221
+ var _Events = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref24) {
1222
+ var _this5 = this;
1223
+
1224
+ var toBlock, fromBlock, _ref24$includeTransac, includeTransaction, logs, i, newLogs, blocks, output;
1225
+
1226
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1227
+ while (1) {
1228
+ switch (_context21.prev = _context21.next) {
1229
+ case 0:
1230
+ toBlock = _ref24.toBlock, fromBlock = _ref24.fromBlock, _ref24$includeTransac = _ref24.includeTransaction, includeTransaction = _ref24$includeTransac === void 0 ? false : _ref24$includeTransac;
1231
+ // Pull logs in batches of 100
1232
+ logs = [];
1233
+ i = fromBlock;
1234
+
1235
+ case 3:
1236
+ if (!(i < toBlock)) {
1237
+ _context21.next = 11;
1238
+ break;
1239
+ }
1240
+
1241
+ _context21.next = 6;
1242
+ return this.MakeProviderCall({
1243
+ methodName: "getLogs",
1244
+ args: [{
1245
+ fromBlock: i,
1246
+ toBlock: Math.min(toBlock, i + 100)
1247
+ }]
1248
+ });
1249
+
1250
+ case 6:
1251
+ newLogs = _context21.sent;
1252
+ logs = logs.concat(newLogs || []);
1253
+
1254
+ case 8:
1255
+ i += 101;
1256
+ _context21.next = 3;
1114
1257
  break;
1115
- }
1116
1258
 
1117
- _context21.next = 6;
1118
- return _regeneratorRuntime.awrap(this.MakeProviderCall({
1119
- methodName: "getLogs",
1120
- args: [{
1121
- fromBlock: i,
1122
- toBlock: Math.min(toBlock, i + 100)
1123
- }]
1124
- }));
1125
-
1126
- case 6:
1127
- newLogs = _context21.sent;
1128
- logs = logs.concat(newLogs || []);
1129
-
1130
- case 8:
1131
- i += 101;
1132
- _context21.next = 3;
1133
- break;
1134
-
1135
- case 11:
1136
- // Group logs by blocknumber
1137
- blocks = {};
1138
- logs.forEach(function (log) {
1139
- blocks[log.blockNumber] = [_this5.ParseUnknownLog({
1140
- log: log
1141
- })].concat(blocks[log.blockNumber] || []);
1142
- });
1143
- output = [];
1144
- _context21.next = 16;
1145
- return _regeneratorRuntime.awrap(Utils.LimitedMap(3, _toConsumableArray(Array(toBlock - fromBlock + 1).keys()), function _callee5(i) {
1146
- var blockNumber, blockInfo, transactionInfo;
1147
- return _regeneratorRuntime.async(function _callee5$(_context20) {
1148
- while (1) {
1149
- switch (_context20.prev = _context20.next) {
1150
- case 0:
1151
- blockNumber = toBlock - i;
1152
- blockInfo = blocks[blockNumber];
1153
-
1154
- if (blockInfo) {
1155
- _context20.next = 8;
1156
- break;
1157
- }
1259
+ case 11:
1260
+ // Group logs by blocknumber
1261
+ blocks = {};
1262
+ logs.forEach(function (log) {
1263
+ blocks[log.blockNumber] = [_this5.ParseUnknownLog({
1264
+ log: log
1265
+ })].concat(blocks[log.blockNumber] || []);
1266
+ });
1267
+ output = [];
1268
+ _context21.next = 16;
1269
+ return Utils.LimitedMap(3, _toConsumableArray(Array(toBlock - fromBlock + 1).keys()), /*#__PURE__*/function () {
1270
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(i) {
1271
+ var blockNumber, blockInfo, transactionInfo;
1272
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1273
+ while (1) {
1274
+ switch (_context20.prev = _context20.next) {
1275
+ case 0:
1276
+ blockNumber = toBlock - i;
1277
+ blockInfo = blocks[blockNumber];
1278
+
1279
+ if (blockInfo) {
1280
+ _context20.next = 8;
1281
+ break;
1282
+ }
1158
1283
 
1159
- _context20.next = 5;
1160
- return _regeneratorRuntime.awrap(_this5.MakeProviderCall({
1161
- methodName: "getBlock",
1162
- args: [blockNumber]
1163
- }));
1164
-
1165
- case 5:
1166
- blockInfo = _context20.sent;
1167
- blockInfo = blockInfo.transactions.map(function (transactionHash) {
1168
- return _objectSpread({
1169
- blockNumber: blockInfo.number,
1170
- blockHash: blockInfo.hash
1171
- }, blockInfo, {
1172
- transactionHash: transactionHash
1173
- });
1174
- });
1175
- blocks[blockNumber] = blockInfo;
1176
-
1177
- case 8:
1178
- if (!includeTransaction) {
1179
- _context20.next = 13;
1180
- break;
1181
- }
1284
+ _context20.next = 5;
1285
+ return _this5.MakeProviderCall({
1286
+ methodName: "getBlock",
1287
+ args: [blockNumber]
1288
+ });
1289
+
1290
+ case 5:
1291
+ blockInfo = _context20.sent;
1292
+ blockInfo = blockInfo.transactions.map(function (transactionHash) {
1293
+ return _objectSpread(_objectSpread({
1294
+ blockNumber: blockInfo.number,
1295
+ blockHash: blockInfo.hash
1296
+ }, blockInfo), {}, {
1297
+ transactionHash: transactionHash
1298
+ });
1299
+ });
1300
+ blocks[blockNumber] = blockInfo;
1301
+
1302
+ case 8:
1303
+ if (!includeTransaction) {
1304
+ _context20.next = 13;
1305
+ break;
1306
+ }
1182
1307
 
1183
- transactionInfo = {};
1184
- _context20.next = 12;
1185
- return _regeneratorRuntime.awrap(Promise.all(blockInfo.map(function _callee4(block) {
1186
- return _regeneratorRuntime.async(function _callee4$(_context19) {
1187
- while (1) {
1188
- switch (_context19.prev = _context19.next) {
1189
- case 0:
1190
- if (transactionInfo[block.transactionHash]) {
1191
- _context19.next = 11;
1192
- break;
1308
+ transactionInfo = {};
1309
+ _context20.next = 12;
1310
+ return Promise.all(blockInfo.map( /*#__PURE__*/function () {
1311
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(block) {
1312
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1313
+ while (1) {
1314
+ switch (_context19.prev = _context19.next) {
1315
+ case 0:
1316
+ if (transactionInfo[block.transactionHash]) {
1317
+ _context19.next = 12;
1318
+ break;
1319
+ }
1320
+
1321
+ _context19.t0 = _objectSpread;
1322
+ _context19.t1 = _objectSpread;
1323
+ _context19.t2 = {};
1324
+ _context19.next = 6;
1325
+ return _this5.MakeProviderCall({
1326
+ methodName: "getTransaction",
1327
+ args: [block.transactionHash]
1328
+ });
1329
+
1330
+ case 6:
1331
+ _context19.t3 = _context19.sent;
1332
+ _context19.t4 = (0, _context19.t1)(_context19.t2, _context19.t3);
1333
+ _context19.next = 10;
1334
+ return _this5.MakeProviderCall({
1335
+ methodName: "getTransactionReceipt",
1336
+ args: [block.transactionHash]
1337
+ });
1338
+
1339
+ case 10:
1340
+ _context19.t5 = _context19.sent;
1341
+ transactionInfo[block.transactionHash] = (0, _context19.t0)(_context19.t4, _context19.t5);
1342
+
1343
+ case 12:
1344
+ return _context19.abrupt("return", _objectSpread(_objectSpread({}, block), transactionInfo[block.transactionHash]));
1345
+
1346
+ case 13:
1347
+ case "end":
1348
+ return _context19.stop();
1349
+ }
1193
1350
  }
1351
+ }, _callee19);
1352
+ }));
1194
1353
 
1195
- _context19.t0 = _objectSpread;
1196
- _context19.t1 = {};
1197
- _context19.next = 5;
1198
- return _regeneratorRuntime.awrap(_this5.MakeProviderCall({
1199
- methodName: "getTransaction",
1200
- args: [block.transactionHash]
1201
- }));
1202
-
1203
- case 5:
1204
- _context19.t2 = _context19.sent;
1205
- _context19.t3 = {};
1206
- _context19.next = 9;
1207
- return _regeneratorRuntime.awrap(_this5.MakeProviderCall({
1208
- methodName: "getTransactionReceipt",
1209
- args: [block.transactionHash]
1210
- }));
1211
-
1212
- case 9:
1213
- _context19.t4 = _context19.sent;
1214
- transactionInfo[block.transactionHash] = (0, _context19.t0)(_context19.t1, _context19.t2, _context19.t3, _context19.t4);
1215
-
1216
- case 11:
1217
- return _context19.abrupt("return", _objectSpread({}, block, {}, transactionInfo[block.transactionHash]));
1218
-
1219
- case 12:
1220
- case "end":
1221
- return _context19.stop();
1222
- }
1223
- }
1224
- });
1225
- })));
1354
+ return function (_x20) {
1355
+ return _ref26.apply(this, arguments);
1356
+ };
1357
+ }()));
1226
1358
 
1227
- case 12:
1228
- blocks[blockNumber] = _context20.sent;
1359
+ case 12:
1360
+ blocks[blockNumber] = _context20.sent;
1229
1361
 
1230
- case 13:
1231
- output.push(blocks[blockNumber]);
1362
+ case 13:
1363
+ output.push(blocks[blockNumber]);
1232
1364
 
1233
- case 14:
1234
- case "end":
1235
- return _context20.stop();
1236
- }
1237
- }
1238
- });
1239
- }));
1365
+ case 14:
1366
+ case "end":
1367
+ return _context20.stop();
1368
+ }
1369
+ }
1370
+ }, _callee20);
1371
+ }));
1240
1372
 
1241
- case 16:
1242
- return _context21.abrupt("return", output);
1373
+ return function (_x19) {
1374
+ return _ref25.apply(this, arguments);
1375
+ };
1376
+ }());
1243
1377
 
1244
- case 17:
1245
- case "end":
1246
- return _context21.stop();
1378
+ case 16:
1379
+ return _context21.abrupt("return", output);
1380
+
1381
+ case 17:
1382
+ case "end":
1383
+ return _context21.stop();
1384
+ }
1247
1385
  }
1248
- }
1249
- }, null, this);
1250
- }
1386
+ }, _callee21, this);
1387
+ }));
1388
+
1389
+ function Events(_x18) {
1390
+ return _Events.apply(this, arguments);
1391
+ }
1392
+
1393
+ return Events;
1394
+ }()
1251
1395
  }]);
1252
1396
 
1253
1397
  return EthClient;