@certik/skynet 0.10.24 → 0.10.27

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.27
4
+
5
+ - Fixed `deploy` library aws region bug
6
+
7
+ ## 0.10.26
8
+
9
+ - Improved support for AVAX and FTM in const.js
10
+ - Added `beforeListen` parameter to `api` library
11
+
12
+ ## 0.10.25
13
+
14
+ - Added support for AVAX and FTM in const.js
15
+
3
16
  ## 0.10.24
4
17
 
5
18
  - Added type definitions
package/api.d.ts CHANGED
@@ -9,5 +9,6 @@ export function startApiApp(params: {
9
9
  port: string | undefined;
10
10
  apiKey: string;
11
11
  prefix: string | undefined;
12
- }
12
+ };
13
+ beforeListen: () => void;
13
14
  }): void;
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
@@ -114,6 +114,7 @@ export function api(apiParams: {
114
114
  serve: Serve;
115
115
  env: Env | undefined;
116
116
  region: string | undefined;
117
+ beforeListen: () => void;
117
118
  }): () => void;
118
119
 
119
120
  export function consumer(consumerParams: {
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
- getEtherScanApiKey,
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: getEtherScanApiKey(),
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: getBscScanApiKey(),
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: getPolygonScanApiKey(),
61
+ key: getEnvironment("SKYNET_POLYGON_SCAN_API_KEY"),
64
62
  },
65
63
  multiCallProvider: "0x8eC86392e0aDB57d00fDffbA39b8870e107c0757",
66
64
  scanUrl: "https://polygonscan.com/",
@@ -74,6 +72,32 @@ const PROTOCOLS = {
74
72
  tokenStandard: "HRC20",
75
73
  multiCallProvider: "0xe7144e57d832c9005d252f415d205b4b8d78228e",
76
74
  scanUrl: "https://hecoinfo.com/"
75
+ },
76
+ avax: {
77
+ nativeTokenName: "Avalanche",
78
+ nativeTokenSymbol: "AVAX",
79
+ nativeTokenDecimals: 18,
80
+ nativeTokenAddress: "avax:0x0000000000000000000000000000000000000000",
81
+ endpoint: `https://api.avax.network/ext/bc/C/rpc`,
82
+ tokenStandard: "ARC20",
83
+ scanApi: {
84
+ endpoint: "https://api.snowtrace.io",
85
+ key: getEnvironment("SKYNET_AVASCAN_API_KEY"),
86
+ },
87
+ scanUrl: "https://snowtrace.io/"
88
+ },
89
+ ftm: {
90
+ nativeTokenName: "Fantom",
91
+ nativeTokenSymbol: "FTM",
92
+ nativeTokenDecimals: 18,
93
+ nativeTokenAddress: "ftm:0x0000000000000000000000000000000000000000",
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
+ },
100
+ scanUrl: "https://ftmscan.com/"
77
101
  }
78
102
  };
79
103
 
package/deploy.js CHANGED
@@ -108,7 +108,6 @@ const genConfig = ({
108
108
 
109
109
  env {
110
110
  SKYNET_ENVIRONMENT="${isProduction ? "prd" : "dev"}"
111
- AWS_REGION="${region}"
112
111
  }
113
112
 
114
113
  kill_timeout = "120s"
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.10.24",
3
+ "version": "0.10.27",
4
4
  "description": "Skynet Shared JS library",
5
5
  "main": "index.js",
6
6
  "author": "CertiK Engineering",