@eluvio/elv-client-js 4.0.72 → 4.0.74

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.
@@ -2,8 +2,8 @@ var _defineProperty = require("@babel/runtime/helpers/defineProperty");
2
2
  var _typeof = require("@babel/runtime/helpers/typeof");
3
3
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
4
4
  var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ 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; }
6
+ 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; }
7
7
  /**
8
8
  * Methods for deploying and interacting with contracts
9
9
  *
@@ -95,38 +95,6 @@ exports.ContractAbi = /*#__PURE__*/function () {
95
95
  };
96
96
  }();
97
97
 
98
- /**
99
- * Retrieve the ABI, access type, and whether V3 is used for a given contract via its address or a Fabric ID.
100
- *
101
- * @methodGroup Contracts
102
- * @namedParams
103
- * @param {string=} id - The Fabric ID of the contract
104
- * @param {string=} address - The address of the contract
105
- *
106
- * @return {Promise<Object>} - The ABI, access type, and isV3 for the given contract
107
- */
108
- exports.ContractInfo = /*#__PURE__*/function () {
109
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) {
110
- var id, address;
111
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
112
- while (1) switch (_context3.prev = _context3.next) {
113
- case 0:
114
- id = _ref5.id, address = _ref5.address;
115
- return _context3.abrupt("return", this.authClient.ContractInfo({
116
- id: id,
117
- address: address
118
- }));
119
- case 2:
120
- case "end":
121
- return _context3.stop();
122
- }
123
- }, _callee3, this);
124
- }));
125
- return function (_x3) {
126
- return _ref6.apply(this, arguments);
127
- };
128
- }();
129
-
130
98
  /**
131
99
  * Format the arguments to be used for the specified method of the contract
132
100
  *
@@ -138,10 +106,10 @@ exports.ContractInfo = /*#__PURE__*/function () {
138
106
  *
139
107
  * @returns {Array<string>} - List of formatted arguments
140
108
  */
141
- exports.FormatContractArguments = function (_ref7) {
142
- var abi = _ref7.abi,
143
- methodName = _ref7.methodName,
144
- args = _ref7.args;
109
+ exports.FormatContractArguments = function (_ref5) {
110
+ var abi = _ref5.abi,
111
+ methodName = _ref5.methodName,
112
+ args = _ref5.args;
145
113
  return this.ethClient.FormatContractArguments({
146
114
  abi: abi,
147
115
  methodName: methodName,
@@ -162,13 +130,13 @@ exports.FormatContractArguments = function (_ref7) {
162
130
  * @returns {Promise<Object>} - Response containing the deployed contract address and the transaction hash of the deployment
163
131
  */
164
132
  exports.DeployContract = /*#__PURE__*/function () {
165
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8) {
166
- var abi, bytecode, constructorArgs, _ref8$overrides, overrides;
167
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
168
- while (1) switch (_context4.prev = _context4.next) {
133
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
134
+ var abi, bytecode, constructorArgs, _ref6$overrides, overrides;
135
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
136
+ while (1) switch (_context3.prev = _context3.next) {
169
137
  case 0:
170
- abi = _ref8.abi, bytecode = _ref8.bytecode, constructorArgs = _ref8.constructorArgs, _ref8$overrides = _ref8.overrides, overrides = _ref8$overrides === void 0 ? {} : _ref8$overrides;
171
- _context4.next = 3;
138
+ abi = _ref6.abi, bytecode = _ref6.bytecode, constructorArgs = _ref6.constructorArgs, _ref6$overrides = _ref6.overrides, overrides = _ref6$overrides === void 0 ? {} : _ref6$overrides;
139
+ _context3.next = 3;
172
140
  return this.ethClient.DeployContract({
173
141
  abi: abi,
174
142
  bytecode: bytecode,
@@ -177,15 +145,15 @@ exports.DeployContract = /*#__PURE__*/function () {
177
145
  signer: this.signer
178
146
  });
179
147
  case 3:
180
- return _context4.abrupt("return", _context4.sent);
148
+ return _context3.abrupt("return", _context3.sent);
181
149
  case 4:
182
150
  case "end":
183
- return _context4.stop();
151
+ return _context3.stop();
184
152
  }
185
- }, _callee4, this);
153
+ }, _callee3, this);
186
154
  }));
187
- return function (_x4) {
188
- return _ref9.apply(this, arguments);
155
+ return function (_x3) {
156
+ return _ref7.apply(this, arguments);
189
157
  };
190
158
  }();
191
159
 
@@ -204,34 +172,34 @@ exports.DeployContract = /*#__PURE__*/function () {
204
172
  * @returns {Promise<Array<Array<Object>>>} - List of blocks, in ascending order by block number, each containing a list of the events in the block.
205
173
  */
206
174
  exports.ContractEvents = /*#__PURE__*/function () {
207
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref10) {
208
- var contractAddress, abi, _ref10$fromBlock, fromBlock, toBlock, _ref10$count, count, topics, _ref10$includeTransac, includeTransaction, blocks;
209
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
210
- while (1) switch (_context5.prev = _context5.next) {
175
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8) {
176
+ var contractAddress, abi, _ref8$fromBlock, fromBlock, toBlock, _ref8$count, count, topics, _ref8$includeTransact, includeTransaction, blocks;
177
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
178
+ while (1) switch (_context4.prev = _context4.next) {
211
179
  case 0:
212
- contractAddress = _ref10.contractAddress, abi = _ref10.abi, _ref10$fromBlock = _ref10.fromBlock, fromBlock = _ref10$fromBlock === void 0 ? 0 : _ref10$fromBlock, toBlock = _ref10.toBlock, _ref10$count = _ref10.count, count = _ref10$count === void 0 ? 1000 : _ref10$count, topics = _ref10.topics, _ref10$includeTransac = _ref10.includeTransaction, includeTransaction = _ref10$includeTransac === void 0 ? false : _ref10$includeTransac;
180
+ contractAddress = _ref8.contractAddress, abi = _ref8.abi, _ref8$fromBlock = _ref8.fromBlock, fromBlock = _ref8$fromBlock === void 0 ? 0 : _ref8$fromBlock, toBlock = _ref8.toBlock, _ref8$count = _ref8.count, count = _ref8$count === void 0 ? 1000 : _ref8$count, topics = _ref8.topics, _ref8$includeTransact = _ref8.includeTransaction, includeTransaction = _ref8$includeTransact === void 0 ? false : _ref8$includeTransact;
213
181
  contractAddress = ValidateAddress(contractAddress);
214
182
  if (abi) {
215
- _context5.next = 6;
183
+ _context4.next = 6;
216
184
  break;
217
185
  }
218
- _context5.next = 5;
186
+ _context4.next = 5;
219
187
  return this.ContractAbi({
220
188
  contractAddress: contractAddress
221
189
  });
222
190
  case 5:
223
- abi = _context5.sent;
191
+ abi = _context4.sent;
224
192
  case 6:
225
- _context5.next = 8;
193
+ _context4.next = 8;
226
194
  return this.FormatBlockNumbers({
227
195
  fromBlock: fromBlock,
228
196
  toBlock: toBlock,
229
197
  count: count
230
198
  });
231
199
  case 8:
232
- blocks = _context5.sent;
200
+ blocks = _context4.sent;
233
201
  this.Log("Querying contract events ".concat(contractAddress, " - Blocks ").concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
234
- _context5.next = 12;
202
+ _context4.next = 12;
235
203
  return this.ethClient.ContractEvents({
236
204
  contractAddress: contractAddress,
237
205
  abi: abi,
@@ -241,15 +209,15 @@ exports.ContractEvents = /*#__PURE__*/function () {
241
209
  includeTransaction: includeTransaction
242
210
  });
243
211
  case 12:
244
- return _context5.abrupt("return", _context5.sent);
212
+ return _context4.abrupt("return", _context4.sent);
245
213
  case 13:
246
214
  case "end":
247
- return _context5.stop();
215
+ return _context4.stop();
248
216
  }
249
- }, _callee5, this);
217
+ }, _callee4, this);
250
218
  }));
