@eluvio/elv-client-js 3.2.4 → 3.2.7

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 (46) 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 +1198 -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 +229 -184
  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/index.js +11 -0
  29. package/dist/src/marketplaceClient/ClientMethods.js +1918 -0
  30. package/dist/src/marketplaceClient/Configuration.js +29 -0
  31. package/dist/src/marketplaceClient/Utils.js +304 -0
  32. package/dist/src/marketplaceClient/index.js +1553 -0
  33. package/dist/src/walletClient/ClientMethods.js +2080 -0
  34. package/dist/src/walletClient/Configuration.js +29 -0
  35. package/dist/src/walletClient/Utils.js +304 -0
  36. package/dist/src/walletClient/index.js +1770 -0
  37. package/package.json +8 -4
  38. package/src/ElvClient.js +5 -2
  39. package/src/Utils.js +22 -4
  40. package/src/index.js +7 -0
  41. package/src/walletClient/ClientMethods.js +1111 -0
  42. package/src/walletClient/Configuration.js +40 -0
  43. package/src/walletClient/README.md +191 -0
  44. package/src/walletClient/Utils.js +234 -0
  45. package/src/walletClient/index.js +977 -0
  46. package/testScripts/TestMarketplaceClient.js +25 -0
@@ -4,9 +4,11 @@ var _typeof = require("@babel/runtime/helpers/typeof");
4
4
 
5
5
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
6
6
 
7
- 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; }
7
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
8
8
 
9
- 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; }
9
+ 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; }
10
+
11
+ 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; }
10
12
 
11
13
  /**
12
14
  * Methods for deploying and interacting with contracts
@@ -32,27 +34,33 @@ var _require = require("../Validation"),
32
34
  */
33
35
 
34
36
 
35
- exports.ContractName = function _callee(_ref) {
36
- var contractAddress;
37
- return _regeneratorRuntime.async(function _callee$(_context) {
38
- while (1) {
39
- switch (_context.prev = _context.next) {
40
- case 0:
41
- contractAddress = _ref.contractAddress;
42
- contractAddress = ValidateAddress(contractAddress);
43
- _context.next = 4;
44
- return _regeneratorRuntime.awrap(this.ethClient.ContractName(contractAddress));
45
-
46
- case 4:
47
- return _context.abrupt("return", _context.sent);
48
-
49
- case 5:
50
- case "end":
51
- return _context.stop();
37
+ exports.ContractName = /*#__PURE__*/function () {
38
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
39
+ var contractAddress;
40
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ while (1) {
42
+ switch (_context.prev = _context.next) {
43
+ case 0:
44
+ contractAddress = _ref.contractAddress;
45
+ contractAddress = ValidateAddress(contractAddress);
46
+ _context.next = 4;
47
+ return this.ethClient.ContractName(contractAddress);
48
+
49
+ case 4:
50
+ return _context.abrupt("return", _context.sent);
51
+
52
+ case 5:
53
+ case "end":
54
+ return _context.stop();
55
+ }
52
56
  }
53
- }
54
- }, null, this);
55
- };
57
+ }, _callee, this);
58
+ }));
59
+
60
+ return function (_x) {
61
+ return _ref2.apply(this, arguments);
62
+ };
63
+ }();
56
64
  /**
57
65
  * Retrieve the ABI for the given contract via its address or a Fabric ID. Contract must be a standard Eluvio contract
58
66
  *
@@ -67,39 +75,45 @@ exports.ContractName = function _callee(_ref) {
67
75
  */
68
76
 
69
77
 
70
- exports.ContractAbi = function _callee2(_ref2) {
71
- var contractAddress, id, contractInfo;
72
- return _regeneratorRuntime.async(function _callee2$(_context2) {
73
- while (1) {
74
- switch (_context2.prev = _context2.next) {
75
- case 0:
76
- contractAddress = _ref2.contractAddress, id = _ref2.id;
77
- _context2.next = 3;
78
- return _regeneratorRuntime.awrap(this.authClient.ContractInfo({
79
- address: contractAddress,
80
- id: id
81
- }));
82
-
83
- case 3:
84
- contractInfo = _context2.sent;
85
-
86
- if (contractInfo) {
87
- _context2.next = 6;
88
- break;
89
- }
78
+ exports.ContractAbi = /*#__PURE__*/function () {
79
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
80
+ var contractAddress, id, contractInfo;
81
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
82
+ while (1) {
83
+ switch (_context2.prev = _context2.next) {
84
+ case 0:
85
+ contractAddress = _ref3.contractAddress, id = _ref3.id;
86
+ _context2.next = 3;
87
+ return this.authClient.ContractInfo({
88
+ address: contractAddress,
89
+ id: id
90
+ });
91
+
92
+ case 3:
93
+ contractInfo = _context2.sent;
94
+
95
+ if (contractInfo) {
96
+ _context2.next = 6;
97
+ break;
98
+ }
90
99
 
91
- throw Error("Unable to determine contract info for ".concat(contractAddress));
100
+ throw Error("Unable to determine contract info for ".concat(contractAddress));
92
101
 
93
- case 6:
94
- return _context2.abrupt("return", contractInfo.abi);
102
+ case 6:
103
+ return _context2.abrupt("return", contractInfo.abi);
95
104
 
96
- case 7:
97
- case "end":
98
- return _context2.stop();
105
+ case 7:
106
+ case "end":
107
+ return _context2.stop();
108
+ }
99
109
  }
100
- }
101
- }, null, this);
102
- };
110
+ }, _callee2, this);
111
+ }));
112
+
113
+ return function (_x2) {
114
+ return _ref4.apply(this, arguments);
115
+ };
116
+ }();
103
117
  /**
104
118
  * Format the arguments to be used for the specified method of the contract
105
119
  *
@@ -113,10 +127,10 @@ exports.ContractAbi = function _callee2(_ref2) {
113
127
  */
114
128
 
115
129
 
