@super-protocol/sdk-js 0.10.6-beta.0 → 0.10.7-beta.0
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/build/BlockchainConnector.js +14 -14
- package/package.json +2 -2
|
@@ -354,28 +354,28 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
354
354
|
BlockchainConnector.getTransactions = function (addresses, startBlock, lastBlock, batchSize) {
|
|
355
355
|
if (batchSize === void 0) { batchSize = constants_1.BLOCK_SIZE_TO_FETCH_TRANSACTION; }
|
|
356
356
|
return __awaiter(this, void 0, void 0, function () {
|
|
357
|
-
var transactionsByAddress, batch, getBlock, batchLastBlock, blockNumber, blocks;
|
|
357
|
+
var blockchainLastBlock, transactionsByAddress, batch, getBlock, batchLastBlock, blockNumber, blocks;
|
|
358
358
|
return __generator(this, function (_a) {
|
|
359
359
|
switch (_a.label) {
|
|
360
360
|
case 0:
|
|
361
361
|
(0, utils_1.checkIfHttpsInitialized)();
|
|
362
|
-
if (!!lastBlock) return [3 /*break*/, 2];
|
|
363
362
|
return [4 /*yield*/, store_1.default.web3Https.eth.getBlockNumber()];
|
|
364
363
|
case 1:
|
|
365
|
-
|
|
366
|
-
if (
|
|
367
|
-
lastBlock =
|
|
364
|
+
blockchainLastBlock = _a.sent();
|
|
365
|
+
if (lastBlock) {
|
|
366
|
+
lastBlock = Math.min(lastBlock, blockchainLastBlock);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
lastBlock = blockchainLastBlock;
|
|
368
370
|
}
|
|
369
|
-
_a.label = 2;
|
|
370
|
-
case 2:
|
|
371
371
|
if (!startBlock) {
|
|
372
372
|
startBlock = Math.max(lastBlock - 1000, 0);
|
|
373
373
|
}
|
|
374
374
|
transactionsByAddress = {};
|
|
375
375
|
addresses.forEach(function (address) { return (transactionsByAddress[address] = []); });
|
|
376
|
-
_a.label =
|
|
377
|
-
case
|
|
378
|
-
if (!(startBlock <= lastBlock)) return [3 /*break*/,
|
|
376
|
+
_a.label = 2;
|
|
377
|
+
case 2:
|
|
378
|
+
if (!(startBlock <= lastBlock)) return [3 /*break*/, 4];
|
|
379
379
|
batch = new store_1.default.web3Https.eth.BatchRequest();
|
|
380
380
|
getBlock = store_1.default.web3Https.eth.getBlock;
|
|
381
381
|
batchLastBlock = Math.min(startBlock + batchSize - 1, lastBlock);
|
|
@@ -383,10 +383,10 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
383
383
|
batch.add(getBlock.request(blockNumber, true));
|
|
384
384
|
}
|
|
385
385
|
return [4 /*yield*/, this.executeBatchAsync(batch)];
|
|
386
|
-
case
|
|
386
|
+
case 3:
|
|
387
387
|
blocks = _a.sent();
|
|
388
388
|
blocks.forEach(function (block) {
|
|
389
|
-
if (!block.transactions)
|
|
389
|
+
if (!(block === null || block === void 0 ? void 0 : block.transactions))
|
|
390
390
|
return;
|
|
391
391
|
block.transactions.forEach(function (transaction) {
|
|
392
392
|
var address = null;
|
|
@@ -400,8 +400,8 @@ var BlockchainConnector = /** @class */ (function () {
|
|
|
400
400
|
});
|
|
401
401
|
});
|
|
402
402
|
startBlock = batchLastBlock + 1;
|
|
403
|
-
return [3 /*break*/,
|
|
404
|
-
case
|
|
403
|
+
return [3 /*break*/, 2];
|
|
404
|
+
case 4: return [2 /*return*/, {
|
|
405
405
|
transactionsByAddress: transactionsByAddress,
|
|
406
406
|
lastBlock: lastBlock,
|
|
407
407
|
}];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-protocol/sdk-js",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7-beta.0",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"patch": "npm version patch && npm run tag:publish",
|
|
26
26
|
"minor": "npm version minor && npm run tag:publish",
|
|
27
27
|
"major": "npm version major && npm run tag:publish",
|
|
28
|
-
"tag:publish": "git push origin && git push
|
|
28
|
+
"tag:publish": "git push origin && git push origin $(git tag --points-at HEAD)",
|
|
29
29
|
"dto:update": "npm run dto:clean && npm run dto:generate",
|
|
30
30
|
"dto:clean": "rm -rf ./src/proto/*",
|
|
31
31
|
"dto:generate": "cd ./dto/src && protoc --plugin=../../node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_opt=unrecognizedEnum=false --ts_proto_out=../../src/proto ./*"
|