251
- return function (_x5) {
252
- return _ref11.apply(this, arguments);
219
+ return function (_x4) {
220
+ return _ref9.apply(this, arguments);
253
221
  };
254
222
  }();
255
223
 
@@ -272,12 +240,12 @@ exports.ContractEvents = /*#__PURE__*/function () {
272
240
  * @returns {Promise<*>} - Response containing information about the transaction
273
241
  */
274
242
  exports.CallContractMethod = /*#__PURE__*/function () {
275
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref12) {
276
- var contractAddress, abi, methodName, _ref12$methodArgs, methodArgs, value, _ref12$overrides, overrides, _ref12$formatArgument, formatArguments, _ref12$cacheContract, cacheContract, _ref12$overrideCached, overrideCachedContract;
277
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
278
- while (1) switch (_context6.prev = _context6.next) {
243
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref10) {
244
+ var contractAddress, abi, methodName, _ref10$methodArgs, methodArgs, value, _ref10$overrides, overrides, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract;
245
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
246
+ while (1) switch (_context5.prev = _context5.next) {
279
247
  case 0:
280
- contractAddress = _ref12.contractAddress, abi = _ref12.abi, methodName = _ref12.methodName, _ref12$methodArgs = _ref12.methodArgs, methodArgs = _ref12$methodArgs === void 0 ? [] : _ref12$methodArgs, value = _ref12.value, _ref12$overrides = _ref12.overrides, overrides = _ref12$overrides === void 0 ? {} : _ref12$overrides, _ref12$formatArgument = _ref12.formatArguments, formatArguments = _ref12$formatArgument === void 0 ? true : _ref12$formatArgument, _ref12$cacheContract = _ref12.cacheContract, cacheContract = _ref12$cacheContract === void 0 ? true : _ref12$cacheContract, _ref12$overrideCached = _ref12.overrideCachedContract, overrideCachedContract = _ref12$overrideCached === void 0 ? false : _ref12$overrideCached;
248
+ contractAddress = _ref10.contractAddress, abi = _ref10.abi, methodName = _ref10.methodName, _ref10$methodArgs = _ref10.methodArgs, methodArgs = _ref10$methodArgs === void 0 ? [] : _ref10$methodArgs, value = _ref10.value, _ref10$overrides = _ref10.overrides, overrides = _ref10$overrides === void 0 ? {} : _ref10$overrides, _ref10$formatArgument = _ref10.formatArguments, formatArguments = _ref10$formatArgument === void 0 ? true : _ref10$formatArgument, _ref10$cacheContract = _ref10.cacheContract, cacheContract = _ref10$cacheContract === void 0 ? true : _ref10$cacheContract, _ref10$overrideCached = _ref10.overrideCachedContract, overrideCachedContract = _ref10$overrideCached === void 0 ? false : _ref10$overrideCached;
281
249
  contractAddress = ValidateAddress(contractAddress);
282
250
 
283
251
  // Delete cached visibility value if it is being changed
@@ -286,17 +254,17 @@ exports.CallContractMethod = /*#__PURE__*/function () {
286
254
  delete this.visibilityInfo[contractAddress];
287
255
  }
288
256
  if (abi) {
289
- _context6.next = 8;
257
+ _context5.next = 8;
290
258
  break;
291
259
  }
292
- _context6.next = 7;
260
+ _context5.next = 7;
293
261
  return this.ContractAbi({
294
262
  contractAddress: contractAddress
295
263
  });
296
264
  case 7:
297
- abi = _context6.sent;
265
+ abi = _context5.sent;
298
266
  case 8:
299
- _context6.next = 10;
267
+ _context5.next = 10;
300
268
  return this.ethClient.CallContractMethod({
301
269
  contractAddress: contractAddress,
302
270
  abi: abi,
@@ -309,15 +277,15 @@ exports.CallContractMethod = /*#__PURE__*/function () {
309
277
  overrideCachedContract: overrideCachedContract
310
278
  });
311
279
  case 10:
312
- return _context6.abrupt("return", _context6.sent);
280
+ return _context5.abrupt("return", _context5.sent);
313
281
  case 11:
314
282
  case "end":
315
- return _context6.stop();
283
+ return _context5.stop();
316
284
  }
317
- }, _callee6, this);
285
+ }, _callee5, this);
318
286
  }));
