@certik/skynet 0.10.36 → 0.10.38

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.38
4
+
5
+ - Added x-instance-id header for api service
6
+
7
+ ## 0.10.37
8
+
9
+ - Fixed some issues with `PROTOCOLS`
10
+
3
11
  ## 0.10.36
4
12
 
5
13
  - Added Algorand to `PROTOCOLS`
package/api.js CHANGED
@@ -1,3 +1,4 @@
1
+ const osModule = require("os");
1
2
  const express = require("express");
2
3
  const meow = require("meow");
3
4
  const { getJobName, getSelectorFlags, getSelectorDesc } = require("./selector");
@@ -13,10 +14,18 @@ async function logStartMiddleware(req, res, next) {
13
14
  next();
14
15
  }
15
16
 
17
+ async function contextMiddleware(req, res, next) {
18
+ res.set("x-instance-id", osModule.hostname());
19
+
20
+ next();
21
+ }
22
+
16
23
  async function logEndMiddleware(req, res, next) {
17
24
  const start = new Date(res.get("x-requested-at"));
18
25
  const end = new Date();
19
26
 
27
+ res.set("x-responded-at", end.toISOString());
28
+
20
29
  const logInfo = {
21
30
  start,
22
31
  end,
@@ -134,6 +143,7 @@ ${getSelectorDesc(selector)}
134
143
 
135
144
  app[method](
136
145
  route.path,
146
+ contextMiddleware,
137
147
  logStartMiddleware,
138
148
  ...middlewares,
139
149
  async (req, res, next) => {
package/const.d.ts CHANGED
@@ -7,14 +7,15 @@ type Protocol = {
7
7
  nativeTokenCoinGeckoId: string,
8
8
  nativeTokenCmcId: number,
9
9
  endpoint: string,
10
- archiveEndpoint: string,
10
+ backupEndpoint?: string,
11
+ archiveEndpoint?: string,
11
12
  tokenStandard: string,
12
- scanApi: {
13
+ scanApi?: {
13
14
  endpoint: string,
14
15
  key: string,
15
16
  },
16
- multiCallProvider: string,
17
- scanUrl: string,
17
+ multiCallProvider?: string,
18
+ scanUrl?: string,
18
19
  }
19
20
 
20
21
  type TimeIntervals = {
@@ -33,6 +34,7 @@ export const PROTOCOLS: {
33
34
  heco: Protocol,
34
35
  avax: Protocol,
35
36
  ftm: Protocol,
37
+ algo: Protocol
36
38
  }
37
39
  export const TIME: {
38
40
  BY_MS: TimeIntervals,
package/const.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const {
2
- getEnvironment,
3
2
  getGetBlockApiKey,
4
3
  getAlchemyApiKey,
5
4
  getNodeRealApiKey,
5
+ ensureAndGet,
6
6
  } = require("./env");
7
7
 
8
8
  const SKYNET_API_PREFIX = "https://api.certik-skynet.com";
@@ -21,7 +21,7 @@ const PROTOCOLS = {
21
21
  tokenStandard: "ERC20",
22
22
  scanApi: {
23
23
  endpoint: "https://api.etherscan.io/api",
24
- key: getEnvironment("SKYNET_ETHER_SCAN_API_KEY"),
24
+ key: ensureAndGet("SKYNET_ETHER_SCAN_API_KEY"),
25
25
  },
26
26
  multiCallProvider: "0xCa731e0f33Afbcfa9363d6F7449d1f5447d10C80",
27
27
  scanUrl: "https://etherscan.io/",
@@ -39,7 +39,7 @@ const PROTOCOLS = {
39
39
  tokenStandard: "BEP20",
40
40
  scanApi: {
41
41
  endpoint: "https://api.bscscan.com/api",
42
- key: getEnvironment("SKYNET_BSC_SCAN_API_KEY"),
42
+ key: ensureAndGet("SKYNET_BSC_SCAN_API_KEY"),
43
43
  },
44
44
  multiCallProvider: "0xe7144e57d832c9005D252f415d205b4b8D78228e",
45
45
  scanUrl: "https://bscscan.com/",
@@ -58,7 +58,7 @@ const PROTOCOLS = {
58
58
  tokenStandard: "ERC20",
59
59
  scanApi: {
60
60
  endpoint: "https://api.polygonscan.com/api",
61
- key: getEnvironment("SKYNET_POLYGON_SCAN_API_KEY"),
61
+ key: ensureAndGet("SKYNET_POLYGON_SCAN_API_KEY"),
62
62
  },
63
63
  multiCallProvider: "0x8eC86392e0aDB57d00fDffbA39b8870e107c0757",
64
64
  scanUrl: "https://polygonscan.com/",
@@ -78,11 +78,14 @@ const PROTOCOLS = {
78
78
  nativeTokenSymbol: "AVAX",
79
79
  nativeTokenDecimals: 18,
80
80
  nativeTokenAddress: "avax:0x0000000000000000000000000000000000000000",
81
+ nativeTokenLogo: `https://token-logo.certik-assets.com/avax:0x0000000000000000000000000000000000000000.png`,
82
+ nativeTokenCoinGeckoId: "avalanche-2",
83
+ nativeTokenCmcId: 5805,
81
84
  endpoint: `https://api.avax.network/ext/bc/C/rpc`,
82
85
  tokenStandard: "ARC20",
83
86
  scanApi: {
84
- endpoint: "https://api.snowtrace.io",
85
- key: getEnvironment("SKYNET_AVASCAN_API_KEY"),
87
+ endpoint: "https://api.snowtrace.io/api",
88
+ key: ensureAndGet("SKYNET_AVASCAN_API_KEY"),
86
89
  },
87
90
  scanUrl: "https://snowtrace.io/"
88
91
  },
@@ -91,11 +94,14 @@ const PROTOCOLS = {
91
94
  nativeTokenSymbol: "FTM",
92
95
  nativeTokenDecimals: 18,
93
96
  nativeTokenAddress: "ftm:0x0000000000000000000000000000000000000000",
97
+ nativeTokenLogo: `https://token-logo.certik-assets.com/ftm:0x0000000000000000000000000000000000000000.png`,
98
+ nativeTokenCoinGeckoId: "fantom",
99
+ nativeTokenCmcId: 3513,
94
100
  endpoint: `https://rpcapi.fantom.network`,
95
101
  tokenStandard: "ERC20",
96
102
  scanApi: {
97
- endpoint: "https://api.ftmscan.com",
98
- key: getEnvironment("SKYNET_FTMSCAN_API_KEY"),
103
+ endpoint: "https://api.ftmscan.com/api",
104
+ key: ensureAndGet("SKYNET_FTMSCAN_API_KEY"),
99
105
  },
100
106
  scanUrl: "https://ftmscan.com/"
101
107
  },
@@ -104,12 +110,11 @@ const PROTOCOLS = {
104
110
  nativeTokenSymbol: "ALGO",
105
111
  nativeTokenDecimals: 6,
106
112
  nativeTokenAddress: "algo:native",
107
- endpoint: "algo-node.certik-skynet.com",
113
+ nativeTokenLogo: `https://token-logo.certik-assets.com/algo:native.png`,
114
+ nativeTokenCoinGeckoId: "algorand",
115
+ nativeTokenCmcId: 4030,
116
+ endpoint: "https://algo-node.certik-skynet.com/",
108
117
  tokenStandard: "ASA",
109
- scanApi: {
110
- endpoint: "https://algoindexer.algoexplorerapi.io/v2"
111
- },
112
- scanUrl: "https://algoexplorer.io/"
113
118
  }
114
119
  };
115
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.10.36",
3
+ "version": "0.10.38",
4
4
  "description": "Skynet Shared JS library",
5
5
  "main": "index.js",
6
6
  "author": "CertiK Engineering",