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