319
- return function (_x6) {
320
- return _ref13.apply(this, arguments);
287
+ return function (_x5) {
288
+ return _ref11.apply(this, arguments);
321
289
  };
322
290
  }();
323
291
 
@@ -343,12 +311,12 @@ exports.CallContractMethod = /*#__PURE__*/function () {
343
311
  * the resulting event(s)
344
312
  */
345
313
  exports.CallContractMethodAndWait = /*#__PURE__*/function () {
346
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref14) {
347
- var contractAddress, abi, methodName, methodArgs, value, _ref14$overrides, overrides, _ref14$formatArgument, formatArguments, _ref14$cacheContract, cacheContract, _ref14$overrideCached, overrideCachedContract;
348
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
349
- while (1) switch (_context7.prev = _context7.next) {
314
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref12) {
315
+ var contractAddress, abi, methodName, methodArgs, value, _ref12$overrides, overrides, _ref12$formatArgument, formatArguments, _ref12$cacheContract, cacheContract, _ref12$overrideCached, overrideCachedContract;
316
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
317
+ while (1) switch (_context6.prev = _context6.next) {
350
318
  case 0:
351
- contractAddress = _ref14.contractAddress, abi = _ref14.abi, methodName = _ref14.methodName, methodArgs = _ref14.methodArgs, value = _ref14.value, _ref14$overrides = _ref14.overrides, overrides = _ref14$overrides === void 0 ? {} : _ref14$overrides, _ref14$formatArgument = _ref14.formatArguments, formatArguments = _ref14$formatArgument === void 0 ? true : _ref14$formatArgument, _ref14$cacheContract = _ref14.cacheContract, cacheContract = _ref14$cacheContract === void 0 ? true : _ref14$cacheContract, _ref14$overrideCached = _ref14.overrideCachedContract, overrideCachedContract = _ref14$overrideCached === void 0 ? false : _ref14$overrideCached;
319
+ contractAddress = _ref12.contractAddress, abi = _ref12.abi, methodName = _ref12.methodName, methodArgs = _ref12.methodArgs, value = _ref12.value, _ref12$overrides = _ref12.overrides, overrides = _ref12$overrides === void 0 ? {} : _ref12$overrides, _ref12$formatArgument = _ref12.formatArguments, formatArguments = _ref12$formatArgument === void 0 ? true : _ref12$formatArgument, _ref12$cacheContract = _ref12.cacheContract, cacheContract = _ref12$cacheContract === void 0 ? true : _ref12$cacheContract, _ref12$overrideCached = _ref12.overrideCachedContract, overrideCachedContract = _ref12$overrideCached === void 0 ? false : _ref12$overrideCached;
352
320
  contractAddress = ValidateAddress(contractAddress);
353
321
 
354
322
  // Delete cached visibility value if it is being changed
@@ -357,17 +325,17 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
357
325
  delete this.visibilityInfo[contractAddress];
358
326
  }
359
327
  if (abi) {
360
- _context7.next = 8;
328
+ _context6.next = 8;
361
329
  break;
362
330
  }
363
- _context7.next = 7;
331
+ _context6.next = 7;
364
332
  return this.ContractAbi({
365
333
  contractAddress: contractAddress
366
334
  });
367
335
  case 7:
368
- abi = _context7.sent;
336
+ abi = _context6.sent;
369
337
  case 8:
370
- _context7.next = 10;
338
+ _context6.next = 10;
371
339
  return this.ethClient.CallContractMethodAndWait({
372
340
  contractAddress: contractAddress,
373
341
  abi: abi,
@@ -380,15 +348,15 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
380
348
  overrideCachedContract: overrideCachedContract
381
349
  });
382
350
  case 10:
383
- return _context7.abrupt("return", _context7.sent);
351
+ return _context6.abrupt("return", _context6.sent);
384
352
  case 11:
385
353
  case "end":
386
- return _context7.stop();
354
+ return _context6.stop();
387
355
  }
388
- }, _callee7, this);
356
+ }, _callee6, this);
389
357
  }));