116
- exports.FormatContractArguments = function (_ref3) {
117
- var abi = _ref3.abi,
118
- methodName = _ref3.methodName,
119
- args = _ref3.args;
130
+ exports.FormatContractArguments = function (_ref5) {
131
+ var abi = _ref5.abi,
132
+ methodName = _ref5.methodName,
133
+ args = _ref5.args;
120
134
  return this.ethClient.FormatContractArguments({
121
135
  abi: abi,
122
136
  methodName: methodName,
@@ -137,33 +151,39 @@ exports.FormatContractArguments = function (_ref3) {
137
151
  */
138
152
 
139
153
 
140
- exports.DeployContract = function _callee3(_ref4) {
141
- var abi, bytecode, constructorArgs, _ref4$overrides, overrides;
154
+ exports.DeployContract = /*#__PURE__*/function () {
155
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
156
+ var abi, bytecode, constructorArgs, _ref6$overrides, overrides;
142
157
 
143
- return _regeneratorRuntime.async(function _callee3$(_context3) {
144
- while (1) {
145
- switch (_context3.prev = _context3.next) {
146
- case 0:
147
- abi = _ref4.abi, bytecode = _ref4.bytecode, constructorArgs = _ref4.constructorArgs, _ref4$overrides = _ref4.overrides, overrides = _ref4$overrides === void 0 ? {} : _ref4$overrides;
148
- _context3.next = 3;
149
- return _regeneratorRuntime.awrap(this.ethClient.DeployContract({
150
- abi: abi,
151
- bytecode: bytecode,
152
- constructorArgs: constructorArgs,
153
- overrides: overrides,
154
- signer: this.signer
155
- }));
156
-
157
- case 3:
158
- return _context3.abrupt("return", _context3.sent);
159
-
160
- case 4:
161
- case "end":
162
- return _context3.stop();
158
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
159
+ while (1) {
160
+ switch (_context3.prev = _context3.next) {
161
+ case 0:
162
+ abi = _ref6.abi, bytecode = _ref6.bytecode, constructorArgs = _ref6.constructorArgs, _ref6$overrides = _ref6.overrides, overrides = _ref6$overrides === void 0 ? {} : _ref6$overrides;
163
+ _context3.next = 3;
164
+ return this.ethClient.DeployContract({
165
+ abi: abi,
166
+ bytecode: bytecode,
167
+ constructorArgs: constructorArgs,
168
+ overrides: overrides,
169
+ signer: this.signer
170
+ });
171
+
172
+ case 3:
173
+ return _context3.abrupt("return", _context3.sent);
174
+
175
+ case 4:
176
+ case "end":
177
+ return _context3.stop();
178
+ }
163
179
  }
164
- }
165
- }, null, this);
166
- };
180
+ }, _callee3, this);
181
+ }));
182
+
183
+ return function (_x3) {
184
+ return _ref7.apply(this, arguments);
185
+ };
186
+ }();
167
187
  /**
168
188
  * Get all events on the specified contract
169
189
  *
@@ -180,60 +200,66 @@ exports.DeployContract = function _callee3(_ref4) {
180
200
  */
181
201
 
182
202
 
183
- exports.ContractEvents = function _callee4(_ref5) {
184
- var contractAddress, abi, _ref5$fromBlock, fromBlock, toBlock, _ref5$count, count, topics, _ref5$includeTransact, includeTransaction, blocks;
203
+ exports.ContractEvents = /*#__PURE__*/function () {
204
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8) {
205
+ var contractAddress, abi, _ref8$fromBlock, fromBlock, toBlock, _ref8$count, count, topics, _ref8$includeTransact, includeTransaction, blocks;
185
206
 
186
- return _regeneratorRuntime.async(function _callee4$(_context4) {
187
- while (1) {
188
- switch (_context4.prev = _context4.next) {
189
- case 0:
190
- contractAddress = _ref5.contractAddress, abi = _ref5.abi, _ref5$fromBlock = _ref5.fromBlock, fromBlock = _ref5$fromBlock === void 0 ? 0 : _ref5$fromBlock, toBlock = _ref5.toBlock, _ref5$count = _ref5.count, count = _ref5$count === void 0 ? 1000 : _ref5$count, topics = _ref5.topics, _ref5$includeTransact = _ref5.includeTransaction, includeTransaction = _ref5$includeTransact === void 0 ? false : _ref5$includeTransact;
191
- contractAddress = ValidateAddress(contractAddress);
207
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
208
+ while (1) {
209
+ switch (_context4.prev = _context4.next) {
210
+ case 0:
211
+ 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;
212
+ contractAddress = ValidateAddress(contractAddress);
192
213
 
193
- if (abi) {
194
- _context4.next = 6;
195
- break;
196
- }
197
-
198
- _context4.next = 5;
199
- return _regeneratorRuntime.awrap(this.ContractAbi({
200
- contractAddress: contractAddress
201
- }));
202
-
203
- case 5:
204
- abi = _context4.sent;
205
-
206
- case 6:
207
- _context4.next = 8;
208
- return _regeneratorRuntime.awrap(this.FormatBlockNumbers({
209
- fromBlock: fromBlock,
210
- toBlock: toBlock,
211
- count: count
212
- }));
213
-
214
- case 8:
215
- blocks = _context4.sent;
216
- this.Log("Querying contract events ".concat(contractAddress, " - Blocks ").concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
217
- _context4.next = 12;
218
- return _regeneratorRuntime.awrap(this.ethClient.ContractEvents({
219
- contractAddress: contractAddress,
220
- abi: abi,
221
- fromBlock: blocks.fromBlock,
222
- toBlock: blocks.toBlock,
223
- topics: topics,
224
- includeTransaction: includeTransaction
225
- }));
226
-
227
- case 12:
228
- return _context4.abrupt("return", _context4.sent);
214
+ if (abi) {
215
+ _context4.next = 6;
216
+ break;
217
+ }
229
218
 
230
- case 13:
231
- case "end":
232
- return _context4.stop();
219
+ _context4.next = 5;
220
+ return this.ContractAbi({
221
+ contractAddress: contractAddress
222
+ });
223
+
224
+ case 5:
225
+ abi = _context4.sent;
226
+
227
+ case 6:
228
+ _context4.next = 8;
229
+ return this.FormatBlockNumbers({
230
+ fromBlock: fromBlock,
231
+ toBlock: toBlock,
232
+ count: count
233
+ });
234
+
235
+ case 8:
236
+ blocks = _context4.sent;
237
+ this.Log("Querying contract events ".concat(contractAddress, " - Blocks ").concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
238
+ _context4.next = 12;
239
+ return this.ethClient.ContractEvents({
240
+ contractAddress: contractAddress,
241
+ abi: abi,
242
+ fromBlock: blocks.fromBlock,
243
+ toBlock: blocks.toBlock,
244
+ topics: topics,
245
+ includeTransaction: includeTransaction
246
+ });
247
+
248
+ case 12:
249
+ return _context4.abrupt("return", _context4.sent);
250
+
251
+ case 13:
252
+ case "end":
253
+ return _context4.stop();
254
+ }
233
255
  }
234
- }
235
- }, null, this);
236
- };
256
+ }, _callee4, this);
257
+ }));
258
+
259
+ return function (_x4) {
260
+ return _ref9.apply(this, arguments);
261
+ };
262
+ }();
237
263
  /**
238
264
  * Call the specified method on a deployed contract. This action will be performed by this client's signer.
239
265
  *
@@ -254,59 +280,65 @@ exports.ContractEvents = function _callee4(_ref5) {
254
280
  */
255
281
 
256
282
 
