@certik/skynet 0.8.7 → 0.8.8
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/CHANGELOG.md +7 -3
- package/examples/consumer +0 -0
- package/examples/indexer +0 -0
- package/examples/legacy-deploy-consumer +0 -0
- package/examples/legacy-deploy-indexer +0 -0
- package/examples/legacy-deploy-mode-indexer +0 -0
- package/examples/legacy-deploy-producer +0 -0
- package/examples/legacy-indexer +0 -0
- package/examples/legacy-kafka-consumer +0 -0
- package/examples/legacy-kafka-producer +0 -0
- package/examples/legacy-mode-indexer +0 -0
- package/examples/mode-indexer +0 -0
- package/examples/producer +0 -0
- package/indexer.js +6 -1
- package/package.json +2 -2
- package/scan.js +21 -14
- package/slack.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.8
|
|
4
|
+
|
|
5
|
+
- Improved `postMessage` in `slack` library to support private channels
|
|
6
|
+
|
|
3
7
|
## 0.8.7
|
|
4
8
|
|
|
5
|
-
-
|
|
9
|
+
- Changed polygon node endpoint
|
|
6
10
|
|
|
7
11
|
## 0.8.6
|
|
8
12
|
|
|
9
13
|
- Fixed a const.js error
|
|
10
|
-
-
|
|
14
|
+
- Support more options in snowflake.js
|
|
11
15
|
|
|
12
16
|
## 0.8.5
|
|
13
17
|
|
|
14
|
-
-
|
|
18
|
+
- Improved cross-OS compatibility of `detectDirectory` function
|
|
15
19
|
|
|
16
20
|
## 0.8.4
|
|
17
21
|
|
package/examples/consumer
CHANGED
|
File without changes
|
package/examples/indexer
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/examples/legacy-indexer
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/examples/mode-indexer
CHANGED
|
File without changes
|
package/examples/producer
CHANGED
|
File without changes
|
package/indexer.js
CHANGED
|
@@ -539,7 +539,12 @@ ${getSelectorDesc(selector)}
|
|
|
539
539
|
|
|
540
540
|
async function runBuild({ verbose, ...selectorFlags }) {
|
|
541
541
|
const startTime = Date.now();
|
|
542
|
-
|
|
542
|
+
|
|
543
|
+
if (Object.keys(selectorFlags).length > 0) {
|
|
544
|
+
console.log(`[INDEXER] starting build, ${toSelectorString(selectorFlags, ", ")}`);
|
|
545
|
+
} else {
|
|
546
|
+
console.log(`[INDEXER] starting build`);
|
|
547
|
+
}
|
|
543
548
|
|
|
544
549
|
const result = await exponentialRetry(
|
|
545
550
|
async () => {
|
package/package.json
CHANGED
package/scan.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const { exponentialRetry, wait } = require("
|
|
2
|
-
const { PROTOCOLS } = require("
|
|
1
|
+
const { exponentialRetry, wait } = require("./availability");
|
|
2
|
+
const { PROTOCOLS } = require("./const");
|
|
3
3
|
const fetch = require("node-fetch");
|
|
4
4
|
|
|
5
5
|
const BATCH_SIZE = 10_000; // Max number of transactions fetched from scan api at once
|
|
6
6
|
|
|
7
|
-
function getScanApiEndpoint(protocol, addr, startBlock = 0, endBlock = null) {
|
|
7
|
+
function getScanApiEndpoint(protocol, addr, startBlock = 0, endBlock = null, offset=BATCH_SIZE) {
|
|
8
8
|
const { endpoint, key } = PROTOCOLS[protocol].scanApi;
|
|
9
|
-
let url = `${endpoint}?module=account&action=txlist&address=${addr}&apikey=${key}&sort=asc&startblock=${startBlock}&page=1&offset=${
|
|
9
|
+
let url = `${endpoint}?module=account&action=txlist&address=${addr}&apikey=${key}&sort=asc&startblock=${startBlock}&page=1&offset=${offset}`;
|
|
10
10
|
|
|
11
11
|
if (endBlock) {
|
|
12
12
|
url += `&endblock=${endBlock}`;
|
|
@@ -15,19 +15,25 @@ function getScanApiEndpoint(protocol, addr, startBlock = 0, endBlock = null) {
|
|
|
15
15
|
return url;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async function fetchTxs(protocol, addr,
|
|
19
|
-
const url = getScanApiEndpoint(protocol, addr,
|
|
18
|
+
async function fetchTxs(protocol, addr, since, to, offset) {
|
|
19
|
+
const url = getScanApiEndpoint(protocol, addr, since, to, offset);
|
|
20
20
|
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(url);
|
|
23
|
+
const scanJSON = await res.json();
|
|
24
|
+
return scanJSON.result;
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.log(`error fetching txs: ${err}`)
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function fetchTxsWithRetry(protocol, addr, since, to, offset, verbose) {
|
|
21
32
|
const txs = await exponentialRetry(
|
|
22
|
-
async () =>
|
|
23
|
-
const res = await fetch(url);
|
|
24
|
-
const scanJSON = await res.json();
|
|
25
|
-
return scanJSON.result;
|
|
26
|
-
},
|
|
33
|
+
async () => fetchTxs(protocol, addr, since, to, offset),
|
|
27
34
|
{ maxRetry: 6, test: Array.isArray, verbose }
|
|
28
35
|
)
|
|
29
36
|
|
|
30
|
-
console.log(`start block=${startBlock}, total items=${txs.length}`);
|
|
31
37
|
return txs;
|
|
32
38
|
}
|
|
33
39
|
|
|
@@ -39,7 +45,8 @@ async function streamTxs(address, since, to, callback, verbose) {
|
|
|
39
45
|
const [protocol, addr] = address.split(":");
|
|
40
46
|
|
|
41
47
|
while (hasMorePage) {
|
|
42
|
-
const txs = await fetchTxs(protocol, addr, startBlock, to, verbose);
|
|
48
|
+
const txs = await fetchTxs(protocol, addr, startBlock, to, BATCH_SIZE, verbose);
|
|
49
|
+
console.log(`start block=${since}, total items=${txs.length}`);
|
|
43
50
|
|
|
44
51
|
// This will only ever happen if the total number of txs is a multiple of our batch size
|
|
45
52
|
if (txs.length === 0) {
|
|
@@ -65,4 +72,4 @@ async function streamTxs(address, since, to, callback, verbose) {
|
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
module.exports = { streamTxs };
|
|
75
|
+
module.exports = { streamTxs, fetchTxs, fetchTxsWithRetry };
|
package/slack.js
CHANGED