@certik/skynet 0.10.22 → 0.10.25
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 +12 -0
- package/abi.d.ts +20 -0
- package/ably.d.ts +3 -0
- package/address.d.ts +2 -0
- package/api.d.ts +13 -0
- package/api.js +3 -1
- package/app.d.ts +158 -0
- package/availability.d.ts +11 -0
- package/block.d.ts +49 -0
- package/cli.d.ts +4 -0
- package/const.d.ts +37 -0
- package/const.js +13 -0
- package/deploy.d.ts +41 -0
- package/distributed-lock.d.ts +1 -0
- package/dynamodb.d.ts +67 -0
- package/env.d.ts +14 -0
- package/indexer.d.ts +30 -0
- package/inquiry.d.ts +3 -0
- package/kafka.d.ts +39 -0
- package/labelling.d.ts +15 -0
- package/log.d.ts +5 -0
- package/metric.d.ts +10 -0
- package/monitor.d.ts +24 -0
- package/opsgenie.d.ts +7 -0
- package/package.json +1 -1
- package/price.d.ts +8 -0
- package/primitive.d.ts +29 -0
- package/proxy.d.ts +11 -0
- package/rateLimit.d.ts +1 -0
- package/s3.d.ts +16 -0
- package/scan.d.ts +47 -0
- package/selector.d.ts +19 -0
- package/slack.d.ts +5 -0
- package/snowflake.d.ts +4 -0
- package/sqs.d.ts +3 -0
- package/token.d.ts +5 -0
- package/transaction.d.ts +30 -0
- package/util.d.ts +5 -0
- package/web3.d.ts +23 -0
package/CHANGELOG.md
CHANGED
package/abi.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type ContractIO = {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
internalType: string | undefined;
|
|
5
|
+
components: ContractIO[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type ABI = {
|
|
9
|
+
constant: boolean;
|
|
10
|
+
inputs: ContractIO[];
|
|
11
|
+
name: string;
|
|
12
|
+
outputs: ContractIO[];
|
|
13
|
+
payable: boolean;
|
|
14
|
+
stateMutability: string;
|
|
15
|
+
type: string;
|
|
16
|
+
}[];
|
|
17
|
+
|
|
18
|
+
export const ERC20: ABI;
|
|
19
|
+
export const MULTICALL: ABI;
|
|
20
|
+
export const BEP20: ABI;
|
package/ably.d.ts
ADDED
package/address.d.ts
ADDED
package/api.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Selector } from "./selector";
|
|
2
|
+
|
|
3
|
+
export function startApiApp(params: {
|
|
4
|
+
binaryName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
selector: Selector;
|
|
7
|
+
routes: string[];
|
|
8
|
+
serve: {
|
|
9
|
+
port: string | undefined;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
prefix: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
}): void;
|
package/api.js
CHANGED
|
@@ -117,7 +117,7 @@ ${getSelectorDesc(selector)}
|
|
|
117
117
|
route.path,
|
|
118
118
|
logStartMiddleware,
|
|
119
119
|
...middlewares,
|
|
120
|
-
async (req, res) => {
|
|
120
|
+
async (req, res, next) => {
|
|
121
121
|
try {
|
|
122
122
|
await route.handler({ req, res, ...selectorFlags });
|
|
123
123
|
} catch (routeErr) {
|
|
@@ -125,6 +125,8 @@ ${getSelectorDesc(selector)}
|
|
|
125
125
|
|
|
126
126
|
res.status(500).send(`internal server error: ${routeErr.message}`);
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
next();
|
|
128
130
|
},
|
|
129
131
|
logEndMiddleware
|
|
130
132
|
);
|
package/app.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ERROR_LEVEL } from "./monitor";
|
|
2
|
+
import { Selector } from "./selector";
|
|
3
|
+
|
|
4
|
+
export type Env = {
|
|
5
|
+
[key: string]: string | null
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type Route = {
|
|
9
|
+
method: "POST" | "PUT" | "PATCH" | "GET" | "POST" | "DELETE" | "OPTIONS";
|
|
10
|
+
path: string;
|
|
11
|
+
handler: ({ req, res }: { req: any, res: any }) => Promise<void>;
|
|
12
|
+
protected: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Serve = {
|
|
16
|
+
prefix: string;
|
|
17
|
+
port: number;
|
|
18
|
+
apiKey: string;
|
|
19
|
+
cpu: number;
|
|
20
|
+
mem: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Consume = {
|
|
24
|
+
func: ({ protocol, messages, verbose }: {
|
|
25
|
+
protocol: string;
|
|
26
|
+
messages: any;
|
|
27
|
+
verbose: boolean;
|
|
28
|
+
}) => Promise<void>;
|
|
29
|
+
topic: ({ protocol }: { protocol: string }) => string;
|
|
30
|
+
maxRetry: number;
|
|
31
|
+
cpu: number;
|
|
32
|
+
mem: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type State = {
|
|
36
|
+
type: string;
|
|
37
|
+
updateInterval: ({ protocol }: { protocol: string }) => number;
|
|
38
|
+
getMinId: () => Promise<number>;
|
|
39
|
+
getMaxId: ({ protocol }: { protocol: string }) => Promise<number>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type Produce = {
|
|
43
|
+
func: ({ protocol, from, to, verbose, send }: {
|
|
44
|
+
protocol: string;
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
verbose: boolean;
|
|
48
|
+
send: (items: { id: string, name: string }[]) => Promise<void>;
|
|
49
|
+
}) => Promise<void>;
|
|
50
|
+
topic: ({ protocol }) => string;
|
|
51
|
+
deadLetterTopic: ({ protocol }) => string;
|
|
52
|
+
batchSize: number;
|
|
53
|
+
maxRetry: number;
|
|
54
|
+
cpu: number;
|
|
55
|
+
mem: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type Check = {
|
|
59
|
+
func: ({ protocol, state, verbose }: { protocol: string, state: string, verbose: boolean })
|
|
60
|
+
=> ({ type: string, message: string });
|
|
61
|
+
schedule: string;
|
|
62
|
+
slackChannel: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type Build = {
|
|
66
|
+
func: ({ protocol, from, to, verbose }: { protocol: string, from: number, to: number, verbose: boolean })
|
|
67
|
+
=> void;
|
|
68
|
+
batchSize: number;
|
|
69
|
+
schedule: string;
|
|
70
|
+
cpu: number;
|
|
71
|
+
mem: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type Restart = {
|
|
75
|
+
attempts: number | undefined;
|
|
76
|
+
mode: string | undefined;
|
|
77
|
+
interval: string | undefined;
|
|
78
|
+
delay: string | undefined
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type Validate = {
|
|
82
|
+
func: ({ protocol, from, to, verbose }: { protocol: string, from: number, to: number, verbose: boolean })
|
|
83
|
+
=> void;
|
|
84
|
+
batchSize: number;
|
|
85
|
+
schedule: string;
|
|
86
|
+
cpu: number;
|
|
87
|
+
mem: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type BuildWithConcurrency = Build | { concurrency: number | undefined };
|
|
91
|
+
|
|
92
|
+
type ValidateWithConcurrency = Validate | { concurrency: number | undefined };
|
|
93
|
+
|
|
94
|
+
export const SENSITIVE_VALUE: null;
|
|
95
|
+
|
|
96
|
+
export { ERROR_LEVEL };
|
|
97
|
+
|
|
98
|
+
export function every(n: number | undefined): {
|
|
99
|
+
second: string
|
|
100
|
+
seconds: string,
|
|
101
|
+
minute: string,
|
|
102
|
+
minutes: string,
|
|
103
|
+
hour: string,
|
|
104
|
+
hours: string,
|
|
105
|
+
day: string,
|
|
106
|
+
days: string,
|
|
107
|
+
week: string,
|
|
108
|
+
weeks: string,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function api(apiParams: {
|
|
112
|
+
name: string;
|
|
113
|
+
routes: Route[];
|
|
114
|
+
serve: Serve;
|
|
115
|
+
env: Env | undefined;
|
|
116
|
+
region: string | undefined;
|
|
117
|
+
}): () => void;
|
|
118
|
+
|
|
119
|
+
export function consumer(consumerParams: {
|
|
120
|
+
name: string;
|
|
121
|
+
selector: Selector;
|
|
122
|
+
consume: Consume;
|
|
123
|
+
check: Check;
|
|
124
|
+
env: Env | undefined;
|
|
125
|
+
region: string | undefined;
|
|
126
|
+
}): () => void;
|
|
127
|
+
|
|
128
|
+
export function producer(producerParams: {
|
|
129
|
+
name: string;
|
|
130
|
+
selector: Selector;
|
|
131
|
+
produce: Produce;
|
|
132
|
+
check: Check;
|
|
133
|
+
state: State;
|
|
134
|
+
env: Env | undefined;
|
|
135
|
+
region: string | undefined;
|
|
136
|
+
}): () => void;
|
|
137
|
+
|
|
138
|
+
export function indexer(indexerParams: {
|
|
139
|
+
name: string;
|
|
140
|
+
selector: Selector;
|
|
141
|
+
state: State;
|
|
142
|
+
build: Build | { restart: Restart | undefined };
|
|
143
|
+
validate: Validate;
|
|
144
|
+
check: Check;
|
|
145
|
+
env: Env | undefined;
|
|
146
|
+
region: string | undefined;
|
|
147
|
+
}): () => void;
|
|
148
|
+
|
|
149
|
+
export function modeIndexer(modeIndexerParams: {
|
|
150
|
+
name: string;
|
|
151
|
+
selector: Selector;
|
|
152
|
+
state: State;
|
|
153
|
+
build: BuildWithConcurrency;
|
|
154
|
+
validate: ValidateWithConcurrency;
|
|
155
|
+
check: Check;
|
|
156
|
+
env: Env | undefined;
|
|
157
|
+
region: string | undefined;
|
|
158
|
+
}): () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function wait(time: number | undefined): Promise<void>;
|
|
2
|
+
export function retry(times: number, verbose: boolean, func: Function): Promise<void>;
|
|
3
|
+
export function exponentialRetry<T>(func: () => Promise<T>, { maxRetry, initialDuration, growFactor, test, verbose }:
|
|
4
|
+
{
|
|
5
|
+
maxRetry: number,
|
|
6
|
+
initialDuration: number | undefined,
|
|
7
|
+
growFactor: number | undefined,
|
|
8
|
+
test: (result: T) => boolean,
|
|
9
|
+
verbose: boolean
|
|
10
|
+
}
|
|
11
|
+
): Promise<T>;
|
package/block.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// See https://www.quicknode.com/docs/ethereum/eth_getBlockByNumber for a complete reference.
|
|
2
|
+
|
|
3
|
+
type Transaction = {
|
|
4
|
+
blockHash: string;
|
|
5
|
+
blockNumber: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
to: string;
|
|
8
|
+
from: string;
|
|
9
|
+
transactionIndex: string;
|
|
10
|
+
value: string | undefined;
|
|
11
|
+
nonce: string;
|
|
12
|
+
gas: string;
|
|
13
|
+
gasPrice: string;
|
|
14
|
+
input: string;
|
|
15
|
+
type: string;
|
|
16
|
+
chainId: string | undefined;
|
|
17
|
+
v: string;
|
|
18
|
+
r: string;
|
|
19
|
+
s: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type BlockInfo = {
|
|
23
|
+
number: string;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
difficulty: string;
|
|
26
|
+
extraData: string;
|
|
27
|
+
gasLimit: string;
|
|
28
|
+
gasUsed: string;
|
|
29
|
+
hash: string;
|
|
30
|
+
logsBloom: string;
|
|
31
|
+
miner: string;
|
|
32
|
+
mixHash: string;
|
|
33
|
+
nonce: string;
|
|
34
|
+
parentHash: string;
|
|
35
|
+
receiptsRoot: string;
|
|
36
|
+
sha3Uncles: string;
|
|
37
|
+
size: string;
|
|
38
|
+
stateRoot: string;
|
|
39
|
+
totalDifficulty: string;
|
|
40
|
+
transactions: Transaction[];
|
|
41
|
+
transactionsRoot: string;
|
|
42
|
+
uncles: string[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getLatestBlockHeight(protocol: string): Promise<number>;
|
|
46
|
+
export function getBlock(protocol: string, height: number): Promise<BlockInfo>;
|
|
47
|
+
export function getBlockS3Path(protocol: string, height: number): string;
|
|
48
|
+
export function getLatestS3BlockHeight(protocol: string): Promise<number>;
|
|
49
|
+
export function getBlockFromS3(protocol: string, height: number): Promise<BlockInfo>;
|
package/cli.d.ts
ADDED
package/const.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type Protocol = {
|
|
2
|
+
nativeTokenName: string,
|
|
3
|
+
nativeTokenSymbol: string,
|
|
4
|
+
nativeTokenDecimals: number,
|
|
5
|
+
nativeTokenAddress: string,
|
|
6
|
+
nativeTokenLogo: string,
|
|
7
|
+
nativeTokenCoinGeckoId: string,
|
|
8
|
+
nativeTokenCmcId: number,
|
|
9
|
+
endpoint: string,
|
|
10
|
+
archiveEndpoint: string,
|
|
11
|
+
tokenStandard: string,
|
|
12
|
+
scanApi: {
|
|
13
|
+
endpoint: string,
|
|
14
|
+
key: string,
|
|
15
|
+
},
|
|
16
|
+
multiCallProvider: string,
|
|
17
|
+
scanUrl: string,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type TimeIntervals = {
|
|
21
|
+
MINUTE: number,
|
|
22
|
+
HOUR: number,
|
|
23
|
+
DAY: number,
|
|
24
|
+
WEEK: number,
|
|
25
|
+
YEAR: number,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const SKYNET_API_PREFIX: string;
|
|
29
|
+
export const PROTOCOLS: {
|
|
30
|
+
eth: Protocol,
|
|
31
|
+
bsc: Protocol,
|
|
32
|
+
polygon: Protocol
|
|
33
|
+
}
|
|
34
|
+
export const TIME: {
|
|
35
|
+
BY_MS: TimeIntervals,
|
|
36
|
+
BY_S: TimeIntervals,
|
|
37
|
+
}
|
package/const.js
CHANGED
|
@@ -74,6 +74,19 @@ const PROTOCOLS = {
|
|
|
74
74
|
tokenStandard: "HRC20",
|
|
75
75
|
multiCallProvider: "0xe7144e57d832c9005d252f415d205b4b8d78228e",
|
|
76
76
|
scanUrl: "https://hecoinfo.com/"
|
|
77
|
+
},
|
|
78
|
+
avax: {
|
|
79
|
+
nativeTokenName: "Avalanche",
|
|
80
|
+
nativeTokenSymbol: "AVAX",
|
|
81
|
+
endpoint: `https://api.avax.network/ext/bc/C/rpc`,
|
|
82
|
+
tokenStandard: "ARC20",
|
|
83
|
+
scanUrl: "https://avascan.info/"
|
|
84
|
+
},
|
|
85
|
+
ftm: {
|
|
86
|
+
nativeTokenName: "Fantom",
|
|
87
|
+
nativeTokenSymbol: "FTM",
|
|
88
|
+
endpoint: `https://rpcapi.fantom.network`,
|
|
89
|
+
scanUrl: "https://ftmscan.com/"
|
|
77
90
|
}
|
|
78
91
|
};
|
|
79
92
|
|
package/deploy.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getJobName } from "./selector";
|
|
2
|
+
import { Env, Selector, Check, Restart } from "./app";
|
|
3
|
+
|
|
4
|
+
type Service = {
|
|
5
|
+
prefix: string;
|
|
6
|
+
port: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type CreateDeployBaseParams = {
|
|
10
|
+
binaryName: string,
|
|
11
|
+
name: string,
|
|
12
|
+
workingDirectory: string,
|
|
13
|
+
bin: string | undefined,
|
|
14
|
+
selector: Selector | undefined,
|
|
15
|
+
env: Env | undefined,
|
|
16
|
+
region: string | undefined,
|
|
17
|
+
check: Check,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { getJobName };
|
|
21
|
+
|
|
22
|
+
export function getNomadAddr(isProduction: boolean): Promise<string | undefined>;
|
|
23
|
+
|
|
24
|
+
export function createModeDeploy(createModeDeployParams: CreateDeployBaseParams | {
|
|
25
|
+
deltaSchedule: string,
|
|
26
|
+
validateSchedule: string,
|
|
27
|
+
deltaCpu: number,
|
|
28
|
+
deltaMem: number,
|
|
29
|
+
rebuildCpu: number,
|
|
30
|
+
rebuildMem: number,
|
|
31
|
+
validateCpu: number,
|
|
32
|
+
validateMem: number,
|
|
33
|
+
}): { deploy: () => void };
|
|
34
|
+
|
|
35
|
+
export function createDeploy(createDeployParams: CreateDeployBaseParams | {
|
|
36
|
+
schedule: string,
|
|
37
|
+
restart: Restart | undefined,
|
|
38
|
+
cpu: number,
|
|
39
|
+
mem: number,
|
|
40
|
+
service: Service,
|
|
41
|
+
}): { deploy: () => void };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useLock(useLockParams: { name: string, ttl: string, verbose: boolean }): Promise<string | null>
|
package/dynamodb.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DynamoDB } from "aws-sdk";
|
|
2
|
+
|
|
3
|
+
type Keys = { [key: string]: any };
|
|
4
|
+
|
|
5
|
+
type Fields = { [key: string]: any };
|
|
6
|
+
|
|
7
|
+
export function getDocClient(): DynamoDB.DocumentClient;
|
|
8
|
+
|
|
9
|
+
export function scanWholeTable(options: DynamoDB.DocumentClient.ScanInput):
|
|
10
|
+
Promise<{
|
|
11
|
+
Items: any[];
|
|
12
|
+
Count: number;
|
|
13
|
+
ScannedCount: number;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export function batchCreateRecords(
|
|
17
|
+
tableName: string,
|
|
18
|
+
records: any[],
|
|
19
|
+
maxWritingCapacity: number,
|
|
20
|
+
verbose: boolean | undefined
|
|
21
|
+
): Promise<void>;
|
|
22
|
+
|
|
23
|
+
export function createRecord(
|
|
24
|
+
tableName: string,
|
|
25
|
+
fields: Fields,
|
|
26
|
+
verbose: boolean | undefined
|
|
27
|
+
): Promise<void>;
|
|
28
|
+
|
|
29
|
+
export function getRecordsByKey(
|
|
30
|
+
tableName: string,
|
|
31
|
+
keys: Keys,
|
|
32
|
+
indexName: string
|
|
33
|
+
): Promise<DynamoDB.DocumentClient.ItemList | null | undefined>;
|
|
34
|
+
|
|
35
|
+
export function getRecordByKey(
|
|
36
|
+
tableName: string,
|
|
37
|
+
keys: Keys,
|
|
38
|
+
indexName: string
|
|
39
|
+
): Promise<DynamoDB.DocumentClient.AttributeMap | null>;
|
|
40
|
+
|
|
41
|
+
export function updateRecordByKey(
|
|
42
|
+
tableName: string,
|
|
43
|
+
idKey: Keys,
|
|
44
|
+
fields: Fields,
|
|
45
|
+
conditionExpressions: string | undefined,
|
|
46
|
+
verbose: boolean | undefined
|
|
47
|
+
): Promise<DynamoDB.DocumentClient.AttributeMap | undefined>;
|
|
48
|
+
|
|
49
|
+
export function batchDeleteRecords(
|
|
50
|
+
tableName: string,
|
|
51
|
+
keys: Keys
|
|
52
|
+
): Promise<void>;
|
|
53
|
+
|
|
54
|
+
export function deleteRecordsByHashKey(
|
|
55
|
+
tableName: string,
|
|
56
|
+
indexName: string | undefined,
|
|
57
|
+
hashKeyValue: string,
|
|
58
|
+
verbose: boolean | undefined
|
|
59
|
+
): Promise<number>;
|
|
60
|
+
|
|
61
|
+
export function createTableIfNotExist(
|
|
62
|
+
tableName: string,
|
|
63
|
+
attributeDefinitions: DynamoDB.AttributeDefinitions,
|
|
64
|
+
keySchema: DynamoDB.KeySchema,
|
|
65
|
+
options: DynamoDB.DocumentClient.CreateTableInput,
|
|
66
|
+
verbose: boolean | undefined
|
|
67
|
+
): Promise<void>
|
package/env.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function ensureAndGet<T>(envName: string, defaultValue: T): string | T;
|
|
2
|
+
export function getEnvOrThrow(envName: string): string;
|
|
3
|
+
export function getAWSAccessKeyId(): string | undefined;
|
|
4
|
+
export function getAWSSecretAccessKey(): string | undefined;
|
|
5
|
+
export function getAWSRegion(): string;
|
|
6
|
+
export function getEnvironment(): string;
|
|
7
|
+
export function getEtherScanApiKey(): string | undefined;
|
|
8
|
+
export function getBscScanApiKey(): string | undefined;
|
|
9
|
+
export function getPolygonScanApiKey(): string | undefined;
|
|
10
|
+
export function getGetBlockApiKey(): string | undefined;
|
|
11
|
+
export function getAlchemyApiKey(identifier: string): string | undefined;
|
|
12
|
+
export function getNodeRealApiKey(identifier: string): string | undefined;
|
|
13
|
+
export function isProduction(): boolean;
|
|
14
|
+
export function isDev(): boolean;
|
package/indexer.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// module.exports = {
|
|
2
|
+
// getIndexerValidatedId,
|
|
3
|
+
// };
|
|
4
|
+
import { Build, State, Validate } from "./app";
|
|
5
|
+
import { SelectorFlags, Selector } from "./selector";
|
|
6
|
+
|
|
7
|
+
type CreateIndexerAppBaseParams = {
|
|
8
|
+
binaryName: string,
|
|
9
|
+
name: string,
|
|
10
|
+
selector: Selector | undefined,
|
|
11
|
+
build: Build,
|
|
12
|
+
maxRetry: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createModeIndexerApp(createModeIndexerAppParams: {
|
|
16
|
+
buildBatchSize: number | undefined,
|
|
17
|
+
buildConcurrency: number | undefined,
|
|
18
|
+
validate: Validate,
|
|
19
|
+
validateBatchSize: number | undefined,
|
|
20
|
+
validateConcurrency: number | undefined,
|
|
21
|
+
state: State,
|
|
22
|
+
} | CreateIndexerAppBaseParams): { run: () => void };
|
|
23
|
+
|
|
24
|
+
export function createIndexerApp(createModeIndexerAppParams: CreateIndexerAppBaseParams): { run: () => void };
|
|
25
|
+
|
|
26
|
+
export function getIndexerState(name: string, selectorFlags: SelectorFlags): Promise<string>;
|
|
27
|
+
|
|
28
|
+
export function getIndexerLatestId(name: string, selectorFlags: SelectorFlags): Promise<number>;
|
|
29
|
+
|
|
30
|
+
export function getIndexerValidatedId(name: string, selectorFlags: SelectorFlags): Promise<number>;
|
package/inquiry.d.ts
ADDED
package/kafka.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { KafkaMessage } from "kafkajs";
|
|
2
|
+
import { Producer, State } from "./app";
|
|
3
|
+
import { SelectorFlags, Selector } from "./selector";
|
|
4
|
+
|
|
5
|
+
export function createProducerApp(createProducerAppParams: {
|
|
6
|
+
binaryName: string,
|
|
7
|
+
name: string,
|
|
8
|
+
selector: Selector | undefined,
|
|
9
|
+
producer: Producer,
|
|
10
|
+
state: State
|
|
11
|
+
}): { run: () => Promise<void> };
|
|
12
|
+
|
|
13
|
+
export function createConsumerApp(createConsumerAppParams: {
|
|
14
|
+
binaryName: string,
|
|
15
|
+
name: string,
|
|
16
|
+
selector: Selector | undefined,
|
|
17
|
+
consumer: Consumer
|
|
18
|
+
}): { run: () => Promise<void> };
|
|
19
|
+
|
|
20
|
+
export function produceMessages(
|
|
21
|
+
producerId: string,
|
|
22
|
+
callback: (
|
|
23
|
+
send: (topic: any, messages: any) => Promise<void>
|
|
24
|
+
) => Promise<void>
|
|
25
|
+
): Promise<void>;
|
|
26
|
+
|
|
27
|
+
export function consumeMessages(
|
|
28
|
+
consumerId: string,
|
|
29
|
+
topic: string | RegExp,
|
|
30
|
+
callback: (
|
|
31
|
+
message: KafkaMessage,
|
|
32
|
+
stopConsumeMessages: () => Promise<void>
|
|
33
|
+
) => Promise<void>
|
|
34
|
+
): Promise<() => Promise<void>>;
|
|
35
|
+
|
|
36
|
+
export function getProducerLatestId(
|
|
37
|
+
name: string,
|
|
38
|
+
selectorFlags: SelectorFlags
|
|
39
|
+
): Promise<number>;
|
package/labelling.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Tag = {
|
|
2
|
+
type: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function addTagsToAddress(
|
|
7
|
+
address: string,
|
|
8
|
+
tags: Tag[],
|
|
9
|
+
verbose: boolean
|
|
10
|
+
): Promise<{
|
|
11
|
+
tableName: string;
|
|
12
|
+
updateItemTags: Tag[];
|
|
13
|
+
} | undefined>;
|
|
14
|
+
|
|
15
|
+
export function queryAddressTags(address: string): Promise<Tag[]>;
|
package/log.d.ts
ADDED
package/metric.d.ts
ADDED
package/monitor.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Check } from "./app";
|
|
2
|
+
import { SelectorFlags, Selector } from "./selector";
|
|
3
|
+
|
|
4
|
+
export const ERROR_LEVEL: {
|
|
5
|
+
INFO: string,
|
|
6
|
+
CRITICAL: string,
|
|
7
|
+
WARNING: string
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const LEVEL_EMOJI: {
|
|
11
|
+
Info: string,
|
|
12
|
+
Critical: string,
|
|
13
|
+
Warning: string
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function createMonitor(createMonitorParams: {
|
|
17
|
+
binaryName: string,
|
|
18
|
+
name: string,
|
|
19
|
+
getState: ((name: string, selectorFlags: SelectorFlags) => Promise<void>) | undefined,
|
|
20
|
+
mode: boolean | undefined,
|
|
21
|
+
selector: Selector,
|
|
22
|
+
check: Check,
|
|
23
|
+
maxRetry: number | undefined
|
|
24
|
+
}): { monitor: () => void };
|
package/opsgenie.d.ts
ADDED
package/package.json
CHANGED
package/price.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type PricePreviousRecord = {
|
|
2
|
+
address: string;
|
|
3
|
+
price: number;
|
|
4
|
+
timestamp: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getPriceClosestTo(tableName: string, address: string, timestamp: number): Promise<number>;
|
|
8
|
+
export function getPricePreviousRecord(tableName: string, address: string, timestamp: number): Promise<PricePreviousRecord | null>;
|
package/primitive.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DynamoDB } from "aws-sdk";
|
|
2
|
+
|
|
3
|
+
type Issue = {
|
|
4
|
+
code: string;
|
|
5
|
+
link: string;
|
|
6
|
+
reduction: number;
|
|
7
|
+
title: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getOverrides(
|
|
11
|
+
docClient: DynamoDB.DocumentClient,
|
|
12
|
+
projectId: string,
|
|
13
|
+
address: string,
|
|
14
|
+
log: (...data: any[]) => void,
|
|
15
|
+
primitive: string
|
|
16
|
+
): Promise<string[] | null>;
|
|
17
|
+
|
|
18
|
+
export function overrideScoreAndIssues(
|
|
19
|
+
docClient: DynamoDB.DocumentClient,
|
|
20
|
+
projectId: string,
|
|
21
|
+
address: string,
|
|
22
|
+
score: number,
|
|
23
|
+
issues: Issue[],
|
|
24
|
+
log: (...data: any[]) => void,
|
|
25
|
+
primitive: string
|
|
26
|
+
): Promise<{
|
|
27
|
+
score: number;
|
|
28
|
+
issues: Issue[];
|
|
29
|
+
}>
|
package/proxy.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RequestInit, Response } from "node-fetch";
|
|
2
|
+
|
|
3
|
+
type Options = {
|
|
4
|
+
verbose: boolean;
|
|
5
|
+
timeout: number;
|
|
6
|
+
headers: {
|
|
7
|
+
[header: string]: string;
|
|
8
|
+
}
|
|
9
|
+
} | RequestInit;
|
|
10
|
+
|
|
11
|
+
export default function proxyFetch(url: string, options: Partial<Options> | undefined): Promise<Response>;
|
package/rateLimit.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function isRateLimited(name: string, unitTime: number, maxAccess: number): Promise<boolean>;
|
package/s3.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { S3 } from "aws-sdk";
|
|
2
|
+
|
|
3
|
+
type WriteOptions = {
|
|
4
|
+
verbose: boolean;
|
|
5
|
+
acl: string;
|
|
6
|
+
skipIfExists: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getS3(): S3;
|
|
10
|
+
export function readFile(bucketName: string, key: string, verbose: boolean | undefined): Promise<string | null>;
|
|
11
|
+
export function hasFile(bucketName: string, key: string): Promise<boolean>;
|
|
12
|
+
export function writeFile(bucketName: string, key: string, body: any, options: Partial<WriteOptions> | undefined): Promise<void>;
|
|
13
|
+
export function deleteFile(bucketName: string, key: string, verbose: boolean | undefined): Promise<void>;
|
|
14
|
+
export function listKeys(bucketname: string, prefix: string, continuationToken: string | undefined): Promise<{
|
|
15
|
+
keys: (string | undefined)[];
|
|
16
|
+
} | null>;
|
package/scan.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type Transaction = {
|
|
2
|
+
blockNumber: string,
|
|
3
|
+
timeStamp: string,
|
|
4
|
+
hash: string,
|
|
5
|
+
nonce: string,
|
|
6
|
+
blockHash: string,
|
|
7
|
+
transactionIndex: string,
|
|
8
|
+
from: string,
|
|
9
|
+
to: string,
|
|
10
|
+
value: string | undefined,
|
|
11
|
+
gas: string,
|
|
12
|
+
gasPrice: string,
|
|
13
|
+
isError: string,
|
|
14
|
+
txreceipt_status: string,
|
|
15
|
+
input: string,
|
|
16
|
+
contractAddress: string,
|
|
17
|
+
cumulativeGasUsed: string,
|
|
18
|
+
gasUsed: string,
|
|
19
|
+
confirmations: string,
|
|
20
|
+
methodId: string,
|
|
21
|
+
functionName: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function streamTxs(
|
|
25
|
+
address: string,
|
|
26
|
+
since: number | undefined,
|
|
27
|
+
to: number | undefined,
|
|
28
|
+
callback: (tx: Transaction) => void,
|
|
29
|
+
verbose: boolean
|
|
30
|
+
): Promise<void>;
|
|
31
|
+
|
|
32
|
+
export function fetchTxs(
|
|
33
|
+
protocol: string,
|
|
34
|
+
addr: string,
|
|
35
|
+
since: number | undefined,
|
|
36
|
+
to: number | undefined,
|
|
37
|
+
offset: number | undefined,
|
|
38
|
+
): Promise<Transaction[] | null>;
|
|
39
|
+
|
|
40
|
+
export function fetchTxsWithRetry(
|
|
41
|
+
protocol: string,
|
|
42
|
+
addr: string,
|
|
43
|
+
since: number | undefined,
|
|
44
|
+
to: number | undefined,
|
|
45
|
+
offset: number | undefined,
|
|
46
|
+
verbose: boolean
|
|
47
|
+
): Promise<Transaction[] | null>
|
package/selector.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type SelectorFlags = {
|
|
2
|
+
[flag: string]: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export type Selector = {
|
|
6
|
+
[key: string]: {
|
|
7
|
+
type: string;
|
|
8
|
+
description: string | undefined;
|
|
9
|
+
desc: string | undefined;
|
|
10
|
+
alias: string | undefined,
|
|
11
|
+
isRequired: boolean | undefined,
|
|
12
|
+
default: string | boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getJobName(name: string, selectorFlags: SelectorFlags, mode: string | undefined): string;
|
|
17
|
+
export function getSelectorDesc(selector: Selector): string;
|
|
18
|
+
export function getSelectorFlags(selector: Selector): SelectorFlags;
|
|
19
|
+
export function toSelectorString(selectorFlags: SelectorFlags, delim: string | undefined): string;
|
package/slack.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WebClient } from "@slack/web-api";
|
|
2
|
+
|
|
3
|
+
export function getClient(): WebClient;
|
|
4
|
+
export function findConversation(client: WebClient, name: string): Promise<string | null>;
|
|
5
|
+
export function postMessage(channel: string, message: any, verbose: boolean): Promise<void>;
|
package/snowflake.d.ts
ADDED
package/sqs.d.ts
ADDED
package/token.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
|
|
3
|
+
export function getTokenPriceAt(tokenAddress: string, timestamp: number, useCache: boolean | undefined): Promise<number>;
|
|
4
|
+
export function toNativeDecimal(bigNumber: BigNumber, decimals: number): Promise<BigNumber>;
|
|
5
|
+
export function toHumanDecimal(bigNumber: BigNumber, decimals: number): Promise<BigNumber>;
|
package/transaction.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Log = {
|
|
2
|
+
address: string,
|
|
3
|
+
topics: string[],
|
|
4
|
+
data: string,
|
|
5
|
+
blockNumber: string,
|
|
6
|
+
transactionHash: string,
|
|
7
|
+
transactionIndex: string,
|
|
8
|
+
blockHash: string,
|
|
9
|
+
logIndex: string,
|
|
10
|
+
removed: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type TransactionReceipt = {
|
|
14
|
+
blockHash: string,
|
|
15
|
+
blockNumber: string,
|
|
16
|
+
contractAddress: string | null,
|
|
17
|
+
cumulativeGasUsed: string,
|
|
18
|
+
effectiveGasPrice: string,
|
|
19
|
+
from: string,
|
|
20
|
+
gasUsed: string,
|
|
21
|
+
logs: Log[],
|
|
22
|
+
logsBloom: string,
|
|
23
|
+
status: string,
|
|
24
|
+
to: string,
|
|
25
|
+
transactionHash: string,
|
|
26
|
+
transactionIndex: string,
|
|
27
|
+
type: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getTxReceipt(protocol: string, txHash: string, verbose: boolean): Promise<TransactionReceipt | null>;
|
package/util.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function arrayGroup<T>(array:T[], groupSize: number): T[][];
|
|
2
|
+
export function partition(startAt: number, endAt: number, numGroups: number): [number, number][];
|
|
3
|
+
export function range(startAt: number, endAt: number, step: number): [number, number][];
|
|
4
|
+
export function fillRange(startAt: number, endAt: number): number[];
|
|
5
|
+
export function chunk<T>(array: T[], count: number): T[][];
|
package/web3.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Bottleneck from "bottleneck";
|
|
2
|
+
import Web3 from "web3";
|
|
3
|
+
import { ABI } from "./abi";
|
|
4
|
+
|
|
5
|
+
type Call = {
|
|
6
|
+
params: any | any[],
|
|
7
|
+
functionName: string | undefined,
|
|
8
|
+
target: string | undefined
|
|
9
|
+
} | any[];
|
|
10
|
+
|
|
11
|
+
export function newWeb3ByProtocol(protocol: string): Web3
|
|
12
|
+
export function singleCall(protocol: string, abi: ABI, target: string, params: any[]): Promise<any>;
|
|
13
|
+
export function multiCall(multiCallParams: {
|
|
14
|
+
protocol: string;
|
|
15
|
+
limiter: Bottleneck | undefined;
|
|
16
|
+
target: string;
|
|
17
|
+
abi: ABI;
|
|
18
|
+
calls: Call[];
|
|
19
|
+
}): Promise<{
|
|
20
|
+
callCount: number;
|
|
21
|
+
actualCallCount: number | undefined;
|
|
22
|
+
output: any[];
|
|
23
|
+
}>;
|