257
- exports.CallContractMethod = function _callee5(_ref6) {
258
- var contractAddress, abi, methodName, _ref6$methodArgs, methodArgs, value, _ref6$overrides, overrides, _ref6$formatArguments, formatArguments, _ref6$cacheContract, cacheContract, _ref6$overrideCachedC, overrideCachedContract;
283
+ exports.CallContractMethod = /*#__PURE__*/function () {
284
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref10) {
285
+ var contractAddress, abi, methodName, _ref10$methodArgs, methodArgs, value, _ref10$overrides, overrides, _ref10$formatArgument, formatArguments, _ref10$cacheContract, cacheContract, _ref10$overrideCached, overrideCachedContract;
259
286
 
260
- return _regeneratorRuntime.async(function _callee5$(_context5) {
261
- while (1) {
262
- switch (_context5.prev = _context5.next) {
263
- case 0:
264
- contractAddress = _ref6.contractAddress, abi = _ref6.abi, methodName = _ref6.methodName, _ref6$methodArgs = _ref6.methodArgs, methodArgs = _ref6$methodArgs === void 0 ? [] : _ref6$methodArgs, value = _ref6.value, _ref6$overrides = _ref6.overrides, overrides = _ref6$overrides === void 0 ? {} : _ref6$overrides, _ref6$formatArguments = _ref6.formatArguments, formatArguments = _ref6$formatArguments === void 0 ? true : _ref6$formatArguments, _ref6$cacheContract = _ref6.cacheContract, cacheContract = _ref6$cacheContract === void 0 ? true : _ref6$cacheContract, _ref6$overrideCachedC = _ref6.overrideCachedContract, overrideCachedContract = _ref6$overrideCachedC === void 0 ? false : _ref6$overrideCachedC;
265
- contractAddress = ValidateAddress(contractAddress); // Delete cached visibility value if it is being changed
287
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
288
+ while (1) {
289
+ switch (_context5.prev = _context5.next) {
290
+ case 0:
291
+ 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;
292
+ contractAddress = ValidateAddress(contractAddress); // Delete cached visibility value if it is being changed
266
293
 
267
- contractAddress = this.utils.FormatAddress(contractAddress);
294
+ contractAddress = this.utils.FormatAddress(contractAddress);
268
295
 
269
- if (methodName === "setVisibility" && this.visibilityInfo[contractAddress]) {
270
- delete this.visibilityInfo[contractAddress];
271
- }
296
+ if (methodName === "setVisibility" && this.visibilityInfo[contractAddress]) {
297
+ delete this.visibilityInfo[contractAddress];
298
+ }
272
299
 
273
- if (abi) {
274
- _context5.next = 8;
275
- break;
276
- }
300
+ if (abi) {
301
+ _context5.next = 8;
302
+ break;
303
+ }
277
304
 
278
- _context5.next = 7;
279
- return _regeneratorRuntime.awrap(this.ContractAbi({
280
- contractAddress: contractAddress
281
- }));
305
+ _context5.next = 7;
306
+ return this.ContractAbi({
307
+ contractAddress: contractAddress
308
+ });
282
309
 
283
- case 7:
284
- abi = _context5.sent;
310
+ case 7:
311
+ abi = _context5.sent;
285
312
 
286
- case 8:
287
- _context5.next = 10;
288
- return _regeneratorRuntime.awrap(this.ethClient.CallContractMethod({
289
- contractAddress: contractAddress,
290
- abi: abi,
291
- methodName: methodName,
292
- methodArgs: methodArgs,
293
- value: value,
294
- overrides: overrides,
295
- formatArguments: formatArguments,
296
- cacheContract: cacheContract,
297
- overrideCachedContract: overrideCachedContract
298
- }));
299
-
300
- case 10:
301
- return _context5.abrupt("return", _context5.sent);
302
-
303
- case 11:
304
- case "end":
305
- return _context5.stop();
313
+ case 8:
314
+ _context5.next = 10;
315
+ return this.ethClient.CallContractMethod({
316
+ contractAddress: contractAddress,
317
+ abi: abi,
318
+ methodName: methodName,
319
+ methodArgs: methodArgs,
320
+ value: value,
321
+ overrides: overrides,
322
+ formatArguments: formatArguments,
323
+ cacheContract: cacheContract,
324
+ overrideCachedContract: overrideCachedContract
325
+ });
326
+
327
+ case 10:
328
+ return _context5.abrupt("return", _context5.sent);
329
+
330
+ case 11:
331
+ case "end":
332
+ return _context5.stop();
333
+ }
306
334
  }
307
- }
308
- }, null, this);
309
- };
335
+ }, _callee5, this);
336
+ }));
337
+
338
+ return function (_x5) {
339
+ return _ref11.apply(this, arguments);
340
+ };
341
+ }();
310
342
  /**
311
343
  * Call the specified method on a deployed contract and wait for the transaction to be mined.
312
344
  * This action will be performed by this client's signer.
@@ -330,59 +362,65 @@ exports.CallContractMethod = function _callee5(_ref6) {
330
362
  */
331
363
 
332
364
 