390
- return function (_x7) {
391
- return _ref15.apply(this, arguments);
358
+ return function (_x6) {
359
+ return _ref13.apply(this, arguments);
392
360
  };
393
361
  }();
394
362
 
@@ -403,45 +371,45 @@ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
403
371
  * @return {Promise<Object|string>}
404
372
  */
405
373
  exports.ContractMetadata = /*#__PURE__*/function () {
406
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref16) {
374
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref14) {
407
375
  var contractAddress, metadataKey, metadata, data;
408
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
409
- while (1) switch (_context8.prev = _context8.next) {
376
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
377
+ while (1) switch (_context7.prev = _context7.next) {
410
378
  case 0:
411
- contractAddress = _ref16.contractAddress, metadataKey = _ref16.metadataKey;
379
+ contractAddress = _ref14.contractAddress, metadataKey = _ref14.metadataKey;
412
380
  ValidatePresence("contractAddress", contractAddress);
413
381
  ValidatePresence("metadataKey", metadataKey);
414
- _context8.prev = 3;
415
- _context8.next = 6;
382
+ _context7.prev = 3;
383
+ _context7.next = 6;
416
384
  return this.CallContractMethod({
417
385
  contractAddress: contractAddress,
418
386
  methodName: "getMeta",
419
387
  methodArgs: [metadataKey]
420
388
  });
421
389
  case 6:
422
- metadata = _context8.sent;
390
+ metadata = _context7.sent;
423
391
  data = Buffer.from((metadata || "").replace("0x", ""), "hex").toString("utf-8");
424
- _context8.prev = 8;
425
- return _context8.abrupt("return", JSON.parse(data));
392
+ _context7.prev = 8;
393
+ return _context7.abrupt("return", JSON.parse(data));
426
394
  case 12:
427
- _context8.prev = 12;
428
- _context8.t0 = _context8["catch"](8);
429
- return _context8.abrupt("return", data);
395
+ _context7.prev = 12;
396
+ _context7.t0 = _context7["catch"](8);
397
+ return _context7.abrupt("return", data);
430
398
  case 15:
431
- _context8.next = 20;
399
+ _context7.next = 20;
432
400
  break;
433
401
  case 17:
434
- _context8.prev = 17;
435
- _context8.t1 = _context8["catch"](3);
436
- return _context8.abrupt("return", "");
402
+ _context7.prev = 17;
403
+ _context7.t1 = _context7["catch"](3);
404
+ return _context7.abrupt("return", "");
437
405
  case 20:
438
406
  case "end":
439
- return _context8.stop();
407
+ return _context7.stop();
440
408
  }
441
- }, _callee8, this, [[3, 17], [8, 12]]);
409
+ }, _callee7, this, [[3, 17], [8, 12]]);
442
410
  }));
443
- return function (_x8) {
444
- return _ref17.apply(this, arguments);
411
+ return function (_x7) {
412
+ return _ref15.apply(this, arguments);
445
413
  };
446
414
  }();
447
415
 
@@ -455,32 +423,32 @@ exports.ContractMetadata = /*#__PURE__*/function () {
455
423
  * @param {string} metadata
456
424
  */
457
425
  exports.MergeContractMetadata = /*#__PURE__*/function () {
458
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref18) {
426
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref16) {
459
427
  var contractAddress, metadataKey, metadata, existingMetadata;
460
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
461
- while (1) switch (_context9.prev = _context9.next) {
428
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
429
+ while (1) switch (_context8.prev = _context8.next) {
462
430
  case 0:
463
- contractAddress = _ref18.contractAddress, metadataKey = _ref18.metadataKey, metadata = _ref18.metadata;
431
+ contractAddress = _ref16.contractAddress, metadataKey = _ref16.metadataKey, metadata = _ref16.metadata;
464
432
  ValidatePresence("contractAddress", contractAddress);
465
433
  ValidatePresence("metadataKey", metadataKey);
466
- _context9.next = 5;
434
+ _context8.next = 5;
467
435
  return this.ContractMetadata({
468
436
  contractAddress: contractAddress,
469
437
  metadataKey: metadataKey
470
438
  });
471
439
  case 5:
472
- _context9.t0 = _context9.sent;
473
- if (_context9.t0) {
474
- _context9.next = 8;
440
+ _context8.t0 = _context8.sent;
441
+ if (_context8.t0) {
442
+ _context8.next = 8;
475
443
  break;
476
444
  }
477
- _context9.t0 = {};
445
+ _context8.t0 = {};
478
446
  case 8:
479
- existingMetadata = _context9.t0;
447
+ existingMetadata = _context8.t0;
480
448
  if (_typeof(existingMetadata) === "object") {
481
449
  metadata = _objectSpread(_objectSpread({}, existingMetadata), metadata);
482
450
  }
483
- _context9.next = 12;
451
+ _context8.next = 12;
484
452
  return this.CallContractMethodAndWait({
485
453
  contractAddress: contractAddress,
486
454
  methodName: "putMeta",
@@ -488,12 +456,12 @@ exports.MergeContractMetadata = /*#__PURE__*/function () {
488
456
  });
489
457
  case 12:
490
458
  case "end":
491
- return _context9.stop();
459
+ return _context8.stop();
492
460
  }
493
- }, _callee9, this);
461
+ }, _callee8, this);
494
462
  }));
