@certik/skynet 0.9.0 → 0.9.3
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 +13 -1
- package/const.js +3 -2
- package/deploy.js +43 -7
- package/env.js +6 -0
- 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/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.3
|
|
4
|
+
|
|
5
|
+
- Update BSC Archive Node to NodeReal
|
|
6
|
+
|
|
7
|
+
## 0.9.2
|
|
8
|
+
|
|
9
|
+
- Enhanced security by moving secret files into nomad secrets folder
|
|
10
|
+
|
|
11
|
+
## 0.9.1
|
|
12
|
+
|
|
13
|
+
- Supported using `--schedule` argument to override default schedule when deploying
|
|
14
|
+
|
|
3
15
|
## 0.9.0
|
|
4
16
|
|
|
5
17
|
- Added `web3` library with call support
|
|
@@ -11,7 +23,7 @@
|
|
|
11
23
|
|
|
12
24
|
## 0.8.15
|
|
13
25
|
|
|
14
|
-
- Fixed OpsGenie message bug
|
|
26
|
+
- Fixed OpsGenie message bug
|
|
15
27
|
|
|
16
28
|
## 0.8.14
|
|
17
29
|
|
package/const.js
CHANGED
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
getPolygonScanApiKey,
|
|
5
5
|
getGetBlockApiKey,
|
|
6
6
|
getAlchemyApiKey,
|
|
7
|
+
getNodeRealApiKey,
|
|
7
8
|
} = require("./env");
|
|
8
9
|
|
|
9
10
|
const SKYNET_API_PREFIX = "https://api.certik-skynet.com";
|
|
@@ -34,7 +35,7 @@ const PROTOCOLS = {
|
|
|
34
35
|
nativeTokenLogo: `https://token-logo.certik-assets.com/bsc:0x0000000000000000000000000000000000000000.png`,
|
|
35
36
|
nativeTokenCoinGeckoId: "binance-coin",
|
|
36
37
|
endpoint: "https://bsc-full-node.certik-skynet.com",
|
|
37
|
-
archiveEndpoint:
|
|
38
|
+
archiveEndpoint: `https://bsc-mainnet.nodereal.io/v1/${getNodeRealApiKey("BSC")}`,
|
|
38
39
|
tokenStandard: "BEP20",
|
|
39
40
|
scanApi: {
|
|
40
41
|
endpoint: "https://api.bscscan.com/api",
|
|
@@ -60,7 +61,7 @@ const PROTOCOLS = {
|
|
|
60
61
|
},
|
|
61
62
|
multiCallProvider: "", // TODO
|
|
62
63
|
scanUrl: "https://polygonscan.com/",
|
|
63
|
-
}
|
|
64
|
+
},
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
const TIME = {
|
package/deploy.js
CHANGED
|
@@ -9,10 +9,15 @@ const { getEnvOrThrow } = require("./env");
|
|
|
9
9
|
const { getBinaryName, detectSkynetDirectory } = require("./cli");
|
|
10
10
|
|
|
11
11
|
const INTERVAL_ALIASES = {
|
|
12
|
+
secondly: "*/1 * * * * * *",
|
|
12
13
|
"@secondly": "*/1 * * * * * *",
|
|
14
|
+
minutely: "0 * * * * * *",
|
|
13
15
|
"@minutely": "0 * * * * * *",
|
|
16
|
+
hourly: "0 0 * * * * *",
|
|
14
17
|
"@hourly": "0 0 * * * * *",
|
|
18
|
+
daily: "0 0 0 * * * *",
|
|
15
19
|
"@daily": "0 0 0 * * * *",
|
|
20
|
+
weekly: "0 0 0 * * 0 *",
|
|
16
21
|
"@weekly": "0 0 0 * * 0 *",
|
|
17
22
|
};
|
|
18
23
|
|
|
@@ -120,7 +125,7 @@ const genConfig = ({
|
|
|
120
125
|
|
|
121
126
|
template {
|
|
122
127
|
change_mode = "restart"
|
|
123
|
-
destination = "context.env"
|
|
128
|
+
destination = "secrets/context.env"
|
|
124
129
|
env = true
|
|
125
130
|
|
|
126
131
|
data = <<EOH
|
|
@@ -295,7 +300,17 @@ function createModeDeploy({
|
|
|
295
300
|
validateCpu,
|
|
296
301
|
validateMem,
|
|
297
302
|
}) {
|
|
298
|
-
async function deployMode({
|
|
303
|
+
async function deployMode({
|
|
304
|
+
mode,
|
|
305
|
+
from,
|
|
306
|
+
to,
|
|
307
|
+
stop,
|
|
308
|
+
production,
|
|
309
|
+
dryRun,
|
|
310
|
+
verbose,
|
|
311
|
+
schedule: cmdSchedule,
|
|
312
|
+
...selectorFlags
|
|
313
|
+
}) {
|
|
299
314
|
if (mode === "delta") {
|
|
300
315
|
// delta mode will ignore from/to flags
|
|
301
316
|
from = 0;
|
|
@@ -336,9 +351,17 @@ function createModeDeploy({
|
|
|
336
351
|
// by default use delta cpu/mem settings
|
|
337
352
|
const { cpu, mem } = modeResouces[mode] || modeResouces.delta;
|
|
338
353
|
|
|
339
|
-
|
|
354
|
+
let deltaCron = typeof deltaSchedule === "function" ? deltaSchedule(jobName) : deltaSchedule;
|
|
340
355
|
|
|
341
|
-
|
|
356
|
+
if (deltaSchedule && cmdSchedule) {
|
|
357
|
+
deltaCron = cmdSchedule;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
let validateCron = typeof validateSchedule === "function" ? validateSchedule(jobName) : validateSchedule;
|
|
361
|
+
|
|
362
|
+
if (validateSchedule && cmdSchedule) {
|
|
363
|
+
validateCron = cmdSchedule;
|
|
364
|
+
}
|
|
342
365
|
|
|
343
366
|
const modeIntervals = {
|
|
344
367
|
delta: INTERVAL_ALIASES[deltaCron] || deltaCron,
|
|
@@ -404,7 +427,8 @@ ${getSelectorDesc(selector)}
|
|
|
404
427
|
--from min id to build
|
|
405
428
|
--to max id to build
|
|
406
429
|
--stop stop job instead of running the job
|
|
407
|
-
--production deploy to production
|
|
430
|
+
--production deploy to production, default is development
|
|
431
|
+
--schedule override default schedule, support aliases: secondly, minutely, hourly, daily, weekly
|
|
408
432
|
--verbose Output debug messages
|
|
409
433
|
--dry-run print nomad job file but do not really execute it
|
|
410
434
|
|
|
@@ -432,6 +456,9 @@ ${getSelectorDesc(selector)}
|
|
|
432
456
|
type: "number",
|
|
433
457
|
default: 0,
|
|
434
458
|
},
|
|
459
|
+
schedule: {
|
|
460
|
+
type: "string",
|
|
461
|
+
},
|
|
435
462
|
verbose: {
|
|
436
463
|
type: "boolean",
|
|
437
464
|
default: false,
|
|
@@ -476,7 +503,7 @@ function createDeploy({
|
|
|
476
503
|
cpu,
|
|
477
504
|
mem,
|
|
478
505
|
}) {
|
|
479
|
-
async function deployModeless({ production, stop, dryRun, verbose, ...selectorFlags }) {
|
|
506
|
+
async function deployModeless({ production, stop, dryRun, verbose, schedule: cmdSchedule, ...selectorFlags }) {
|
|
480
507
|
const jobName = getJobName(name, selectorFlags, null);
|
|
481
508
|
|
|
482
509
|
const selectorCmdPart = Object.keys(selectorFlags)
|
|
@@ -489,7 +516,12 @@ function createDeploy({
|
|
|
489
516
|
args += ` --verbose`;
|
|
490
517
|
}
|
|
491
518
|
|
|
492
|
-
|
|
519
|
+
let cron = typeof schedule === "function" ? schedule(jobName) : schedule;
|
|
520
|
+
|
|
521
|
+
if (schedule && cmdSchedule) {
|
|
522
|
+
// cmd schedule has higher priority
|
|
523
|
+
cron = cmdSchedule;
|
|
524
|
+
}
|
|
493
525
|
|
|
494
526
|
const nomadJobDefinition = genConfig({
|
|
495
527
|
jobName,
|
|
@@ -549,6 +581,7 @@ function createDeploy({
|
|
|
549
581
|
${getSelectorDesc(selector)}
|
|
550
582
|
--stop stop job instead of running the job
|
|
551
583
|
--production deploy to production, default is development
|
|
584
|
+
--schedule override default schedule, support aliases: secondly, minutely, hourly, daily, weekly
|
|
552
585
|
--verbose Output debug messages
|
|
553
586
|
--dry-run print nomad job file but do not really execute it
|
|
554
587
|
`,
|
|
@@ -557,6 +590,9 @@ ${getSelectorDesc(selector)}
|
|
|
557
590
|
version: false,
|
|
558
591
|
flags: {
|
|
559
592
|
...getSelectorFlags(selector),
|
|
593
|
+
schedule: {
|
|
594
|
+
type: "string",
|
|
595
|
+
},
|
|
560
596
|
verbose: {
|
|
561
597
|
type: "boolean",
|
|
562
598
|
default: false,
|
package/env.js
CHANGED
|
@@ -35,6 +35,11 @@ function getAlchemyApiKey(identifier) {
|
|
|
35
35
|
return ensureAndGet(`SKYNET_ALCHEMY_API_${identifier.toUpperCase()}_KEY`);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function getNodeRealApiKey(identifier) {
|
|
39
|
+
// NodeReal API keys are different for each NodeReal app
|
|
40
|
+
return ensureAndGet(`SKYNET_NODEREAL_API_${identifier.toUpperCase()}_KEY`);
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
function ensureAndGet(envName, defaultValue) {
|
|
39
44
|
if (Array.isArray(envName)) {
|
|
40
45
|
for (let name of envName) {
|
|
@@ -81,4 +86,5 @@ module.exports = {
|
|
|
81
86
|
getPolygonScanApiKey,
|
|
82
87
|
getGetBlockApiKey,
|
|
83
88
|
getAlchemyApiKey,
|
|
89
|
+
getNodeRealApiKey,
|
|
84
90
|
};
|
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/package.json
CHANGED