@certik/skynet 0.20.2 → 0.22.0
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 +17 -0
- package/abi.ts +2 -4
- package/api.ts +7 -7
- package/app.ts +6 -12
- package/availability.ts +37 -7
- package/bun.lockb +0 -0
- package/const.ts +1 -1
- package/date.ts +1 -1
- package/deploy.ts +4 -4
- package/dist/abi.d.ts +112 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +616 -0
- package/dist/address.d.ts +3 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +69 -0
- package/dist/api.d.ts +32 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +35174 -0
- package/dist/app.d.ts +102 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +71714 -0
- package/dist/availability.d.ts +24 -0
- package/dist/availability.d.ts.map +1 -0
- package/dist/availability.js +926 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +86 -0
- package/dist/const.d.ts +35 -0
- package/dist/const.d.ts.map +1 -0
- package/dist/const.js +207 -0
- package/dist/databricks.d.ts +4 -0
- package/dist/databricks.d.ts.map +1 -0
- package/dist/databricks.js +84920 -0
- package/dist/date.d.ts +6 -0
- package/dist/date.d.ts.map +1 -0
- package/dist/date.js +101 -0
- package/dist/deploy.d.ts +76 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +17506 -0
- package/dist/dynamodb.d.ts +17 -0
- package/dist/dynamodb.d.ts.map +1 -0
- package/dist/dynamodb.js +27365 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +71 -0
- package/dist/graphql.d.ts +6 -0
- package/dist/graphql.d.ts.map +1 -0
- package/dist/graphql.js +73 -0
- package/dist/indexer.d.ts +70 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +36979 -0
- package/dist/log.d.ts +14 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +108 -0
- package/dist/object-hash.d.ts +2 -0
- package/dist/object-hash.d.ts.map +1 -0
- package/dist/object-hash.js +446 -0
- package/dist/opsgenie.d.ts +21 -0
- package/dist/opsgenie.d.ts.map +1 -0
- package/dist/opsgenie.js +320 -0
- package/dist/por.d.ts +38 -0
- package/dist/por.d.ts.map +1 -0
- package/dist/por.js +164 -0
- package/dist/s3.d.ts +21 -0
- package/dist/s3.d.ts.map +1 -0
- package/dist/s3.js +28878 -0
- package/dist/search.d.ts +6 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +37754 -0
- package/dist/selector.d.ts +18 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +89 -0
- package/dist/slack.d.ts +9 -0
- package/dist/slack.d.ts.map +1 -0
- package/dist/slack.js +16844 -0
- package/dist/util.d.ts +5 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +72 -0
- package/dist/xxhash.win32-x64-msvc-hrdz34v7.node +0 -0
- package/examples/api.ts +1 -1
- package/examples/indexer.ts +1 -1
- package/examples/mode-indexer.ts +1 -1
- package/indexer.ts +11 -11
- package/log.ts +22 -4
- package/object-hash.ts +66 -0
- package/package.json +102 -4
- package/por.ts +181 -0
- package/search.ts +2 -2
- package/tsconfig.build.json +24 -0
- package/tsconfig.json +5 -5
- package/web3.ts +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.22.0
|
|
4
|
+
|
|
5
|
+
- Added TypeScript build system using Bun for fast compilation
|
|
6
|
+
- Added individual module exports for all library components
|
|
7
|
+
- Users can now import specific modules: `import { util } from '@certik/skynet/util'`
|
|
8
|
+
- Added TypeScript declaration files generation
|
|
9
|
+
- Enhanced package.json exports for better ESM support
|
|
10
|
+
- Added .gitignore for build artifacts
|
|
11
|
+
|
|
12
|
+
## 0.21.0
|
|
13
|
+
|
|
14
|
+
- BREAKING: Remove support for web3.js.
|
|
15
|
+
- Add `debug` log level to `log` library. They will only be printed when `NODE_ENV` is set to `development`.
|
|
16
|
+
- Hide all logs from `log` library when `NODE_ENV` is set to `test`.
|
|
17
|
+
- Add `throttle` and `memoize` to `availability` library.
|
|
18
|
+
- Add `object-hash` library for getting hash of an object. Based on xxhash algorithm.
|
|
19
|
+
|
|
3
20
|
## 0.20.2
|
|
4
21
|
|
|
5
22
|
- Make `options` in `withRetry` function optional
|
package/abi.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const ERC20: AbiFunctionFragment[] = [
|
|
1
|
+
export const ERC20 = [
|
|
4
2
|
{
|
|
5
3
|
constant: true,
|
|
6
4
|
inputs: [],
|
|
@@ -222,7 +220,7 @@ export const ERC20: AbiFunctionFragment[] = [
|
|
|
222
220
|
},
|
|
223
221
|
];
|
|
224
222
|
|
|
225
|
-
export const ERC721
|
|
223
|
+
export const ERC721 = [
|
|
226
224
|
{
|
|
227
225
|
inputs: [
|
|
228
226
|
{
|
package/api.ts
CHANGED
|
@@ -2,10 +2,10 @@ import osModule from "os";
|
|
|
2
2
|
import express from "express";
|
|
3
3
|
import type { Request, Response, NextFunction } from "express";
|
|
4
4
|
import meow from "meow";
|
|
5
|
-
import { getSelectorDesc, getSelectorFlags } from "./selector
|
|
6
|
-
import { isProduction } from "./env
|
|
7
|
-
import { inline } from "./log
|
|
8
|
-
import type { Selector } from "./selector
|
|
5
|
+
import { getSelectorDesc, getSelectorFlags } from "./selector";
|
|
6
|
+
import { isProduction } from "./env";
|
|
7
|
+
import { inline } from "./log";
|
|
8
|
+
import type { Selector } from "./selector";
|
|
9
9
|
|
|
10
10
|
export type Middleware = (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ type Serve = {
|
|
|
23
23
|
apiKey?: string | Record<string, string>;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
async function logStartMiddleware(
|
|
26
|
+
async function logStartMiddleware(_: Request, res: Response, next: NextFunction) {
|
|
27
27
|
const start = new Date();
|
|
28
28
|
|
|
29
29
|
res.set("x-requested-at", start.toISOString());
|
|
@@ -31,7 +31,7 @@ async function logStartMiddleware(req: Request, res: Response, next: NextFunctio
|
|
|
31
31
|
next();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
async function contextMiddleware(
|
|
34
|
+
async function contextMiddleware(_: Request, res: Response, next: NextFunction) {
|
|
35
35
|
res.set("x-instance-id", osModule.hostname());
|
|
36
36
|
|
|
37
37
|
next();
|
|
@@ -213,7 +213,7 @@ ${getSelectorDesc(selector)}
|
|
|
213
213
|
|
|
214
214
|
if (!routes.some((r) => r.path === "/" && r.method?.toUpperCase() === "GET")) {
|
|
215
215
|
// for health check
|
|
216
|
-
app.get("/", (
|
|
216
|
+
app.get("/", (_, res) => {
|
|
217
217
|
res.send("ok");
|
|
218
218
|
});
|
|
219
219
|
}
|
package/app.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { EOL } from "os";
|
|
2
|
-
import { createIndexerApp, createModeIndexerApp } from "./indexer
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ModeBuildFunction,
|
|
7
|
-
StatelessBuildFunction,
|
|
8
|
-
ValidateFunction,
|
|
9
|
-
} from "./indexer.ts";
|
|
10
|
-
import { createDeploy, createModeDeploy } from "./deploy.ts";
|
|
11
|
-
import type { Env } from "./deploy.ts";
|
|
2
|
+
import { createIndexerApp, createModeIndexerApp } from "./indexer";
|
|
3
|
+
import type { IndexerStateValue, State, ModeBuildFunction, StatelessBuildFunction, ValidateFunction } from "./indexer";
|
|
4
|
+
import { createDeploy, createModeDeploy } from "./deploy";
|
|
5
|
+
import type { Env } from "./deploy";
|
|
12
6
|
import { startApiApp } from "./api.js";
|
|
13
|
-
import type { Middleware } from "./api
|
|
7
|
+
import type { Middleware } from "./api";
|
|
14
8
|
import { getBinaryName, detectBin, detectWorkingDirectory } from "./cli.js";
|
|
15
|
-
import type { Selector } from "./selector
|
|
9
|
+
import type { Selector } from "./selector";
|
|
16
10
|
import type { Request, Response, Application } from "express";
|
|
17
11
|
|
|
18
12
|
type RouteDefinition = {
|
package/availability.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import pThrottle from "p-throttle";
|
|
2
|
+
import pMemoize, { type CacheStorage } from "p-memoize";
|
|
3
|
+
import type { AsyncReturnType } from "type-fest";
|
|
4
|
+
import QuickLRU from "quick-lru";
|
|
5
|
+
import { getHash } from "./object-hash";
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
export declare type AnyAsyncFunction = (...arguments_: readonly any[]) => Promise<any>;
|
|
9
|
+
|
|
1
10
|
export async function wait(time: number) {
|
|
2
11
|
return new Promise((resolve) => {
|
|
3
12
|
setTimeout(resolve, time);
|
|
@@ -47,28 +56,49 @@ export async function exponentialRetry<T>(
|
|
|
47
56
|
return result;
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
export function withRetry<F extends (...args: any[]) => any>(
|
|
59
|
+
export function withRetry<F extends AnyAsyncFunction>(
|
|
52
60
|
func: F,
|
|
53
61
|
options?: { maxRetry?: number; initialDuration?: number; growFactor?: number },
|
|
54
|
-
) {
|
|
62
|
+
): F {
|
|
55
63
|
let retries = options?.maxRetry || 3;
|
|
56
64
|
let duration = options?.initialDuration || 500;
|
|
57
65
|
const growFactorFinal = options?.growFactor || 2;
|
|
58
66
|
|
|
59
|
-
return async (...args: Parameters<F>): Promise<
|
|
67
|
+
return (async (...args: Parameters<F>): Promise<AsyncReturnType<F>> => {
|
|
60
68
|
do {
|
|
61
69
|
try {
|
|
62
70
|
return await func(...args);
|
|
63
71
|
} catch (error) {
|
|
64
72
|
retries = retries - 1;
|
|
65
|
-
if (retries
|
|
73
|
+
if (retries <= 0) {
|
|
66
74
|
throw error;
|
|
67
75
|
}
|
|
68
76
|
await wait(duration);
|
|
69
77
|
duration = duration * growFactorFinal;
|
|
70
78
|
}
|
|
71
|
-
} while (retries
|
|
79
|
+
} while (retries > 0);
|
|
72
80
|
throw new Error("unreachable");
|
|
73
|
-
};
|
|
81
|
+
}) as F;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function memoize<F extends AnyAsyncFunction>(
|
|
85
|
+
func: F,
|
|
86
|
+
options?: {
|
|
87
|
+
cache?: CacheStorage<string, AsyncReturnType<F>> | false;
|
|
88
|
+
cacheKey?: (args: Parameters<F>) => string;
|
|
89
|
+
lruMaxSize?: number;
|
|
90
|
+
},
|
|
91
|
+
) {
|
|
92
|
+
if (!options) {
|
|
93
|
+
options = {};
|
|
94
|
+
}
|
|
95
|
+
if (!options.cache) {
|
|
96
|
+
options.cache = new QuickLRU({ maxSize: options.lruMaxSize || 10000 });
|
|
97
|
+
}
|
|
98
|
+
if (!options.cacheKey) {
|
|
99
|
+
options.cacheKey = (args: Parameters<F>) => getHash(args);
|
|
100
|
+
}
|
|
101
|
+
return pMemoize<F, string>(func, options);
|
|
74
102
|
}
|
|
103
|
+
|
|
104
|
+
export { pThrottle as throttle };
|
package/bun.lockb
ADDED
|
Binary file
|
package/const.ts
CHANGED
package/date.ts
CHANGED
package/deploy.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { execa } from "execa";
|
|
|
4
4
|
import meow from "meow";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import which from "which";
|
|
7
|
-
import { getJobName, getSelectorDesc, getSelectorFlags } from "./selector
|
|
8
|
-
import type { Selector } from "./selector
|
|
9
|
-
import { getEnvOrThrow } from "./env
|
|
10
|
-
import { getBinaryName, detectSkynetDirectory } from "./cli
|
|
7
|
+
import { getJobName, getSelectorDesc, getSelectorFlags } from "./selector";
|
|
8
|
+
import type { Selector } from "./selector";
|
|
9
|
+
import { getEnvOrThrow } from "./env";
|
|
10
|
+
import { getBinaryName, detectSkynetDirectory } from "./cli";
|
|
11
11
|
import type { Writable } from "stream";
|
|
12
12
|
|
|
13
13
|
export type Env = {
|
package/dist/abi.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export declare const ERC20: ({
|
|
2
|
+
constant: boolean;
|
|
3
|
+
inputs: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}[];
|
|
7
|
+
name: string;
|
|
8
|
+
outputs: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
}[];
|
|
12
|
+
payable: boolean;
|
|
13
|
+
stateMutability: string;
|
|
14
|
+
type: string;
|
|
15
|
+
} | {
|
|
16
|
+
name: string;
|
|
17
|
+
payable: boolean;
|
|
18
|
+
stateMutability: string;
|
|
19
|
+
type: string;
|
|
20
|
+
constant?: undefined;
|
|
21
|
+
inputs?: undefined;
|
|
22
|
+
outputs?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
inputs: {
|
|
25
|
+
indexed: boolean;
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}[];
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
constant?: undefined;
|
|
32
|
+
outputs?: undefined;
|
|
33
|
+
payable?: undefined;
|
|
34
|
+
stateMutability?: undefined;
|
|
35
|
+
})[];
|
|
36
|
+
export declare const ERC721: ({
|
|
37
|
+
inputs: {
|
|
38
|
+
indexed: boolean;
|
|
39
|
+
internalType: string;
|
|
40
|
+
name: string;
|
|
41
|
+
type: string;
|
|
42
|
+
}[];
|
|
43
|
+
name: string;
|
|
44
|
+
type: string;
|
|
45
|
+
constant?: undefined;
|
|
46
|
+
outputs?: undefined;
|
|
47
|
+
payable?: undefined;
|
|
48
|
+
stateMutability?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
constant: boolean;
|
|
51
|
+
inputs: any[];
|
|
52
|
+
name: string;
|
|
53
|
+
outputs: {
|
|
54
|
+
name: string;
|
|
55
|
+
type: string;
|
|
56
|
+
}[];
|
|
57
|
+
payable: boolean;
|
|
58
|
+
stateMutability: string;
|
|
59
|
+
type: string;
|
|
60
|
+
} | {
|
|
61
|
+
inputs: {
|
|
62
|
+
internalType: string;
|
|
63
|
+
name: string;
|
|
64
|
+
type: string;
|
|
65
|
+
}[];
|
|
66
|
+
name: string;
|
|
67
|
+
outputs: {
|
|
68
|
+
internalType: string;
|
|
69
|
+
name: string;
|
|
70
|
+
type: string;
|
|
71
|
+
}[];
|
|
72
|
+
stateMutability: string;
|
|
73
|
+
type: string;
|
|
74
|
+
constant?: undefined;
|
|
75
|
+
payable?: undefined;
|
|
76
|
+
})[];
|
|
77
|
+
export declare const BEP20: ({
|
|
78
|
+
constant: boolean;
|
|
79
|
+
inputs: {
|
|
80
|
+
name: string;
|
|
81
|
+
type: string;
|
|
82
|
+
}[];
|
|
83
|
+
name: string;
|
|
84
|
+
outputs: {
|
|
85
|
+
name: string;
|
|
86
|
+
type: string;
|
|
87
|
+
}[];
|
|
88
|
+
payable: boolean;
|
|
89
|
+
stateMutability: string;
|
|
90
|
+
type: string;
|
|
91
|
+
} | {
|
|
92
|
+
name: string;
|
|
93
|
+
payable: boolean;
|
|
94
|
+
stateMutability: string;
|
|
95
|
+
type: string;
|
|
96
|
+
constant?: undefined;
|
|
97
|
+
inputs?: undefined;
|
|
98
|
+
outputs?: undefined;
|
|
99
|
+
} | {
|
|
100
|
+
inputs: {
|
|
101
|
+
indexed: boolean;
|
|
102
|
+
name: string;
|
|
103
|
+
type: string;
|
|
104
|
+
}[];
|
|
105
|
+
name: string;
|
|
106
|
+
type: string;
|
|
107
|
+
constant?: undefined;
|
|
108
|
+
outputs?: undefined;
|
|
109
|
+
payable?: undefined;
|
|
110
|
+
stateMutability?: undefined;
|
|
111
|
+
})[];
|
|
112
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4NjB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsVlB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAQ,CAAC"}
|