495
- return function (_x9) {
496
- return _ref19.apply(this, arguments);
463
+ return function (_x8) {
464
+ return _ref17.apply(this, arguments);
497
465
  };
498
466
  }();
499
467
 
@@ -507,15 +475,15 @@ exports.MergeContractMetadata = /*#__PURE__*/function () {
507
475
  * @param {string|Object} metadata - The metadata to insert
508
476
  */
509
477
  exports.ReplaceContractMetadata = /*#__PURE__*/function () {
510
- var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref20) {
478
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref18) {
511
479
  var contractAddress, metadataKey, metadata;
512
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
513
- while (1) switch (_context10.prev = _context10.next) {
480
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
481
+ while (1) switch (_context9.prev = _context9.next) {
514
482
  case 0:
515
- contractAddress = _ref20.contractAddress, metadataKey = _ref20.metadataKey, metadata = _ref20.metadata;
483
+ contractAddress = _ref18.contractAddress, metadataKey = _ref18.metadataKey, metadata = _ref18.metadata;
516
484
  ValidatePresence("contractAddress", contractAddress);
517
485
  ValidatePresence("metadataKey", metadataKey);
518
- _context10.next = 5;
486
+ _context9.next = 5;
519
487
  return this.CallContractMethodAndWait({
520
488
  contractAddress: contractAddress,
521
489
  methodName: "putMeta",
@@ -523,12 +491,12 @@ exports.ReplaceContractMetadata = /*#__PURE__*/function () {
523
491
  });
524
492
  case 5:
525
493
  case "end":
526
- return _context10.stop();
494
+ return _context9.stop();
527
495
  }
528
- }, _callee10, this);
496
+ }, _callee9, this);
529
497
  }));
530
- return function (_x10) {
531
- return _ref21.apply(this, arguments);
498
+ return function (_x9) {
499
+ return _ref19.apply(this, arguments);
532
500
  };
533
501
  }();
534
502
 
@@ -544,12 +512,12 @@ exports.ReplaceContractMetadata = /*#__PURE__*/function () {
544
512
  * @returns {Promise<string> | undefined} - If the object has a custom contract, this will return the address of the custom contract
545
513
  */
546
514
  exports.CustomContractAddress = /*#__PURE__*/function () {
547
- var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref22) {
515
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref20) {
548
516
  var libraryId, objectId, versionHash, abi, customContractAddress;
549
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
550
- while (1) switch (_context11.prev = _context11.next) {
517
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
518
+ while (1) switch (_context10.prev = _context10.next) {
551
519
  case 0:
552
- libraryId = _ref22.libraryId, objectId = _ref22.objectId, versionHash = _ref22.versionHash;
520
+ libraryId = _ref20.libraryId, objectId = _ref20.objectId, versionHash = _ref20.versionHash;
553
521
  ValidateParameters({
554
522
  libraryId: libraryId,
555
523
  objectId: objectId,
@@ -559,19 +527,19 @@ exports.CustomContractAddress = /*#__PURE__*/function () {
559
527
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
560
528
  }
561
529
  if (!(libraryId === this.contentSpaceLibraryId || this.utils.EqualHash(libraryId, objectId))) {
562
- _context11.next = 5;
530
+ _context10.next = 5;
563
531
  break;
564
532
  }
565
- return _context11.abrupt("return");
533
+ return _context10.abrupt("return");
566
534
  case 5:
567
535
  this.Log("Retrieving custom contract address: ".concat(objectId));
568
- _context11.next = 8;
536
+ _context10.next = 8;
569
537
  return this.ContractAbi({
570
538
  id: objectId
571
539
  });
572
540
  case 8:
573
- abi = _context11.sent;
574
- _context11.next = 11;
541
+ abi = _context10.sent;
542
+ _context10.next = 11;
575
543
  return this.ethClient.CallContractMethod({
576
544
  contractAddress: this.utils.HashToAddress(objectId),
577
545
  abi: abi,
@@ -579,22 +547,22 @@ exports.CustomContractAddress = /*#__PURE__*/function () {
579
547
  methodArgs: []
580
548
  });
581
549
  case 11:
582
- customContractAddress = _context11.sent;
550
+ customContractAddress = _context10.sent;
583
551
  if (!(customContractAddress === this.utils.nullAddress)) {
584
- _context11.next = 14;
552
+ _context10.next = 14;
585
553
  break;
586
554
  }
587
- return _context11.abrupt("return");
555
+ return _context10.abrupt("return");
588
556
  case 14:
589
- return _context11.abrupt("return", this.utils.FormatAddress(customContractAddress));
557
+ return _context10.abrupt("return", this.utils.FormatAddress(customContractAddress));
590
558
  case 15:
591
559
  case "end":
592
- return _context11.stop();
560
+ return _context10.stop();
593
561
  }
594
- }, _callee11, this);
562
+ }, _callee10, this);
595
563
  }));
