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