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