596
- return function (_x11) {
597
- return _ref23.apply(this, arguments);
564
+ return function (_x10) {
565
+ return _ref21.apply(this, arguments);
598
566
  };
599
567
  }();
600
568
 
@@ -617,12 +585,12 @@ exports.CustomContractAddress = /*#__PURE__*/function () {
617
585
  * @returns {Promise<Object>} - Result transaction of calling the setCustomContract method on the content object contract
618
586
  */
619
587
  exports.SetCustomContentContract = /*#__PURE__*/function () {
620
- var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref24) {
621
- var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref24$overrides, overrides, setResult, writeToken;
622
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
623
- while (1) switch (_context12.prev = _context12.next) {
588
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref22) {
589
+ var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref22$overrides, overrides, setResult, writeToken;
590
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
591
+ while (1) switch (_context11.prev = _context11.next) {
624
592
  case 0:
625
- libraryId = _ref24.libraryId, objectId = _ref24.objectId, customContractAddress = _ref24.customContractAddress, name = _ref24.name, description = _ref24.description, abi = _ref24.abi, factoryAbi = _ref24.factoryAbi, _ref24$overrides = _ref24.overrides, overrides = _ref24$overrides === void 0 ? {} : _ref24$overrides;
593
+ libraryId = _ref22.libraryId, objectId = _ref22.objectId, customContractAddress = _ref22.customContractAddress, name = _ref22.name, description = _ref22.description, abi = _ref22.abi, factoryAbi = _ref22.factoryAbi, _ref22$overrides = _ref22.overrides, overrides = _ref22$overrides === void 0 ? {} : _ref22$overrides;
626
594
  ValidateParameters({
627
595
  libraryId: libraryId,
628
596
  objectId: objectId
@@ -630,7 +598,7 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
630
598
  customContractAddress = ValidateAddress(customContractAddress);
631
599
  customContractAddress = this.utils.FormatAddress(customContractAddress);
632
600
  this.Log("Setting custom contract address: ".concat(objectId, " ").concat(customContractAddress));
633
- _context12.next = 7;
601
+ _context11.next = 7;
634
602
  return this.ethClient.SetCustomContentContract({
635
603
  contentContractAddress: this.utils.HashToAddress(objectId),
636
604
  customContractAddress: customContractAddress,
@@ -638,15 +606,15 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
638
606
  signer: this.signer
639
607
  });
640
608
  case 7:
641
- setResult = _context12.sent;
642
- _context12.next = 10;
609
+ setResult = _context11.sent;
610
+ _context11.next = 10;
643
611
  return this.EditContentObject({
644
612
  libraryId: libraryId,
645
613
  objectId: objectId
646
614
  });
647
615
  case 10:
648
- writeToken = _context12.sent.write_token;
649
- _context12.next = 13;
616
+ writeToken = _context11.sent.write_token;
617
+ _context11.next = 13;
650
618
  return this.ReplaceMetadata({
651
619
  libraryId: libraryId,
652
620
  objectId: objectId,
@@ -661,7 +629,7 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
661
629
  }
662
630
  });
663
631
  case 13:
664
- _context12.next = 15;
632
+ _context11.next = 15;
665
633
  return this.FinalizeContentObject({
666
634
  libraryId: libraryId,
667
635
  objectId: objectId,
@@ -669,15 +637,15 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
669
637
  commitMessage: "Set custom contract"
670
638
  });
671
639
  case 15:
672
- return _context12.abrupt("return", setResult);
640
+ return _context11.abrupt("return", setResult);
673
641
  case 16:
674
642
  case "end":
675
- return _context12.stop();
643
+ return _context11.stop();
676
644
  }
677
- }, _callee12, this);
645
+ }, _callee11, this);
678
646
  }));
679
- return function (_x12) {
680
- return _ref25.apply(this, arguments);
647
+ return function (_x11) {
648
+ return _ref23.apply(this, arguments);
681
649
  };
682
650
  }();
683
651
 
