@certik/skynet 0.10.25 → 0.10.26
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.d.ts +2 -1
- package/api.js +5 -1
- package/app.d.ts +1 -0
- package/app.js +2 -1
- package/const.d.ts +4 -1
- package/const.js +19 -8
- package/env.d.ts +0 -3
- package/env.js +0 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/api.d.ts
CHANGED
package/api.js
CHANGED
|
@@ -65,7 +65,7 @@ const apiKeyMiddleware = (key) => {
|
|
|
65
65
|
return requireAPIKey;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
async function startApiApp({ binaryName, name, selector = {}, routes, serve }) {
|
|
68
|
+
async function startApiApp({ binaryName, name, selector = {}, routes, serve, beforeListen }) {
|
|
69
69
|
const app = express();
|
|
70
70
|
app.use(express.json());
|
|
71
71
|
|
|
@@ -133,6 +133,10 @@ ${getSelectorDesc(selector)}
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
if (beforeListen) {
|
|
137
|
+
await beforeListen({ app });
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
app.listen(serve.port, () => {
|
|
137
141
|
if (isProduction()) {
|
|
138
142
|
inline.log(`${name} listening at https://api.certik-skynet.com${serve.prefix}`);
|
package/app.d.ts
CHANGED
package/app.js
CHANGED
|
@@ -600,7 +600,7 @@ function checkApiRoutesParameter(routes) {
|
|
|
600
600
|
return errors;
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
-
function api({ name, routes, serve, env = {}, region = "us-east-1" }) {
|
|
603
|
+
function api({ name, routes, serve, beforeListen, env = {}, region = "us-east-1" }) {
|
|
604
604
|
// do not support selector for now
|
|
605
605
|
const selector = {};
|
|
606
606
|
|
|
@@ -641,6 +641,7 @@ function api({ name, routes, serve, env = {}, region = "us-east-1" }) {
|
|
|
641
641
|
selector,
|
|
642
642
|
routes,
|
|
643
643
|
serve,
|
|
644
|
+
beforeListen,
|
|
644
645
|
});
|
|
645
646
|
},
|
|
646
647
|
onDeploy: () => {
|
package/const.d.ts
CHANGED
|
@@ -29,7 +29,10 @@ export const SKYNET_API_PREFIX: string;
|
|
|
29
29
|
export const PROTOCOLS: {
|
|
30
30
|
eth: Protocol,
|
|
31
31
|
bsc: Protocol,
|
|
32
|
-
polygon: Protocol
|
|
32
|
+
polygon: Protocol,
|
|
33
|
+
heco: Protocol,
|
|
34
|
+
avax: Protocol,
|
|
35
|
+
ftm: Protocol,
|
|
33
36
|
}
|
|
34
37
|
export const TIME: {
|
|
35
38
|
BY_MS: TimeIntervals,
|
package/const.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
3
|
-
getBscScanApiKey,
|
|
4
|
-
getPolygonScanApiKey,
|
|
2
|
+
getEnvironment,
|
|
5
3
|
getGetBlockApiKey,
|
|
6
4
|
getAlchemyApiKey,
|
|
7
5
|
getNodeRealApiKey,
|
|
@@ -23,7 +21,7 @@ const PROTOCOLS = {
|
|
|
23
21
|
tokenStandard: "ERC20",
|
|
24
22
|
scanApi: {
|
|
25
23
|
endpoint: "https://api.etherscan.io/api",
|
|
26
|
-
key:
|
|
24
|
+
key: getEnvironment("SKYNET_ETHER_SCAN_API_KEY"),
|
|
27
25
|
},
|
|
28
26
|
multiCallProvider: "0xCa731e0f33Afbcfa9363d6F7449d1f5447d10C80",
|
|
29
27
|
scanUrl: "https://etherscan.io/",
|
|
@@ -41,7 +39,7 @@ const PROTOCOLS = {
|
|
|
41
39
|
tokenStandard: "BEP20",
|
|
42
40
|
scanApi: {
|
|
43
41
|
endpoint: "https://api.bscscan.com/api",
|
|
44
|
-
key:
|
|
42
|
+
key: getEnvironment("SKYNET_BSC_SCAN_API_KEY"),
|
|
45
43
|
},
|
|
46
44
|
multiCallProvider: "0xe7144e57d832c9005D252f415d205b4b8D78228e",
|
|
47
45
|
scanUrl: "https://bscscan.com/",
|
|
@@ -60,7 +58,7 @@ const PROTOCOLS = {
|
|
|
60
58
|
tokenStandard: "ERC20",
|
|
61
59
|
scanApi: {
|
|
62
60
|
endpoint: "https://api.polygonscan.com/api",
|
|
63
|
-
key:
|
|
61
|
+
key: getEnvironment("SKYNET_POLYGON_SCAN_API_KEY"),
|
|
64
62
|
},
|
|
65
63
|
multiCallProvider: "0x8eC86392e0aDB57d00fDffbA39b8870e107c0757",
|
|
66
64
|
scanUrl: "https://polygonscan.com/",
|
|
@@ -78,14 +76,27 @@ const PROTOCOLS = {
|
|
|
78
76
|
avax: {
|
|
79
77
|
nativeTokenName: "Avalanche",
|
|
80
78
|
nativeTokenSymbol: "AVAX",
|
|
81
|
-
|
|
79
|
+
nativeTokenDecimals: 18,
|
|
80
|
+
nativeTokenAddress: "avax:0x0000000000000000000000000000000000000000",
|
|
81
|
+
endpoint: `https://api.avax.network/ext/bc/C/rpc`,
|
|
82
82
|
tokenStandard: "ARC20",
|
|
83
|
-
|
|
83
|
+
scanApi: {
|
|
84
|
+
endpoint: "https://api.snowtrace.io",
|
|
85
|
+
key: getEnvironment("SKYNET_AVASCAN_API_KEY"),
|
|
86
|
+
},
|
|
87
|
+
scanUrl: "https://snowtrace.io/"
|
|
84
88
|
},
|
|
85
89
|
ftm: {
|
|
86
90
|
nativeTokenName: "Fantom",
|
|
87
91
|
nativeTokenSymbol: "FTM",
|
|
92
|
+
nativeTokenDecimals: 18,
|
|
93
|
+
nativeTokenAddress: "ftm:0x0000000000000000000000000000000000000000",
|
|
88
94
|
endpoint: `https://rpcapi.fantom.network`,
|
|
95
|
+
tokenStandard: "ERC20",
|
|
96
|
+
scanApi: {
|
|
97
|
+
endpoint: "https://api.ftmscan.com",
|
|
98
|
+
key: getEnvironment("SKYNET_FTMSCAN_API_KEY"),
|
|
99
|
+
},
|
|
89
100
|
scanUrl: "https://ftmscan.com/"
|
|
90
101
|
}
|
|
91
102
|
};
|
package/env.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ export function getAWSAccessKeyId(): string | undefined;
|
|
|
4
4
|
export function getAWSSecretAccessKey(): string | undefined;
|
|
5
5
|
export function getAWSRegion(): string;
|
|
6
6
|
export function getEnvironment(): string;
|
|
7
|
-
export function getEtherScanApiKey(): string | undefined;
|
|
8
|
-
export function getBscScanApiKey(): string | undefined;
|
|
9
|
-
export function getPolygonScanApiKey(): string | undefined;
|
|
10
7
|
export function getGetBlockApiKey(): string | undefined;
|
|
11
8
|
export function getAlchemyApiKey(identifier: string): string | undefined;
|
|
12
9
|
export function getNodeRealApiKey(identifier: string): string | undefined;
|
package/env.js
CHANGED
|
@@ -14,18 +14,6 @@ function getEnvironment() {
|
|
|
14
14
|
return ensureAndGet("SKYNET_ENVIRONMENT", "dev");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function getEtherScanApiKey() {
|
|
18
|
-
return ensureAndGet("SKYNET_ETHER_SCAN_API_KEY");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function getBscScanApiKey() {
|
|
22
|
-
return ensureAndGet("SKYNET_BSC_SCAN_API_KEY");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getPolygonScanApiKey() {
|
|
26
|
-
return ensureAndGet("SKYNET_POLYGON_SCAN_API_KEY");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
function getGetBlockApiKey() {
|
|
30
18
|
return ensureAndGet("SKYNET_GETBLOCK_API_KEY");
|
|
31
19
|
}
|
|
@@ -81,9 +69,6 @@ module.exports = {
|
|
|
81
69
|
getEnvironment,
|
|
82
70
|
isProduction,
|
|
83
71
|
isDev,
|
|
84
|
-
getEtherScanApiKey,
|
|
85
|
-
getBscScanApiKey,
|
|
86
|
-
getPolygonScanApiKey,
|
|
87
72
|
getGetBlockApiKey,
|
|
88
73
|
getAlchemyApiKey,
|
|
89
74
|
getNodeRealApiKey,
|