333
- exports.CallContractMethodAndWait = function _callee6(_ref7) {
334
- var contractAddress, abi, methodName, methodArgs, value, _ref7$overrides, overrides, _ref7$formatArguments, formatArguments, _ref7$cacheContract, cacheContract, _ref7$overrideCachedC, overrideCachedContract;
365
+ exports.CallContractMethodAndWait = /*#__PURE__*/function () {
366
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref12) {
367
+ var contractAddress, abi, methodName, methodArgs, value, _ref12$overrides, overrides, _ref12$formatArgument, formatArguments, _ref12$cacheContract, cacheContract, _ref12$overrideCached, overrideCachedContract;
335
368
 
336
- return _regeneratorRuntime.async(function _callee6$(_context6) {
337
- while (1) {
338
- switch (_context6.prev = _context6.next) {
339
- case 0:
340
- contractAddress = _ref7.contractAddress, abi = _ref7.abi, methodName = _ref7.methodName, methodArgs = _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;
341
- contractAddress = ValidateAddress(contractAddress); // Delete cached visibility value if it is being changed
369
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
370
+ while (1) {
371
+ switch (_context6.prev = _context6.next) {
372
+ case 0:
373
+ 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;
374
+ contractAddress = ValidateAddress(contractAddress); // Delete cached visibility value if it is being changed
342
375
 
343
- contractAddress = this.utils.FormatAddress(contractAddress);
376
+ contractAddress = this.utils.FormatAddress(contractAddress);
344
377
 
345
- if (methodName === "setVisibility" && this.visibilityInfo[contractAddress]) {
346
- delete this.visibilityInfo[contractAddress];
347
- }
378
+ if (methodName === "setVisibility" && this.visibilityInfo[contractAddress]) {
379
+ delete this.visibilityInfo[contractAddress];
380
+ }
348
381
 
349
- if (abi) {
350
- _context6.next = 8;
351
- break;
352
- }
382
+ if (abi) {
383
+ _context6.next = 8;
384
+ break;
385
+ }
353
386
 
354
- _context6.next = 7;
355
- return _regeneratorRuntime.awrap(this.ContractAbi({
356
- contractAddress: contractAddress
357
- }));
387
+ _context6.next = 7;
388
+ return this.ContractAbi({
389
+ contractAddress: contractAddress
390
+ });
358
391
 
359
- case 7:
360
- abi = _context6.sent;
392
+ case 7:
393
+ abi = _context6.sent;
361
394
 
362
- case 8:
363
- _context6.next = 10;
364
- return _regeneratorRuntime.awrap(this.ethClient.CallContractMethodAndWait({
365
- contractAddress: contractAddress,
366
- abi: abi,
367
- methodName: methodName,
368
- methodArgs: methodArgs,
369
- value: value,
370
- overrides: overrides,
371
- formatArguments: formatArguments,
372
- cacheContract: cacheContract,
373
- overrideCachedContract: overrideCachedContract
374
- }));
375
-
376
- case 10:
377
- return _context6.abrupt("return", _context6.sent);
378
-
379
- case 11:
380
- case "end":
381
- return _context6.stop();
395
+ case 8:
396
+ _context6.next = 10;
397
+ return this.ethClient.CallContractMethodAndWait({
398
+ contractAddress: contractAddress,
399
+ abi: abi,
400
+ methodName: methodName,
401
+ methodArgs: methodArgs,
402
+ value: value,
403
+ overrides: overrides,
404
+ formatArguments: formatArguments,
405
+ cacheContract: cacheContract,
406
+ overrideCachedContract: overrideCachedContract
407
+ });
408
+
409
+ case 10:
410
+ return _context6.abrupt("return", _context6.sent);
411
+
412
+ case 11:
413
+ case "end":
414
+ return _context6.stop();
415
+ }
382
416
  }
383
- }
384
- }, null, this);
385
- };
417
+ }, _callee6, this);
418
+ }));
419
+
420
+ return function (_x6) {
421
+ return _ref13.apply(this, arguments);
422
+ };
423
+ }();
386
424
  /**
387
425
  * Retrieve metadata from the specified contract
388
426
  *
@@ -395,50 +433,56 @@ exports.CallContractMethodAndWait = function _callee6(_ref7) {
395
433
  */
396
434
 
397
435
 
398
- exports.ContractMetadata = function _callee7(_ref8) {
399
- var contractAddress, metadataKey, metadata, data;
400
- return _regeneratorRuntime.async(function _callee7$(_context7) {
401
- while (1) {
402
- switch (_context7.prev = _context7.next) {
403
- case 0:
404
- contractAddress = _ref8.contractAddress, metadataKey = _ref8.metadataKey;
405
- ValidatePresence("contractAddress", contractAddress);
406
- ValidatePresence("metadataKey", metadataKey);
407
- _context7.prev = 3;
408
- _context7.next = 6;
409
- return _regeneratorRuntime.awrap(this.CallContractMethod({
410
- contractAddress: contractAddress,
411
- methodName: "getMeta",
412
- methodArgs: [metadataKey]
413
- }));
414
-
415
- case 6:
416
- metadata = _context7.sent;
417
- data = Buffer.from((metadata || "").replace("0x", ""), "hex").toString("utf-8");
418
- _context7.prev = 8;
419
- return _context7.abrupt("return", JSON.parse(data));
420
-
421
- case 12:
422
- _context7.prev = 12;
423
- _context7.t0 = _context7["catch"](8);
424
- return _context7.abrupt("return", data);
425
-
426
- case 15:
427
- _context7.next = 20;
428
- break;
429
-
430
- case 17:
431
- _context7.prev = 17;
432
- _context7.t1 = _context7["catch"](3);
433
- return _context7.abrupt("return", "");
434
-
435
- case 20:
436
- case "end":
437
- return _context7.stop();
436
+ exports.ContractMetadata = /*#__PURE__*/function () {
437
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref14) {
438
+ var contractAddress, metadataKey, metadata, data;
439
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
440
+ while (1) {
441
+ switch (_context7.prev = _context7.next) {
442
+ case 0:
443
+ contractAddress = _ref14.contractAddress, metadataKey = _ref14.metadataKey;
444
+ ValidatePresence("contractAddress", contractAddress);
445
+ ValidatePresence("metadataKey", metadataKey);
446
+ _context7.prev = 3;
447
+ _context7.next = 6;
448
+ return this.CallContractMethod({
449
+ contractAddress: contractAddress,
450
+ methodName: "getMeta",
451
+ methodArgs: [metadataKey]
452
+ });
453
+
454
+ case 6:
455
+ metadata = _context7.sent;
456
+ data = Buffer.from((metadata || "").replace("0x", ""), "hex").toString("utf-8");
457
+ _context7.prev = 8;
458
+ return _context7.abrupt("return", JSON.parse(data));
459
+
460
+ case 12:
461
+ _context7.prev = 12;
462
+ _context7.t0 = _context7["catch"](8);
463
+ return _context7.abrupt("return", data);
464
+
465
+ case 15:
466
+ _context7.next = 20;
467
+ break;
468
+
469
+ case 17:
470
+ _context7.prev = 17;
471
+ _context7.t1 = _context7["catch"](3);
472
+ return _context7.abrupt("return", "");
473
+
474
+ case 20:
475
+ case "end":
476
+ return _context7.stop();
477
+ }
438
478
  }
439
- }
440
- }, null, this, [[3, 17], [8, 12]]);
441
- };
479
+ }, _callee7, this, [[3, 17], [8, 12]]);
480
+ }));
481
+
482
+ return function (_x7) {
483
+ return _ref15.apply(this, arguments);
484
+ };
485
+ }();
442
486
  /**
443
487
  * Merge contract metadata at the specified key.
444
488
  *
@@ -450,52 +494,58 @@ exports.ContractMetadata = function _callee7(_ref8) {
450
494
  */
451
495
 
452
496
 