@@ -696,10 +664,10 @@ exports.SetCustomContentContract = /*#__PURE__*/function () {
696
664
  *
697
665
  * @returns {Promise<Object>} - The parsed event log from the event
698
666
  */
699
- exports.ExtractEventFromLogs = function (_ref26) {
700
- var abi = _ref26.abi,
701
- event = _ref26.event,
702
- eventName = _ref26.eventName;
667
+ exports.ExtractEventFromLogs = function (_ref24) {
668
+ var abi = _ref24.abi,
669
+ event = _ref24.event,
670
+ eventName = _ref24.eventName;
703
671
  return this.ethClient.ExtractEventFromLogs({
704
672
  abi: abi,
705
673
  event: event,
@@ -721,11 +689,11 @@ exports.ExtractEventFromLogs = function (_ref26) {
721
689
  *
722
690
  * @returns {Promise<string>} The value extracted from the event
723
691
  */
724
- exports.ExtractValueFromEvent = function (_ref27) {
725
- var abi = _ref27.abi,
726
- event = _ref27.event,
727
- eventName = _ref27.eventName,
728
- eventValue = _ref27.eventValue;
692
+ exports.ExtractValueFromEvent = function (_ref25) {
693
+ var abi = _ref25.abi,
694
+ event = _ref25.event,
695
+ eventName = _ref25.eventName,
696
+ eventValue = _ref25.eventValue;
729
697
  var eventLog = this.ethClient.ExtractEventFromLogs({
730
698
  abi: abi,
731
699
  event: event,
@@ -735,16 +703,16 @@ exports.ExtractValueFromEvent = function (_ref27) {
735
703
  return eventLog ? eventLog.args[eventValue] : undefined;
736
704
  };
737
705
  exports.FormatBlockNumbers = /*#__PURE__*/function () {
738
- var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref28) {
739
- var fromBlock, toBlock, _ref28$count, count, latestBlock;
740
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
741
- while (1) switch (_context13.prev = _context13.next) {
706
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref26) {
707
+ var fromBlock, toBlock, _ref26$count, count, latestBlock;
708
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
709
+ while (1) switch (_context12.prev = _context12.next) {
742
710
  case 0:
743
- fromBlock = _ref28.fromBlock, toBlock = _ref28.toBlock, _ref28$count = _ref28.count, count = _ref28$count === void 0 ? 10 : _ref28$count;
744
- _context13.next = 3;
711
+ fromBlock = _ref26.fromBlock, toBlock = _ref26.toBlock, _ref26$count = _ref26.count, count = _ref26$count === void 0 ? 10 : _ref26$count;
712
+ _context12.next = 3;
745
713
  return this.BlockNumber();
746
714
  case 3:
747
- latestBlock = _context13.sent;
715
+ latestBlock = _context12.sent;
748
716
  if (!toBlock) {
749
717
  if (!fromBlock) {
750
718
  toBlock = latestBlock;
@@ -763,18 +731,18 @@ exports.FormatBlockNumbers = /*#__PURE__*/function () {
763
731
  if (fromBlock < 0) {
764
732
  fromBlock = 0;
765
733
  }
766
- return _context13.abrupt("return", {
734
+ return _context12.abrupt("return", {
767
735
  fromBlock: fromBlock,
768
736
  toBlock: toBlock
769
737
  });
770
738
  case 8:
771
739
  case "end":
772
- return _context13.stop();
740
+ return _context12.stop();
773
741
  }
774
- }, _callee13, this);
742
+ }, _callee12, this);
775
743
  }));
776
- return function (_x13) {
777
- return _ref29.apply(this, arguments);
744
+ return function (_x12) {
745
+ return _ref27.apply(this, arguments);
778
746
  };
779
747
  }();
780
748
 
@@ -792,42 +760,42 @@ exports.FormatBlockNumbers = /*#__PURE__*/function () {
792
760
  * Note: This requires two extra network calls per transaction, so it should not be used for very large ranges
793
761
  * @returns {Promise<Array<Array<Object>>>} - List of blocks, in ascending order by block number, each containing a list of the events in the block.
794
762
  */
795
- exports.Events = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
796
- var _ref31,
763
+ exports.Events = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
764
+ var _ref29,
797
765
  toBlock,
798
766
  fromBlock,
799
- _ref31$count,
767
+ _ref29$count,
800
768
  count,
801
- _ref31$includeTransac,
769
+ _ref29$includeTransac,
802
770
  includeTransaction,
803
771
  blocks,
804
- _args14 = arguments;
805
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
806
- while (1) switch (_context14.prev = _context14.next) {
772
+ _args13 = arguments;
773
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
774
+ while (1) switch (_context13.prev = _context13.next) {
807
775
  case 0:
808
- _ref31 = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {}, toBlock = _ref31.toBlock, fromBlock = _ref31.fromBlock, _ref31$count = _ref31.count, count = _ref31$count === void 0 ? 10 : _ref31$count, _ref31$includeTransac = _ref31.includeTransaction, includeTransaction = _ref31$includeTransac === void 0 ? false : _ref31$includeTransac;
809
- _context14.next = 3;
776
+ _ref29 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, toBlock = _ref29.toBlock, fromBlock = _ref29.fromBlock, _ref29$count = _ref29.count, count = _ref29$count === void 0 ? 10 : _ref29$count, _ref29$includeTransac = _ref29.includeTransaction, includeTransaction = _ref29$includeTransac === void 0 ? false : _ref29$includeTransac;
777
+ _context13.next = 3;
810
778
  return this.FormatBlockNumbers({
811
779
  fromBlock: fromBlock,
812
780
  toBlock: toBlock,
813
781
  count: count
814
782
  });
815
783
  case 3:
816
- blocks = _context14.sent;
784
+ blocks = _context13.sent;
817
785
  this.Log("Querying events - Blocks ".concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
818
- _context14.next = 7;
786
+ _context13.next = 7;
819
787
  return this.ethClient.Events({
820
788
  fromBlock: blocks.fromBlock,
821
789
  toBlock: blocks.toBlock,
822
790
  includeTransaction: includeTransaction
823
791
  });
824
792
  case 7:
825
- return _context14.abrupt("return", _context14.sent);
793
+ return _context13.abrupt("return", _context13.sent);
826
794
  case 8:
827
795
  case "end":
828
- return _context14.stop();
796
+ return _context13.stop();
829
797
  }
830
- }, _callee14, this);
798
+ }, _callee13, this);
831
799
  }));
832
800
 
833
801
  /**
@@ -837,21 +805,21 @@ exports.Events = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntim
837
805
  *
838
806
  * @returns {Promise<number>} - The latest block number
839
807
  */
840
- exports.BlockNumber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
841
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
842
- while (1) switch (_context15.prev = _context15.next) {
808
+ exports.BlockNumber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
809
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
810
+ while (1) switch (_context14.prev = _context14.next) {
843
811
  case 0:
844
- _context15.next = 2;
812
+ _context14.next = 2;
845
813
  return this.ethClient.MakeProviderCall({
846
814
  methodName: "getBlockNumber"
847
815
  });
848
816
  case 2:
849
- return _context15.abrupt("return", _context15.sent);
817
+ return _context14.abrupt("return", _context14.sent);
850
818
  case 3:
851
819
  case "end":
852
- return _context15.stop();
820
+ return _context14.stop();
853
821
  }
854
- }, _callee15, this);
822
+ }, _callee14, this);
855
823
  }));
