@certik/skynet 0.10.48-beta.3 → 0.10.49
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 +5 -0
- package/api.js +1 -1
- package/const.js +7 -7
- package/env.js +1 -12
- package/kafka.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const osModule = require("os");
|
|
2
2
|
const express = require("express");
|
|
3
3
|
const meow = require("meow");
|
|
4
|
-
const {
|
|
4
|
+
const { getSelectorFlags, getSelectorDesc } = require("./selector");
|
|
5
5
|
const { isProduction } = require("./env");
|
|
6
6
|
const { inline } = require("./log");
|
|
7
7
|
|
package/const.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { getNodeRealApiKey, ensureAndGet } = require("./env");
|
|
2
2
|
|
|
3
3
|
const SKYNET_API_PREFIX = "https://api.certik-skynet.com";
|
|
4
4
|
|
|
@@ -11,8 +11,8 @@ const PROTOCOLS = {
|
|
|
11
11
|
nativeTokenLogo: `https://token-logo.certik-assets.com/eth:0x0000000000000000000000000000000000000000.png`,
|
|
12
12
|
nativeTokenCoinGeckoId: "ethereum",
|
|
13
13
|
nativeTokenCmcId: 1027,
|
|
14
|
-
endpoint:
|
|
15
|
-
archiveEndpoint:
|
|
14
|
+
endpoint: `https://eth-mainnet.nodereal.io/v1/${getNodeRealApiKey("ETH")}`,
|
|
15
|
+
archiveEndpoint: `https://eth-mainnet.nodereal.io/v1/${getNodeRealApiKey("ETH")}`,
|
|
16
16
|
tokenStandard: "ERC20",
|
|
17
17
|
scanApi: {
|
|
18
18
|
endpoint: "https://api.etherscan.io/api",
|
|
@@ -30,7 +30,7 @@ const PROTOCOLS = {
|
|
|
30
30
|
nativeTokenLogo: `https://token-logo.certik-assets.com/bsc:0x0000000000000000000000000000000000000000.png`,
|
|
31
31
|
nativeTokenCoinGeckoId: "binance-coin",
|
|
32
32
|
nativeTokenCmcId: 1839,
|
|
33
|
-
endpoint:
|
|
33
|
+
endpoint: `https://bsc-mainnet.nodereal.io/v1/${getNodeRealApiKey("BSC")}`,
|
|
34
34
|
archiveEndpoint: `https://bsc-mainnet.nodereal.io/v1/${getNodeRealApiKey("BSC")}`,
|
|
35
35
|
tokenStandard: "BEP20",
|
|
36
36
|
scanApi: {
|
|
@@ -49,9 +49,9 @@ const PROTOCOLS = {
|
|
|
49
49
|
nativeTokenLogo: `https://token-logo.certik-assets.com/polygon:0x0000000000000000000000000000000000000000.png`,
|
|
50
50
|
nativeTokenCoinGeckoId: "matic-network",
|
|
51
51
|
nativeTokenCmcId: 3890,
|
|
52
|
-
endpoint: `https://
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
endpoint: `https://polygon-mainnet.nodereal.io/v1/${getNodeRealApiKey("POLYGON")}`,
|
|
53
|
+
archiveEndpoint: `https://polygon-mainnet.nodereal.io/v1/${getNodeRealApiKey("POLYGON")}`,
|
|
54
|
+
backupEndpoint: `https://polygon-mainnet.nodereal.io/v1/${getNodeRealApiKey("POLYGON")}`,
|
|
55
55
|
tokenStandard: "ERC20",
|
|
56
56
|
scanApi: {
|
|
57
57
|
endpoint: "https://api.polygonscan.com/api",
|
package/env.js
CHANGED
|
@@ -14,18 +14,9 @@ function getEnvironment() {
|
|
|
14
14
|
return ensureAndGet("SKYNET_ENVIRONMENT", "dev");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function getGetBlockApiKey() {
|
|
18
|
-
return ensureAndGet("SKYNET_GETBLOCK_API_KEY");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function getAlchemyApiKey(identifier) {
|
|
22
|
-
// Alchemy API keys are different for each alchemy app
|
|
23
|
-
return ensureAndGet(`SKYNET_ALCHEMY_API_${identifier.toUpperCase()}_KEY`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
17
|
function getNodeRealApiKey(identifier) {
|
|
27
18
|
// NodeReal API keys are different for each NodeReal app
|
|
28
|
-
return ensureAndGet(`SKYNET_NODEREAL_API_${identifier.toUpperCase()}_KEY`);
|
|
19
|
+
return ensureAndGet([`SKYNET_NODEREAL_API_${identifier.toUpperCase()}_KEY`, `SKYNET_NODEREAL_API_KEY`]);
|
|
29
20
|
}
|
|
30
21
|
|
|
31
22
|
function ensureAndGet(envName, defaultValue) {
|
|
@@ -69,7 +60,5 @@ module.exports = {
|
|
|
69
60
|
getEnvironment,
|
|
70
61
|
isProduction,
|
|
71
62
|
isDev,
|
|
72
|
-
getGetBlockApiKey,
|
|
73
|
-
getAlchemyApiKey,
|
|
74
63
|
getNodeRealApiKey,
|
|
75
64
|
};
|
package/kafka.js
CHANGED
|
@@ -5,6 +5,7 @@ const { Kafka, logLevel } = require("kafkajs");
|
|
|
5
5
|
const { getJobName, getSelectorFlags, getSelectorDesc, toSelectorString } = require("./selector");
|
|
6
6
|
const { createRecord, getRecordByKey, deleteRecordsByHashKey } = require("./dynamodb");
|
|
7
7
|
const { exponentialRetry } = require("./availability");
|
|
8
|
+
const { useLock } = require("./distributed-lock");
|
|
8
9
|
const { getBinaryName } = require("./cli");
|
|
9
10
|
const { inline } = require("./log");
|
|
10
11
|
|
|
@@ -218,6 +219,8 @@ ${getSelectorDesc(selector)}
|
|
|
218
219
|
process.exit(0);
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
await useLock({ name: getJobName(name, selectorFlags), ttl: 50, verbose });
|
|
223
|
+
|
|
221
224
|
if (!from) {
|
|
222
225
|
const prevId = await getProducerLatestId(name, selectorFlags);
|
|
223
226
|
|