453
- exports.MergeContractMetadata = function _callee8(_ref9) {
454
- var contractAddress, metadataKey, metadata, existingMetadata;
455
- return _regeneratorRuntime.async(function _callee8$(_context8) {
456
- while (1) {
457
- switch (_context8.prev = _context8.next) {
458
- case 0:
459
- contractAddress = _ref9.contractAddress, metadataKey = _ref9.metadataKey, metadata = _ref9.metadata;
460
- ValidatePresence("contractAddress", contractAddress);
461
- ValidatePresence("metadataKey", metadataKey);
462
- _context8.next = 5;
463
- return _regeneratorRuntime.awrap(this.ContractMetadata({
464
- contractAddress: contractAddress,
465
- metadataKey: metadataKey
466
- }));
467
-
468
- case 5:
469
- _context8.t0 = _context8.sent;
470
-
471
- if (_context8.t0) {
472
- _context8.next = 8;
473
- break;
474
- }
475
-
476
- _context8.t0 = {};
497
+ exports.MergeContractMetadata = /*#__PURE__*/function () {
498
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref16) {
499
+ var contractAddress, metadataKey, metadata, existingMetadata;
500
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
501
+ while (1) {
502
+ switch (_context8.prev = _context8.next) {
503
+ case 0:
504
+ contractAddress = _ref16.contractAddress, metadataKey = _ref16.metadataKey, metadata = _ref16.metadata;
505
+ ValidatePresence("contractAddress", contractAddress);
506
+ ValidatePresence("metadataKey", metadataKey);
507
+ _context8.next = 5;
508
+ return this.ContractMetadata({
509
+ contractAddress: contractAddress,
510
+ metadataKey: metadataKey
511
+ });
512
+
513
+ case 5:
514
+ _context8.t0 = _context8.sent;
515
+
516
+ if (_context8.t0) {
517
+ _context8.next = 8;
518
+ break;
519
+ }
477
520
 
478
- case 8:
479
- existingMetadata = _context8.t0;
521
+ _context8.t0 = {};
480
522
 
481
- if (_typeof(existingMetadata) === "object") {
482
- metadata = _objectSpread({}, existingMetadata, {}, metadata);
483
- }
523
+ case 8:
524
+ existingMetadata = _context8.t0;
484
525
 
485
- _context8.next = 12;
486
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
487
- contractAddress: contractAddress,
488
- methodName: "putMeta",
489
- methodArgs: [metadataKey, JSON.stringify(metadata)]
490
- }));
526
+ if (_typeof(existingMetadata) === "object") {
527
+ metadata = _objectSpread(_objectSpread({}, existingMetadata), metadata);
528
+ }
491
529
 
492
- case 12:
493
- case "end":
494
- return _context8.stop();
530
+ _context8.next = 12;
531
+ return this.CallContractMethodAndWait({
532
+ contractAddress: contractAddress,
533
+ methodName: "putMeta",
534
+ methodArgs: [metadataKey, JSON.stringify(metadata)]
535
+ });
536
+
537
+ case 12:
538
+ case "end":
539
+ return _context8.stop();
540
+ }
495
541
  }
496
- }
497
- }, null, this);
498
- };
542
+ }, _callee8, this);
543
+ }));
544
+
545
+ return function (_x8) {
546
+ return _ref17.apply(this, arguments);
547
+ };
548
+ }();
499
549
  /**
500
550
  * Replace the contract metadata at the specified key
501
551
  *
@@ -507,29 +557,35 @@ exports.MergeContractMetadata = function _callee8(_ref9) {
507
557
  */
508
558
 
509
559
 
510
- exports.ReplaceContractMetadata = function _callee9(_ref10) {
511
- var contractAddress, metadataKey, metadata;
512
- return _regeneratorRuntime.async(function _callee9$(_context9) {
513
- while (1) {
514
- switch (_context9.prev = _context9.next) {
515
- case 0:
516
- contractAddress = _ref10.contractAddress, metadataKey = _ref10.metadataKey, metadata = _ref10.metadata;
517
- ValidatePresence("contractAddress", contractAddress);
518
- ValidatePresence("metadataKey", metadataKey);
519
- _context9.next = 5;
520
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
521
- contractAddress: contractAddress,
522
- methodName: "putMeta",
523
- methodArgs: [metadataKey, JSON.stringify(metadata)]
524
- }));
525
-
526
- case 5:
527
- case "end":
528
- return _context9.stop();
560
+ exports.ReplaceContractMetadata = /*#__PURE__*/function () {
561
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref18) {
562
+ var contractAddress, metadataKey, metadata;
563
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
564
+ while (1) {
565
+ switch (_context9.prev = _context9.next) {
566
+ case 0:
567
+ contractAddress = _ref18.contractAddress, metadataKey = _ref18.metadataKey, metadata = _ref18.metadata;
568
+ ValidatePresence("contractAddress", contractAddress);
569
+ ValidatePresence("metadataKey", metadataKey);
570
+ _context9.next = 5;
571
+ return this.CallContractMethodAndWait({
572
+ contractAddress: contractAddress,
573
+ methodName: "putMeta",
574
+ methodArgs: [metadataKey, JSON.stringify(metadata)]
575
+ });
576
+
577
+ case 5:
578
+ case "end":
579
+ return _context9.stop();
580
+ }
529
581
  }
530
- }
531
- }, null, this);
532
- };
582
+ }, _callee9, this);
583
+ }));
584
+
585
+ return function (_x9) {
586
+ return _ref19.apply(this, arguments);
587
+ };
588
+ }();
533
589
  /**
534
590
  * Get the custom contract of the specified object
535
591
  *
@@ -543,67 +599,73 @@ exports.ReplaceContractMetadata = function _callee9(_ref10) {
543
599
  */
544
600
 
545
601
 
