@certik/skynet 0.21.0 → 0.22.1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/abi.ts +2 -4
  3. package/api.ts +7 -7
  4. package/app.ts +6 -12
  5. package/const.ts +1 -1
  6. package/date.ts +1 -1
  7. package/deploy.ts +4 -4
  8. package/dist/abi.d.ts +112 -0
  9. package/dist/abi.d.ts.map +1 -0
  10. package/dist/abi.js +565 -0
  11. package/dist/address.d.ts +3 -0
  12. package/dist/address.d.ts.map +1 -0
  13. package/dist/address.js +23 -0
  14. package/dist/api.d.ts +32 -0
  15. package/dist/api.d.ts.map +1 -0
  16. package/dist/api.js +146 -0
  17. package/dist/app.d.ts +102 -0
  18. package/dist/app.d.ts.map +1 -0
  19. package/dist/app.js +328 -0
  20. package/dist/availability.d.ts +24 -0
  21. package/dist/availability.d.ts.map +1 -0
  22. package/dist/availability.js +63 -0
  23. package/dist/cli.d.ts +6 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +37 -0
  26. package/dist/const.d.ts +35 -0
  27. package/dist/const.d.ts.map +1 -0
  28. package/dist/const.js +141 -0
  29. package/dist/databricks.d.ts +4 -0
  30. package/dist/databricks.d.ts.map +1 -0
  31. package/dist/databricks.js +68 -0
  32. package/dist/date.d.ts +6 -0
  33. package/dist/date.d.ts.map +1 -0
  34. package/dist/date.js +29 -0
  35. package/dist/deploy.d.ts +76 -0
  36. package/dist/deploy.d.ts.map +1 -0
  37. package/dist/deploy.js +454 -0
  38. package/dist/dynamodb.d.ts +17 -0
  39. package/dist/dynamodb.d.ts.map +1 -0
  40. package/dist/dynamodb.js +328 -0
  41. package/dist/env.d.ts +7 -0
  42. package/dist/env.d.ts.map +1 -0
  43. package/dist/env.js +19 -0
  44. package/dist/graphql.d.ts +6 -0
  45. package/dist/graphql.d.ts.map +1 -0
  46. package/dist/graphql.js +25 -0
  47. package/dist/indexer.d.ts +70 -0
  48. package/dist/indexer.d.ts.map +1 -0
  49. package/dist/indexer.js +492 -0
  50. package/dist/log.d.ts +14 -0
  51. package/dist/log.d.ts.map +1 -0
  52. package/dist/log.js +62 -0
  53. package/dist/object-hash.d.ts +2 -0
  54. package/dist/object-hash.d.ts.map +1 -0
  55. package/dist/object-hash.js +71 -0
  56. package/dist/opsgenie.d.ts +21 -0
  57. package/dist/opsgenie.d.ts.map +1 -0
  58. package/dist/opsgenie.js +38 -0
  59. package/dist/por.d.ts +38 -0
  60. package/dist/por.d.ts.map +1 -0
  61. package/dist/por.js +130 -0
  62. package/dist/s3.d.ts +21 -0
  63. package/dist/s3.d.ts.map +1 -0
  64. package/dist/s3.js +110 -0
  65. package/dist/search.d.ts +6 -0
  66. package/dist/search.d.ts.map +1 -0
  67. package/dist/search.js +30 -0
  68. package/dist/selector.d.ts +18 -0
  69. package/dist/selector.d.ts.map +1 -0
  70. package/dist/selector.js +48 -0
  71. package/dist/slack.d.ts +9 -0
  72. package/dist/slack.d.ts.map +1 -0
  73. package/dist/slack.js +26 -0
  74. package/dist/util.d.ts +5 -0
  75. package/dist/util.d.ts.map +1 -0
  76. package/dist/util.js +26 -0
  77. package/examples/api.ts +1 -1
  78. package/examples/indexer.ts +1 -1
  79. package/examples/mode-indexer.ts +1 -1
  80. package/indexer.ts +11 -11
  81. package/package.json +99 -4
  82. package/por.ts +181 -0
  83. package/search.ts +2 -2
  84. package/tsconfig.build.json +23 -0
  85. package/tsconfig.json +5 -5
  86. package/.vscode/settings.json +0 -5