856
824
 
857
825
  /**
@@ -864,29 +832,29 @@ exports.BlockNumber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorR
864
832
  * @returns {Promise<string>} - Balance of the account, in ether (as string)
865
833
  */
866
834
  exports.GetBalance = /*#__PURE__*/function () {
867
- var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref33) {
835
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref31) {
868
836
  var address, balance;
869
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
870
- while (1) switch (_context16.prev = _context16.next) {
837
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
838
+ while (1) switch (_context15.prev = _context15.next) {
871
839
  case 0:
872
- address = _ref33.address;
840
+ address = _ref31.address;
873
841
  address = ValidateAddress(address);
874
- _context16.next = 4;
842
+ _context15.next = 4;
875
843
  return this.ethClient.MakeProviderCall({
876
844
  methodName: "getBalance",
877
845
  args: [address]
878
846
  });
879
847
  case 4:
880
- balance = _context16.sent;
881
- return _context16.abrupt("return", Ethers.utils.formatEther(balance));
848
+ balance = _context15.sent;
849
+ return _context15.abrupt("return", Ethers.utils.formatEther(balance));
882
850
  case 6:
883
851
  case "end":
884
- return _context16.stop();
852
+ return _context15.stop();
885
853
  }
886
- }, _callee16, this);
854
+ }, _callee15, this);
887
855
  }));
888
- return function (_x14) {
889
- return _ref34.apply(this, arguments);
856
+ return function (_x13) {
857
+ return _ref32.apply(this, arguments);
890
858
  };
891
859
  }();
892
860
 
@@ -901,31 +869,31 @@ exports.GetBalance = /*#__PURE__*/function () {
901
869
  * @returns {Promise<Object>} - The transaction receipt
902
870
  */
903
871
  exports.SendFunds = /*#__PURE__*/function () {
904
- var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref35) {
872
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref33) {
905
873
  var recipient, ether, transaction;
906
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
907
- while (1) switch (_context17.prev = _context17.next) {
874
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
875
+ while (1) switch (_context16.prev = _context16.next) {
908
876
  case 0:
909
- recipient = _ref35.recipient, ether = _ref35.ether;
877
+ recipient = _ref33.recipient, ether = _ref33.ether;
910
878
  recipient = ValidateAddress(recipient);
911
- _context17.next = 4;
879
+ _context16.next = 4;
912
880
  return this.signer.sendTransaction({
913
881
  to: recipient,
914
882
  value: Ethers.utils.parseEther(ether.toString())
915
883
  });
916
884
  case 4:
917
- transaction = _context17.sent;
918
- _context17.next = 7;
885
+ transaction = _context16.sent;
886
+ _context16.next = 7;
919
887
  return transaction.wait();
920
888
  case 7:
921
- return _context17.abrupt("return", _context17.sent);
889
+ return _context16.abrupt("return", _context16.sent);
922
890
  case 8:
923
891
  case "end":
924
- return _context17.stop();
892
+ return _context16.stop();
925
893
  }
926
- }, _callee17, this);
894
+ }, _callee16, this);
927
895
  }));
928
- return function (_x15) {
929
- return _ref36.apply(this, arguments);
896
+ return function (_x14) {
897
+ return _ref34.apply(this, arguments);
930
898
  };
931
899
  }();