546
- exports.CustomContractAddress = function _callee10(_ref11) {
547
- var libraryId, objectId, versionHash, abi, customContractAddress;
548
- return _regeneratorRuntime.async(function _callee10$(_context10) {
549
- while (1) {
550
- switch (_context10.prev = _context10.next) {
551
- case 0:
552
- libraryId = _ref11.libraryId, objectId = _ref11.objectId, versionHash = _ref11.versionHash;
553
- ValidateParameters({
554
- libraryId: libraryId,
555
- objectId: objectId,
556
- versionHash: versionHash
557
- });
602
+ exports.CustomContractAddress = /*#__PURE__*/function () {
603
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref20) {
604
+ var libraryId, objectId, versionHash, abi, customContractAddress;
605
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
606
+ while (1) {
607
+ switch (_context10.prev = _context10.next) {
608
+ case 0:
609
+ libraryId = _ref20.libraryId, objectId = _ref20.objectId, versionHash = _ref20.versionHash;
610
+ ValidateParameters({
611
+ libraryId: libraryId,
612
+ objectId: objectId,
613
+ versionHash: versionHash
614
+ });
615
+
616
+ if (versionHash) {
617
+ objectId = this.utils.DecodeVersionHash(versionHash).objectId;
618
+ }
558
619
 
559
- if (versionHash) {
560
- objectId = this.utils.DecodeVersionHash(versionHash).objectId;
561
- }
620
+ if (!(libraryId === this.contentSpaceLibraryId || this.utils.EqualHash(libraryId, objectId))) {
621
+ _context10.next = 5;
622
+ break;
623
+ }
562
624
 
563
- if (!(libraryId === this.contentSpaceLibraryId || this.utils.EqualHash(libraryId, objectId))) {
564
- _context10.next = 5;
565
- break;
566
- }
625
+ return _context10.abrupt("return");
567
626
 
568
- return _context10.abrupt("return");
627
+ case 5:
628
+ this.Log("Retrieving custom contract address: ".concat(objectId));
629
+ _context10.next = 8;
630
+ return this.ContractAbi({
631
+ id: objectId
632
+ });
569
633
 
570
- case 5:
571
- this.Log("Retrieving custom contract address: ".concat(objectId));
572
- _context10.next = 8;
573
- return _regeneratorRuntime.awrap(this.ContractAbi({
574
- id: objectId
575
- }));
634
+ case 8:
635
+ abi = _context10.sent;
636
+ _context10.next = 11;
637
+ return this.ethClient.CallContractMethod({
638
+ contractAddress: this.utils.HashToAddress(objectId),
639
+ abi: abi,
640
+ methodName: "contentContractAddress",
641
+ methodArgs: []
642
+ });
576
643
 
577
- case 8:
578
- abi = _context10.sent;
579
- _context10.next = 11;
580
- return _regeneratorRuntime.awrap(this.ethClient.CallContractMethod({
581
- contractAddress: this.utils.HashToAddress(objectId),
582
- abi: abi,
583
- methodName: "contentContractAddress",
584
- methodArgs: []
585
- }));
586
-
587
- case 11:
588
- customContractAddress = _context10.sent;
589
-
590
- if (!(customContractAddress === this.utils.nullAddress)) {
591
- _context10.next = 14;
592
- break;
593
- }
644
+ case 11:
645
+ customContractAddress = _context10.sent;
594
646
 
595
- return _context10.abrupt("return");
647
+ if (!(customContractAddress === this.utils.nullAddress)) {
648
+ _context10.next = 14;
649
+ break;
650
+ }
596
651
 
597
- case 14:
598
- return _context10.abrupt("return", this.utils.FormatAddress(customContractAddress));
652
+ return _context10.abrupt("return");
599
653
 
600
- case 15:
601
- case "end":
602
- return _context10.stop();
654
+ case 14:
655
+ return _context10.abrupt("return", this.utils.FormatAddress(customContractAddress));
656
+
657
+ case 15:
658
+ case "end":
659
+ return _context10.stop();
660
+ }
603
661
  }
604
- }
605
- }, null, this);
606
- };
662
+ }, _callee10, this);
663
+ }));
664
+
665
+ return function (_x10) {
666
+ return _ref21.apply(this, arguments);
667
+ };
668
+ }();
607
669
  /**
608
670
  * Set the custom contract of the specified object with the contract at the specified address
609
671
  *
@@ -624,73 +686,79 @@ exports.CustomContractAddress = function _callee10(_ref11) {
624
686
  */
625
687
 
626
688
 
627
- exports.SetCustomContentContract = function _callee11(_ref12) {
628
- var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref12$overrides, overrides, setResult, writeToken;
629
-
630
- return _regeneratorRuntime.async(function _callee11$(_context11) {
631
- while (1) {
632
- switch (_context11.prev = _context11.next) {
633
- case 0:
634
- libraryId = _ref12.libraryId, objectId = _ref12.objectId, customContractAddress = _ref12.customContractAddress, name = _ref12.name, description = _ref12.description, abi = _ref12.abi, factoryAbi = _ref12.factoryAbi, _ref12$overrides = _ref12.overrides, overrides = _ref12$overrides === void 0 ? {} : _ref12$overrides;
635
- ValidateParameters({
636
- libraryId: libraryId,
637
- objectId: objectId
638
- });
639
- customContractAddress = ValidateAddress(customContractAddress);
640
- customContractAddress = this.utils.FormatAddress(customContractAddress);
641
- this.Log("Setting custom contract address: ".concat(objectId, " ").concat(customContractAddress));
642
- _context11.next = 7;
643
- return _regeneratorRuntime.awrap(this.ethClient.SetCustomContentContract({
644
- contentContractAddress: this.utils.HashToAddress(objectId),
645
- customContractAddress: customContractAddress,
646
- overrides: overrides,
647
- signer: this.signer
648
- }));
649
-
650
- case 7:
651
- setResult = _context11.sent;
652
- _context11.next = 10;
653
- return _regeneratorRuntime.awrap(this.EditContentObject({
654
- libraryId: libraryId,
655
- objectId: objectId
656
- }));
657
-
658
- case 10:
659
- writeToken = _context11.sent.write_token;
660
- _context11.next = 13;
661
- return _regeneratorRuntime.awrap(this.ReplaceMetadata({
662
- libraryId: libraryId,
663
- objectId: objectId,
664
- writeToken: writeToken,
665
- metadataSubtree: "custom_contract",
666
- metadata: {
667
- name: name,
668
- description: description,
669
- address: customContractAddress,
670
- abi: abi,
671
- factoryAbi: factoryAbi
672
- }
673
- }));
674
-
675
- case 13:
676
- _context11.next = 15;
677
- return _regeneratorRuntime.awrap(this.FinalizeContentObject({
678
- libraryId: libraryId,
679
- objectId: objectId,
680
- writeToken: writeToken,
681
- commitMessage: "Set custom contract"
682
- }));
683
-
684
- case 15:
685
- return _context11.abrupt("return", setResult);
686
-
687
- case 16:
688
- case "end":
689
- return _context11.stop();
689
+ exports.SetCustomContentContract = /*#__PURE__*/function () {
690
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref22) {
691
+ var libraryId, objectId, customContractAddress, name, description, abi, factoryAbi, _ref22$overrides, overrides, setResult, writeToken;
692
+
693
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
694
+ while (1) {
695
+ switch (_context11.prev = _context11.next) {
696
+ case 0:
697
+ 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;
698
+ ValidateParameters({
699
+ libraryId: libraryId,
700
+ objectId: objectId
701
+ });
702
+ customContractAddress = ValidateAddress(customContractAddress);
703
+ customContractAddress = this.utils.FormatAddress(customContractAddress);
704
+ this.Log("Setting custom contract address: ".concat(objectId, " ").concat(customContractAddress));
705
+ _context11.next = 7;
706
+ return this.ethClient.SetCustomContentContract({
707
+ contentContractAddress: this.utils.HashToAddress(objectId),
708
+ customContractAddress: customContractAddress,
709
+ overrides: overrides,
710
+ signer: this.signer
711
+ });
712
+
713
+ case 7:
714
+ setResult = _context11.sent;
715
+ _context11.next = 10;
716
+ return this.EditContentObject({
717
+ libraryId: libraryId,
718
+ objectId: objectId
719
+ });
720
+
721
+ case 10:
722
+ writeToken = _context11.sent.write_token;
723
+ _context11.next = 13;
724
+ return this.ReplaceMetadata({
725
+ libraryId: libraryId,
726
+ objectId: objectId,
727
+ writeToken: writeToken,
728
+ metadataSubtree: "custom_contract",
729
+ metadata: {
730
+ name: name,
731
+ description: description,
732
+ address: customContractAddress,
733
+ abi: abi,
734
+ factoryAbi: factoryAbi
735
+ }
736
+ });
737
+
738
+ case 13:
739
+ _context11.next = 15;
740
+ return this.FinalizeContentObject({
741
+ libraryId: libraryId,
742
+ objectId: objectId,
743
+ writeToken: writeToken,
744
+ commitMessage: "Set custom contract"
745
+ });
746
+
747
+ case 15:
748
+ return _context11.abrupt("return", setResult);
749
+
750
+ case 16:
751
+ case "end":
752
+ return _context11.stop();
753
+ }
690
754
  }
691
- }
692
- }, null, this);
693
- };
755
+ }, _callee11, this);
756
+ }));
757
+
758
+ return function (_x11) {
759
+ return _ref23.apply(this, arguments);
760
+ };
761
+ }();
694
762
  /**
695
763
  * Extract the specified event log from the given event obtained from the
696
764
  * CallContractAndMethodAndWait method
@@ -708,10 +776,10 @@ exports.SetCustomContentContract = function _callee11(_ref12) {
708
776
  */