package/dist/abi.js ADDED
@@ -0,0 +1,565 @@
1
+ export const ERC20 = [
2
+ {
3
+ constant: true,
4
+ inputs: [],
5
+ name: "name",
6
+ outputs: [
7
+ {
8
+ name: "",
9
+ type: "string",
10
+ },
11
+ ],
12
+ payable: false,
13
+ stateMutability: "view",
14
+ type: "function",
15
+ },
16
+ {
17
+ constant: false,
18
+ inputs: [
19
+ {
20
+ name: "_spender",
21
+ type: "address",
22
+ },
23
+ {
24
+ name: "_value",
25
+ type: "uint256",
26
+ },
27
+ ],
28
+ name: "approve",
29
+ outputs: [
30
+ {
31
+ name: "",
32
+ type: "bool",
33
+ },
34
+ ],
35
+ payable: false,
36
+ stateMutability: "nonpayable",
37
+ type: "function",
38
+ },
39
+ {
40
+ constant: true,
41
+ inputs: [],
42
+ name: "totalSupply",
43
+ outputs: [
44
+ {
45
+ name: "",
46
+ type: "uint256",
47
+ },
48
+ ],
49
+ payable: false,
50
+ stateMutability: "view",
51
+ type: "function",
52
+ },
53
+ {
54
+ constant: false,
55
+ inputs: [
56
+ {
57
+ name: "_from",
58
+ type: "address",
59
+ },
60
+ {
61
+ name: "_to",
62
+ type: "address",
63
+ },
64
+ {
65
+ name: "_value",
66
+ type: "uint256",
67
+ },
68
+ ],
69
+ name: "transferFrom",
70
+ outputs: [
71
+ {
72
+ name: "",
73
+ type: "bool",
74
+ },
75
+ ],
76
+ payable: false,
77
+ stateMutability: "nonpayable",
78
+ type: "function",
79
+ },
80
+ {
81
+ constant: true,
82
+ inputs: [],
83
+ name: "decimals",
84
+ outputs: [
85
+ {
86
+ name: "",
87
+ type: "uint8",
88
+ },
89
+ ],
90
+ payable: false,
91
+ stateMutability: "view",
92
+ type: "function",
93
+ },
94
+ {
95
+ constant: true,
96
+ inputs: [
97
+ {
98
+ name: "_owner",
99
+ type: "address",
100
+ },
101
+ ],
102
+ name: "balanceOf",
103
+ outputs: [
104
+ {
105
+ name: "balance",
106
+ type: "uint256",
107
+ },
108
+ ],
109
+ payable: false,
110
+ stateMutability: "view",
111
+ type: "function",
112
+ },
113
+ {
114
+ constant: true,
115
+ inputs: [],
116
+ name: "symbol",
117
+ outputs: [
118
+ {
119
+ name: "",
120
+ type: "string",
121
+ },
122
+ ],
123
+ payable: false,
124
+ stateMutability: "view",
125
+ type: "function",
126
+ },
127
+ {
128
+ constant: false,
129
+ inputs: [
130
+ {
131
+ name: "_to",
132
+ type: "address",
133
+ },
134
+ {
135
+ name: "_value",
136
+ type: "uint256",
137
+ },
138
+ ],
139
+ name: "transfer",
140
+ outputs: [
141
+ {
142
+ name: "",
143
+ type: "bool",
144
+ },
145
+ ],
146
+ payable: false,
147
+ stateMutability: "nonpayable",
148
+ type: "function",
149
+ },
150
+ {
151
+ constant: true,
152
+ inputs: [
153
+ {
154
+ name: "_owner",
155
+ type: "address",
156
+ },
157
+ {
158
+ name: "_spender",
159
+ type: "address",
160
+ },
161
+ ],
162
+ name: "allowance",
163
+ outputs: [
164
+ {
165
+ name: "",
166
+ type: "uint256",
167
+ },
168
+ ],
169
+ payable: false,
170
+ stateMutability: "view",
171
+ type: "function",
172
+ },
173
+ {
174
+ name: "Approval",
175
+ payable: true,
176
+ stateMutability: "payable",
177
+ type: "fallback",
178
+ },
179
+ {
180
+ inputs: [
181
+ {
182
+ indexed: true,
183
+ name: "owner",
184
+ type: "address",
185
+ },
186
+ {
187
+ indexed: true,
188
+ name: "spender",
189
+ type: "address",
190
+ },
191
+ {
192
+ indexed: false,
193
+ name: "value",
194
+ type: "uint256",
195
+ },
196
+ ],
197
+ name: "Approval",
198
+ type: "event",
199
+ },
200
+ {
201
+ inputs: [
202
+ {
203
+ indexed: true,
204
+ name: "from",
205
+ type: "address",
206
+ },
207
+ {
208
+ indexed: true,
209
+ name: "to",
210
+ type: "address",
211
+ },
212
+ {
213
+ indexed: false,
214
+ name: "value",
215
+ type: "uint256",
216
+ },
217
+ ],
218
+ name: "Transfer",
219
+ type: "event",
220
+ },
221
+ ];
222
+ export const ERC721 = [
223
+ {
224
+ inputs: [
225
+ {
226
+ indexed: true,
227
+ internalType: "address",
228
+ name: "owner",
229
+ type: "address",
230
+ },
231
+ {
232
+ indexed: true,
233
+ internalType: "address",
234
+ name: "approved",
235
+ type: "address",
236
+ },
237
+ {
238
+ indexed: true,
239
+ internalType: "uint256",
240
+ name: "tokenId",
241
+ type: "uint256",
242
+ },
243
+ ],
244
+ name: "Approval",
245
+ type: "event",
246
+ },
247
+ {
248
+ inputs: [
249
+ {
250
+ indexed: true,
251
+ internalType: "address",
252
+ name: "owner",
253
+ type: "address",
254
+ },
255
+ {
256
+ indexed: true,
257
+ internalType: "address",
258
+ name: "operator",
259
+ type: "address",
260
+ },
261
+ {
262
+ indexed: false,
263
+ internalType: "bool",
264
+ name: "approved",
265
+ type: "bool",
266
+ },
267
+ ],
268
+ name: "ApprovalForAll",
269
+ type: "event",
270
+ },
271
+ {
272
+ inputs: [
273
+ {
274
+ indexed: true,
275
+ internalType: "address",
276
+ name: "from",
277
+ type: "address",
278
+ },
279
+ {
280
+ indexed: true,
281
+ internalType: "address",
282
+ name: "to",
283
+ type: "address",
284
+ },
285
+ {
286
+ indexed: true,
287
+ internalType: "uint256",
288
+ name: "tokenId",
289
+ type: "uint256",
290
+ },
291
+ ],
292
+ name: "Transfer",
293
+ type: "event",
294
+ },
295
+ {
296
+ inputs: [
297
+ {
298
+ internalType: "address",
299
+ name: "to",
300
+ type: "address",
301
+ },
302
+ {
303
+ internalType: "uint256",
304
+ name: "tokenId",
305
+ type: "uint256",
306
+ },
307
+ ],
308
+ name: "approve",
309
+ outputs: [],
310
+ stateMutability: "nonpayable",
311
+ type: "function",
312
+ },
313
+ {
314
+ constant: true,
315
+ inputs: [],
316
+ name: "totalSupply",
317
+ outputs: [
318
+ {
319
+ name: "",
320
+ type: "uint256",
321
+ },
322
+ ],
323
+ payable: false,
324
+ stateMutability: "view",
325
+ type: "function",
326
+ },
327
+ {
328
+ inputs: [
329
+ {
330
+ internalType: "address",
331
+ name: "owner",
332
+ type: "address",
333
+ },
334
+ ],
335
+ name: "balanceOf",
336
+ outputs: [
337
+ {
338
+ internalType: "uint256",
339
+ name: "balance",
340
+ type: "uint256",
341
+ },
342
+ ],
343
+ stateMutability: "view",
344
+ type: "function",
345
+ },
346
+ {
347
+ inputs: [
348
+ {
349
+ internalType: "uint256",
350
+ name: "tokenId",
351
+ type: "uint256",
352
+ },
353
+ ],
354
+ name: "getApproved",
355
+ outputs: [
356
+ {
357
+ internalType: "address",
358
+ name: "operator",
359
+ type: "address",
360
+ },
361
+ ],
362
+ stateMutability: "view",
363
+ type: "function",
364
+ },
365
+ {
366
+ inputs: [
367
+ {
368
+ internalType: "address",
369
+ name: "owner",
370
+ type: "address",
371
+ },
372
+ {
373
+ internalType: "address",
374
+ name: "operator",
375
+ type: "address",
376
+ },
377
+ ],
378
+ name: "isApprovedForAll",
379
+ outputs: [
380
+ {
381
+ internalType: "bool",
382
+ name: "",
383
+ type: "bool",
384
+ },
385
+ ],
386
+ stateMutability: "view",
387
+ type: "function",
388
+ },
389
+ {
390
+ inputs: [],
391
+ name: "name",
392
+ outputs: [
393
+ {
394
+ internalType: "string",
395
+ name: "",
396
+ type: "string",
397
+ },
398
+ ],
399
+ stateMutability: "view",
400
+ type: "function",
401
+ },
402
+ {
403
+ inputs: [
404
+ {
405
+ internalType: "uint256",
406
+ name: "tokenId",
407
+ type: "uint256",
408
+ },
409
+ ],
410
+ name: "ownerOf",
411
+ outputs: [
412
+ {
413
+ internalType: "address",
414
+ name: "owner",
415
+ type: "address",
416
+ },
417
+ ],
418
+ stateMutability: "view",
419
+ type: "function",
420
+ },
421
+ {
422
+ inputs: [
423
+ {
424
+ internalType: "address",
425
+ name: "from",
426
+ type: "address",
427
+ },
428
+ {
429
+ internalType: "address",
430
+ name: "to",
431
+ type: "address",
432
+ },
433
+ {
434
+ internalType: "uint256",
435
+ name: "tokenId",
436
+ type: "uint256",
437
+ },
438
+ ],
439
+ name: "safeTransferFrom",
440
+ outputs: [],
441
+ stateMutability: "nonpayable",
442
+ type: "function",
443
+ },
444
+ {
445
+ inputs: [
446
+ {
447
+ internalType: "address",
448
+ name: "from",
449
+ type: "address",
450
+ },
451
+ {
452
+ internalType: "address",
453
+ name: "to",
454
+ type: "address",
455
+ },
456
+ {
457
+ internalType: "uint256",
458
+ name: "tokenId",
459
+ type: "uint256",
460
+ },
461
+ {
462
+ internalType: "bytes",
463
+ name: "data",
464
+ type: "bytes",
465
+ },
466
+ ],
467
+ name: "safeTransferFrom",
468
+ outputs: [],
469
+ stateMutability: "nonpayable",
470
+ type: "function",
471
+ },
472
+ {
473
+ inputs: [
474
+ {
475
+ internalType: "address",
476
+ name: "operator",
477
+ type: "address",
478
+ },
479
+ {
480
+ internalType: "bool",
481
+ name: "_approved",
482
+ type: "bool",
483
+ },
484
+ ],
485
+ name: "setApprovalForAll",
486
+ outputs: [],
487
+ stateMutability: "nonpayable",
488
+ type: "function",
489
+ },
490
+ {
491
+ inputs: [
492
+ {
493
+ internalType: "bytes4",
494
+ name: "interfaceId",
495
+ type: "bytes4",
496
+ },
497
+ ],
498
+ name: "supportsInterface",
499
+ outputs: [
500
+ {
501
+ internalType: "bool",
502
+ name: "",
503
+ type: "bool",
504
+ },
505
+ ],
506
+ stateMutability: "view",
507
+ type: "function",
508
+ },
509
+ {
510
+ inputs: [],
511
+ name: "symbol",
512
+ outputs: [
513
+ {
514
+ internalType: "string",
515
+ name: "",
516
+ type: "string",
517
+ },
518
+ ],
519
+ stateMutability: "view",
520
+ type: "function",
521
+ },
522
+ {
523
+ inputs: [
524
+ {
525
+ internalType: "uint256",
526
+ name: "tokenId",
527
+ type: "uint256",
528
+ },
529
+ ],
530
+ name: "tokenURI",
531
+ outputs: [
532
+ {
533
+ internalType: "string",
534
+ name: "",
535
+ type: "string",
536
+ },
537
+ ],
538
+ stateMutability: "view",
539
+ type: "function",
540
+ },
541
+ {
542
+ inputs: [
543
+ {
544
+ internalType: "address",
545
+ name: "from",
546
+ type: "address",
547
+ },
548
+ {
549
+ internalType: "address",
550
+ name: "to",
551
+ type: "address",
552
+ },
553
+ {
554
+ internalType: "uint256",
555
+ name: "tokenId",
556
+ type: "uint256",
557
+ },
558
+ ],
559
+ name: "transferFrom",
560
+ outputs: [],
561
+ stateMutability: "nonpayable",
562
+ type: "function",
563
+ },
564
+ ];
565
+ export const BEP20 = ERC20;
@@ -0,0 +1,3 @@
1
+ export declare function parseAddress(address: string): string[];
2
+ export declare function composeAddress(protocol: string, addr: string): string;
3
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../address.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,YAqB3C;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAE5D"}
@@ -0,0 +1,23 @@
1
+ export function parseAddress(address) {
2
+ // in case of address has multiple colons, we only split the first one
3
+ const separatorIndex = address.indexOf(":");
4
+ let protocolPart;
5
+ let addressPart;
6
+ if (separatorIndex === -1) {
7
+ // if there is no colon, we assume it is an ethereum address
8
+ protocolPart = "eth";
9
+ addressPart = address;
10
+ }
11
+ else {
12
+ protocolPart = address.slice(0, separatorIndex);
13
+ addressPart = address.slice(separatorIndex + 1);
14
+ }
15
+ if (addressPart.startsWith("0x")) {
16
+ // We only lowercase the address part if it starts with 0x, otherwise it is a case-sensitive address (such as tron)
17
+ addressPart = addressPart.toLowerCase();
18
+ }
19
+ return [protocolPart, addressPart];
20
+ }
21
+ export function composeAddress(protocol, addr) {
22
+ return `${protocol}:${addr}`;
23
+ }
package/dist/api.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import express from "express";
2
+ import type { Request, Response, NextFunction } from "express";
3
+ import type { Selector } from "./selector";
4
+ export type Middleware = (req: Request, res: Response, next: NextFunction) => Promise<void>;
5
+ type Route = {
6
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
7
+ path: string;
8
+ middlewares?: Middleware[];
9
+ handler: (args: {
10
+ req: Request;
11
+ res: Response;
12
+ verbose?: boolean;
13
+ }) => Promise<void>;
14
+ protected?: boolean;
15
+ };
16
+ type Serve = {
17
+ prefix: string;
18
+ port: number;
19
+ apiKey?: string | Record<string, string>;
20
+ };
21
+ export declare function startApiApp({ binaryName, name, selector, routes, serve, beforeListen, }: {
22
+ binaryName: string;
23
+ name: string;
24
+ selector?: Selector;
25
+ routes: Route[];
26
+ serve: Serve;
27
+ beforeListen?: (args: {
28
+ app: ReturnType<typeof express>;
29
+ }) => Promise<void>;
30
+ }): Promise<void>;
31
+ export {};
32
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../api.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5F,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,QAAQ,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAyGF,wBAAsB,WAAW,CAAC,EAChC,UAAU,EACV,IAAI,EACJ,QAAa,EACb,MAAM,EACN,KAAK,EACL,YAAY,GACb,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E,iBAyFA"}