709
777
 
710
778
 
711
- exports.ExtractEventFromLogs = function (_ref13) {
712
- var abi = _ref13.abi,
713
- event = _ref13.event,
714
- eventName = _ref13.eventName;
779
+ exports.ExtractEventFromLogs = function (_ref24) {
780
+ var abi = _ref24.abi,
781
+ event = _ref24.event,
782
+ eventName = _ref24.eventName;
715
783
  return this.ethClient.ExtractEventFromLogs({
716
784
  abi: abi,
717
785
  event: event,
@@ -734,11 +802,11 @@ exports.ExtractEventFromLogs = function (_ref13) {
734
802
  */
735
803
 
736
804
 
737
- exports.ExtractValueFromEvent = function (_ref14) {
738
- var abi = _ref14.abi,
739
- event = _ref14.event,
740
- eventName = _ref14.eventName,
741
- eventValue = _ref14.eventValue;
805
+ exports.ExtractValueFromEvent = function (_ref25) {
806
+ var abi = _ref25.abi,
807
+ event = _ref25.event,
808
+ eventName = _ref25.eventName,
809
+ eventValue = _ref25.eventValue;
742
810
  var eventLog = this.ethClient.ExtractEventFromLogs({
743
811
  abi: abi,
744
812
  event: event,
@@ -748,52 +816,58 @@ exports.ExtractValueFromEvent = function (_ref14) {
748
816
  return eventLog ? eventLog.values[eventValue] : undefined;
749
817
  };
750
818
 
751
- exports.FormatBlockNumbers = function _callee12(_ref15) {
752
- var fromBlock, toBlock, _ref15$count, count, latestBlock;
753
-
754
- return _regeneratorRuntime.async(function _callee12$(_context12) {
755
- while (1) {
756
- switch (_context12.prev = _context12.next) {
757
- case 0:
758
- fromBlock = _ref15.fromBlock, toBlock = _ref15.toBlock, _ref15$count = _ref15.count, count = _ref15$count === void 0 ? 10 : _ref15$count;
759
- _context12.next = 3;
760
- return _regeneratorRuntime.awrap(this.BlockNumber());
819
+ exports.FormatBlockNumbers = /*#__PURE__*/function () {
820
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref26) {
821
+ var fromBlock, toBlock, _ref26$count, count, latestBlock;
822
+
823
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
824
+ while (1) {
825
+ switch (_context12.prev = _context12.next) {
826
+ case 0:
827
+ fromBlock = _ref26.fromBlock, toBlock = _ref26.toBlock, _ref26$count = _ref26.count, count = _ref26$count === void 0 ? 10 : _ref26$count;
828
+ _context12.next = 3;
829
+ return this.BlockNumber();
830
+
831
+ case 3:
832
+ latestBlock = _context12.sent;
833
+
834
+ if (!toBlock) {
835
+ if (!fromBlock) {
836
+ toBlock = latestBlock;
837
+ fromBlock = toBlock - count + 1;
838
+ } else {
839
+ toBlock = fromBlock + count - 1;
840
+ }
841
+ } else if (!fromBlock) {
842
+ fromBlock = toBlock - count + 1;
843
+ } // Ensure block numbers are valid
761
844
 
762
- case 3:
763
- latestBlock = _context12.sent;
764
845
 
765
- if (!toBlock) {
766
- if (!fromBlock) {
846
+ if (toBlock > latestBlock) {
767
847
  toBlock = latestBlock;
768
- fromBlock = toBlock - count + 1;
769
- } else {
770
- toBlock = fromBlock + count - 1;
771
848
  }
772
- } else if (!fromBlock) {
773
- fromBlock = toBlock - count + 1;
774
- } // Ensure block numbers are valid
775
-
776
849
 
777
- if (toBlock > latestBlock) {
778
- toBlock = latestBlock;
779
- }
850
+ if (fromBlock < 0) {
851
+ fromBlock = 0;
852
+ }
780
853
 
781
- if (fromBlock < 0) {
782
- fromBlock = 0;
783
- }
854
+ return _context12.abrupt("return", {
855
+ fromBlock: fromBlock,
856
+ toBlock: toBlock
857
+ });
784
858
 
785
- return _context12.abrupt("return", {
786
- fromBlock: fromBlock,
787
- toBlock: toBlock
788
- });
789
-
790
- case 8:
791
- case "end":
792
- return _context12.stop();
859
+ case 8:
860
+ case "end":
861
+ return _context12.stop();
862
+ }
793
863
  }
794
- }
795
- }, null, this);
796
- };
864
+ }, _callee12, this);
865
+ }));
866
+
867
+ return function (_x12) {
868
+ return _ref27.apply(this, arguments);
869
+ };
870
+ }();
797
871
  /**
798
872
  * Get events from the blockchain in reverse chronological order, starting from toBlock. This will also attempt
799
873
  * to identify and parse any known Eluvio contract methods. If successful, the method name, signature, and input
@@ -810,38 +884,38 @@ exports.FormatBlockNumbers = function _callee12(_ref15) {
810
884
  */
811
885
 
812
886
 
813
- exports.Events = function _callee13() {
814
- var _ref16,
887
+ exports.Events = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
888
+ var _ref29,
815
889
  toBlock,
816
890
  fromBlock,
817
- _ref16$count,
891
+ _ref29$count,
818
892
  count,
819
- _ref16$includeTransac,
893
+ _ref29$includeTransac,
820
894
  includeTransaction,
821
895
  blocks,
822
896
  _args13 = arguments;
823
897
 
824
- return _regeneratorRuntime.async(function _callee13$(_context13) {
898
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
825
899
  while (1) {
826
900
  switch (_context13.prev = _context13.next) {
827
901
  case 0:
828
- _ref16 = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {}, toBlock = _ref16.toBlock, fromBlock = _ref16.fromBlock, _ref16$count = _ref16.count, count = _ref16$count === void 0 ? 10 : _ref16$count, _ref16$includeTransac = _ref16.includeTransaction, includeTransaction = _ref16$includeTransac === void 0 ? false : _ref16$includeTransac;
902
+ _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;
829
903
  _context13.next = 3;
830
- return _regeneratorRuntime.awrap(this.FormatBlockNumbers({
904
+ return this.FormatBlockNumbers({
831
905
  fromBlock: fromBlock,
832
906
  toBlock: toBlock,
833
907
  count: count
834
- }));
908
+ });
835
909
 
836
910
  case 3:
837
911
  blocks = _context13.sent;
838
912
  this.Log("Querying events - Blocks ".concat(blocks.fromBlock, " to ").concat(blocks.toBlock));
839
913
  _context13.next = 7;
840
- return _regeneratorRuntime.awrap(this.ethClient.Events({
914
+ return this.ethClient.Events({
841
915
  fromBlock: blocks.fromBlock,
842
916
  toBlock: blocks.toBlock,
843
917
  includeTransaction: includeTransaction
844
- }));
918
+ });
845
919
 
846
920
  case 7:
847
921
  return _context13.abrupt("return", _context13.sent);
@@ -851,8 +925,8 @@ exports.Events = function _callee13() {
851
925
  return _context13.stop();
852
926
  }
853
927
  }
854
- }, null, this);
855
- };
928
+ }, _callee13, this);
929
+ }));
856
930
  /**
857
931
  * Retrieve the latest block number on the blockchain
858
932
  *
@@ -861,16 +935,15 @@ exports.Events = function _callee13() {
861
935
  * @returns {Promise<number>} - The latest block number
862
936
  */
863
937
 
864
-
865
- exports.BlockNumber = function _callee14() {
866
- return _regeneratorRuntime.async(function _callee14$(_context14) {
938
+ exports.BlockNumber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
939
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
867
940
  while (1) {
868
941
  switch (_context14.prev = _context14.next) {
869
942
  case 0:
870
943
  _context14.next = 2;
871
- return _regeneratorRuntime.awrap(this.ethClient.MakeProviderCall({
944
+ return this.ethClient.MakeProviderCall({
872
945
  methodName: "getBlockNumber"
873
- }));
946
+ });
874
947
 
875
948
  case 2:
876
949
  return _context14.abrupt("return", _context14.sent);
@@ -880,8 +953,8 @@ exports.BlockNumber = function _callee14() {
880
953
  return _context14.stop();
881
954
  }
882
955
  }
883
- }, null, this);
884
- };
956
+ }, _callee14, this);
957
+ }));
885
958
  /**
886
959
  * Get the balance (in ether) of the specified address
887
960
  *
@@ -892,32 +965,37 @@ exports.BlockNumber = function _callee14() {
892
965
  * @returns {Promise<string>} - Balance of the account, in ether (as string)
893
966
  */
894
967
 
895
-
896
- exports.GetBalance = function _callee15(_ref17) {
897
- var address, balance;
898
- return _regeneratorRuntime.async(function _callee15$(_context15) {
899
- while (1) {
900
- switch (_context15.prev = _context15.next) {
901
- case 0:
902
- address = _ref17.address;
903
- address = ValidateAddress(address);
904
- _context15.next = 4;
905
- return _regeneratorRuntime.awrap(this.ethClient.MakeProviderCall({
906
- methodName: "getBalance",
907
- args: [address]
908
- }));
909
-
910
- case 4:
911
- balance = _context15.sent;
912
- return _context15.abrupt("return", Ethers.utils.formatEther(balance));
913
-
914
- case 6:
915
- case "end":
916
- return _context15.stop();
968
+ exports.GetBalance = /*#__PURE__*/function () {
969
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref31) {
970
+ var address, balance;
971
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
972
+ while (1) {
973
+ switch (_context15.prev = _context15.next) {
974
+ case 0:
975
+ address = _ref31.address;
976
+ address = ValidateAddress(address);
977
+ _context15.next = 4;
978
+ return this.ethClient.MakeProviderCall({
979
+ methodName: "getBalance",
980
+ args: [address]
981
+ });
982
+
983
+ case 4:
984
+ balance = _context15.sent;
985
+ return _context15.abrupt("return", Ethers.utils.formatEther(balance));
986
+
987
+ case 6:
988
+ case "end":
989
+ return _context15.stop();
990
+ }
917
991
  }
918
- }
919
- }, null, this);
920
- };
992
+ }, _callee15, this);
993
+ }));
994
+
995
+ return function (_x13) {
996
+ return _ref32.apply(this, arguments);
997
+ };
998
+ }();
921
999
  /**
922
1000
  * Send ether from this client's current signer to the specified recipient address
923
1001
  *
@@ -930,32 +1008,38 @@ exports.GetBalance = function _callee15(_ref17) {
930
1008
  */
931
1009
 
932
1010
 
933
- exports.SendFunds = function _callee16(_ref18) {
934
- var recipient, ether, transaction;
935
- return _regeneratorRuntime.async(function _callee16$(_context16) {
936
- while (1) {
937
- switch (_context16.prev = _context16.next) {
938
- case 0:
939
- recipient = _ref18.recipient, ether = _ref18.ether;
940
- recipient = ValidateAddress(recipient);
941
- _context16.next = 4;
942
- return _regeneratorRuntime.awrap(this.signer.sendTransaction({
943
- to: recipient,
944
- value: Ethers.utils.parseEther(ether.toString())
945
- }));
946
-
947
- case 4:
948
- transaction = _context16.sent;
949
- _context16.next = 7;
950
- return _regeneratorRuntime.awrap(transaction.wait());
951
-
952
- case 7:
953
- return _context16.abrupt("return", _context16.sent);
954
-
955
- case 8:
956
- case "end":
957
- return _context16.stop();
1011
+ exports.SendFunds = /*#__PURE__*/function () {
1012
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref33) {
1013
+ var recipient, ether, transaction;
1014
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1015
+ while (1) {
1016
+ switch (_context16.prev = _context16.next) {
1017
+ case 0:
1018
+ recipient = _ref33.recipient, ether = _ref33.ether;
1019
+ recipient = ValidateAddress(recipient);
1020
+ _context16.next = 4;
1021
+ return this.signer.sendTransaction({
1022
+ to: recipient,
1023
+ value: Ethers.utils.parseEther(ether.toString())
1024
+ });
1025
+
1026
+ case 4:
1027
+ transaction = _context16.sent;
1028
+ _context16.next = 7;
1029
+ return transaction.wait();
1030
+
1031
+ case 7:
1032
+ return _context16.abrupt("return", _context16.sent);
1033
+
1034
+ case 8:
1035
+ case "end":
1036
+ return _context16.stop();
1037
+ }
958
1038
  }
959
- }
960
- }, null, this);
961
- };
1039
+ }, _callee16, this);
1040
+ }));
1041
+
1042
+ return function (_x14) {
1043
+ return _ref34.apply(this, arguments);
1044
+ };
1045
+ }();