@chainalert/cli 0.0.3 → 0.0.4
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/dist/{alerts-TWALVXNJ.js → alerts-3PPV43JZ.js} +3 -3
- package/dist/{auth-WLMAW2H7.js → auth-YTQPDHBH.js} +2 -2
- package/dist/{channels-D7MIHEHO.js → channels-NT6NNET7.js} +3 -3
- package/dist/{chunk-7AIFW2QP.js → chunk-4WIKOXYN.js} +1 -1
- package/dist/{chunk-ZJN3UG7K.js → chunk-BEHAHSK3.js} +1 -1
- package/dist/{chunk-7IOPEYQM.js → chunk-FRKJPHES.js} +3 -3
- package/dist/{contracts-N73PHLWK.js → contracts-AD7PNBBN.js} +3 -3
- package/dist/{detections-R7GW3LKO.js → detections-2J5GMYZB.js} +3 -3
- package/dist/{events-B2OW4AKX.js → events-6RZPVNDF.js} +3 -3
- package/dist/{health-IAKHPFHP.js → health-LZOEYRFT.js} +3 -3
- package/dist/index.js +16 -16
- package/dist/{networks-JE4WWOVC.js → networks-X6W43DTO.js} +3 -3
- package/dist/{org-contracts-UNDFKFMP.js → org-contracts-CJASTL5O.js} +3 -3
- package/dist/{repl-ZG7IN2B4.js → repl-IHWAF3J3.js} +4 -3
- package/dist/{rpc-configs-LHCPRKBY.js → rpc-configs-Q5J3BMH2.js} +3 -3
- package/dist/{state-changes-LT2VCBT2.js → state-changes-UNTPB4O2.js} +3 -3
- package/dist/{templates-WKWXRABA.js → templates-QD6XFBKS.js} +3 -3
- package/package.json +2 -2
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getAlert,
|
|
7
7
|
getAlertStats,
|
|
8
8
|
listAlerts
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BEHAHSK3.js";
|
|
10
|
+
import "./chunk-4WIKOXYN.js";
|
|
11
11
|
import {
|
|
12
12
|
dim,
|
|
13
13
|
print,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
printJson,
|
|
16
16
|
printKV,
|
|
17
17
|
printTable
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FRKJPHES.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/alerts.ts
|
|
21
21
|
async function run(args, flags) {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
loadConfig,
|
|
7
7
|
saveConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4WIKOXYN.js";
|
|
9
9
|
import {
|
|
10
10
|
dim,
|
|
11
11
|
print,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
printJson,
|
|
14
14
|
printKV,
|
|
15
15
|
printSuccess
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FRKJPHES.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/auth.ts
|
|
19
19
|
async function run(args, flags) {
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
deleteChannel,
|
|
11
11
|
listChannels,
|
|
12
12
|
testChannel
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-BEHAHSK3.js";
|
|
14
|
+
import "./chunk-4WIKOXYN.js";
|
|
15
15
|
import {
|
|
16
16
|
print,
|
|
17
17
|
printError,
|
|
18
18
|
printJson,
|
|
19
19
|
printSuccess,
|
|
20
20
|
printTable
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FRKJPHES.js";
|
|
22
22
|
|
|
23
23
|
// src/commands/channels.ts
|
|
24
24
|
async function run(args, flags) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// src/config/constants.ts
|
|
4
4
|
import { homedir } from "os";
|
|
5
5
|
import { join } from "path";
|
|
6
|
-
var VERSION = "0.0.
|
|
6
|
+
var VERSION = "0.0.4";
|
|
7
7
|
var DEFAULT_API_URL = "https://chainalert.dev/api";
|
|
8
8
|
var CONFIG_DIR = join(homedir(), ".chainalert");
|
|
9
9
|
var CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
@@ -52,7 +52,7 @@ function yellow(s) {
|
|
|
52
52
|
}
|
|
53
53
|
function printTable(headers, rows) {
|
|
54
54
|
const widths = headers.map((h, i) => {
|
|
55
|
-
const colMax = rows.reduce((max, row) => Math.max(max, (row[i] ?? "").length), 0);
|
|
55
|
+
const colMax = rows.reduce((max, row) => Math.max(max, String(row[i] ?? "").length), 0);
|
|
56
56
|
return Math.max(h.length, colMax);
|
|
57
57
|
});
|
|
58
58
|
const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(" ");
|
|
@@ -60,7 +60,7 @@ function printTable(headers, rows) {
|
|
|
60
60
|
print(`${BOLD}${headerLine}${RESET}`);
|
|
61
61
|
print(`${DIM}${separator}${RESET}`);
|
|
62
62
|
for (const row of rows) {
|
|
63
|
-
print(row.map((cell, i) => (cell ?? "").padEnd(widths[i])).join(" "));
|
|
63
|
+
print(row.map((cell, i) => String(cell ?? "").padEnd(widths[i])).join(" "));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
function printKV(pairs) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getStorageSlots,
|
|
7
7
|
resolveContract
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BEHAHSK3.js";
|
|
9
|
+
import "./chunk-4WIKOXYN.js";
|
|
10
10
|
import {
|
|
11
11
|
bold,
|
|
12
12
|
dim,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
printError,
|
|
15
15
|
printJson,
|
|
16
16
|
printKV
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FRKJPHES.js";
|
|
18
18
|
|
|
19
19
|
// src/commands/contracts.ts
|
|
20
20
|
async function run(args, flags) {
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
listDetections,
|
|
13
13
|
testDetection,
|
|
14
14
|
updateDetection
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-BEHAHSK3.js";
|
|
16
|
+
import "./chunk-4WIKOXYN.js";
|
|
17
17
|
import {
|
|
18
18
|
bold,
|
|
19
19
|
dim,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
printTable,
|
|
27
27
|
red,
|
|
28
28
|
yellow
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FRKJPHES.js";
|
|
30
30
|
|
|
31
31
|
// src/commands/detections.ts
|
|
32
32
|
async function run(args, flags) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getEvent,
|
|
7
7
|
listEvents
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BEHAHSK3.js";
|
|
9
|
+
import "./chunk-4WIKOXYN.js";
|
|
10
10
|
import {
|
|
11
11
|
dim,
|
|
12
12
|
print,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
printJson,
|
|
15
15
|
printKV,
|
|
16
16
|
printTable
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FRKJPHES.js";
|
|
18
18
|
|
|
19
19
|
// src/commands/events.ts
|
|
20
20
|
async function run(args, flags) {
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-CE4DKHAY.js";
|
|
5
5
|
import {
|
|
6
6
|
getHealth
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-BEHAHSK3.js";
|
|
8
|
+
import "./chunk-4WIKOXYN.js";
|
|
9
9
|
import {
|
|
10
10
|
print,
|
|
11
11
|
printError,
|
|
12
12
|
printJson,
|
|
13
13
|
printSuccess,
|
|
14
14
|
red
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FRKJPHES.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/health.ts
|
|
18
18
|
async function run(args, flags) {
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
bold,
|
|
5
5
|
print,
|
|
6
6
|
printError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FRKJPHES.js";
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
function parseArgs(argv) {
|
|
@@ -67,12 +67,12 @@ async function main() {
|
|
|
67
67
|
switch (root) {
|
|
68
68
|
// No command or "chat" -> interactive REPL
|
|
69
69
|
case void 0: {
|
|
70
|
-
const { startRepl } = await import("./repl-
|
|
70
|
+
const { startRepl } = await import("./repl-IHWAF3J3.js");
|
|
71
71
|
await startRepl();
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
case "chat": {
|
|
75
|
-
const { startRepl } = await import("./repl-
|
|
75
|
+
const { startRepl } = await import("./repl-IHWAF3J3.js");
|
|
76
76
|
await startRepl();
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
@@ -80,68 +80,68 @@ async function main() {
|
|
|
80
80
|
case "login":
|
|
81
81
|
case "logout":
|
|
82
82
|
case "whoami": {
|
|
83
|
-
const auth = await import("./auth-
|
|
83
|
+
const auth = await import("./auth-YTQPDHBH.js");
|
|
84
84
|
await auth.run([root, ...rest], flags);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
case "config": {
|
|
88
|
-
const auth = await import("./auth-
|
|
88
|
+
const auth = await import("./auth-YTQPDHBH.js");
|
|
89
89
|
await auth.runConfig(rest, flags);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
// Resource commands
|
|
93
93
|
case "health": {
|
|
94
|
-
const mod = await import("./health-
|
|
94
|
+
const mod = await import("./health-LZOEYRFT.js");
|
|
95
95
|
await mod.run(rest, flags);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
case "networks": {
|
|
99
|
-
const mod = await import("./networks-
|
|
99
|
+
const mod = await import("./networks-X6W43DTO.js");
|
|
100
100
|
await mod.run(rest, flags);
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
case "templates": {
|
|
104
|
-
const mod = await import("./templates-
|
|
104
|
+
const mod = await import("./templates-QD6XFBKS.js");
|
|
105
105
|
await mod.run(rest, flags);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
case "detections": {
|
|
109
|
-
const mod = await import("./detections-
|
|
109
|
+
const mod = await import("./detections-2J5GMYZB.js");
|
|
110
110
|
await mod.run(rest, flags);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
case "alerts": {
|
|
114
|
-
const mod = await import("./alerts-
|
|
114
|
+
const mod = await import("./alerts-3PPV43JZ.js");
|
|
115
115
|
await mod.run(rest, flags);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
case "events": {
|
|
119
|
-
const mod = await import("./events-
|
|
119
|
+
const mod = await import("./events-6RZPVNDF.js");
|
|
120
120
|
await mod.run(rest, flags);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
case "state-changes": {
|
|
124
|
-
const mod = await import("./state-changes-
|
|
124
|
+
const mod = await import("./state-changes-UNTPB4O2.js");
|
|
125
125
|
await mod.run(rest, flags);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
case "channels": {
|
|
129
|
-
const mod = await import("./channels-
|
|
129
|
+
const mod = await import("./channels-NT6NNET7.js");
|
|
130
130
|
await mod.run(rest, flags);
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
case "contracts": {
|
|
134
|
-
const mod = await import("./contracts-
|
|
134
|
+
const mod = await import("./contracts-AD7PNBBN.js");
|
|
135
135
|
await mod.run(rest, flags);
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
case "org-contracts": {
|
|
139
|
-
const mod = await import("./org-contracts-
|
|
139
|
+
const mod = await import("./org-contracts-CJASTL5O.js");
|
|
140
140
|
await mod.run(rest, flags);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
case "rpc-configs": {
|
|
144
|
-
const mod = await import("./rpc-configs-
|
|
144
|
+
const mod = await import("./rpc-configs-Q5J3BMH2.js");
|
|
145
145
|
await mod.run(rest, flags);
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-CE4DKHAY.js";
|
|
5
5
|
import {
|
|
6
6
|
listNetworks
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-BEHAHSK3.js";
|
|
8
|
+
import "./chunk-4WIKOXYN.js";
|
|
9
9
|
import {
|
|
10
10
|
print,
|
|
11
11
|
printError,
|
|
12
12
|
printJson,
|
|
13
13
|
printTable
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FRKJPHES.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/networks.ts
|
|
17
17
|
async function run(args, flags) {
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
getOrgContractTraits,
|
|
8
8
|
listOrgContracts,
|
|
9
9
|
registerOrgContract
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-BEHAHSK3.js";
|
|
11
|
+
import "./chunk-4WIKOXYN.js";
|
|
12
12
|
import {
|
|
13
13
|
dim,
|
|
14
14
|
print,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
printKV,
|
|
18
18
|
printSuccess,
|
|
19
19
|
printTable
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FRKJPHES.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/org-contracts.ts
|
|
23
23
|
async function run(args, flags) {
|
|
@@ -28,12 +28,12 @@ import {
|
|
|
28
28
|
testChannel,
|
|
29
29
|
testDetection,
|
|
30
30
|
updateDetection
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-BEHAHSK3.js";
|
|
32
32
|
import {
|
|
33
33
|
getApiKey,
|
|
34
34
|
getApiUrl,
|
|
35
35
|
loadConfig
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-4WIKOXYN.js";
|
|
37
37
|
import {
|
|
38
38
|
bold,
|
|
39
39
|
cyan,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
printDim,
|
|
43
43
|
printError,
|
|
44
44
|
printWarn
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-FRKJPHES.js";
|
|
46
46
|
|
|
47
47
|
// src/repl/repl.ts
|
|
48
48
|
import { createInterface } from "readline";
|
|
@@ -1598,6 +1598,7 @@ async function startRepl() {
|
|
|
1598
1598
|
conversation.add(message);
|
|
1599
1599
|
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
1600
1600
|
for (const toolCall of message.tool_calls) {
|
|
1601
|
+
if (toolCall.type !== "function") continue;
|
|
1601
1602
|
const args = JSON.parse(toolCall.function.arguments);
|
|
1602
1603
|
printDim(` [calling ${toolCall.function.name}...]`);
|
|
1603
1604
|
try {
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
addRpcConfig,
|
|
7
7
|
listRpcConfigs,
|
|
8
8
|
testRpcConfig
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BEHAHSK3.js";
|
|
10
|
+
import "./chunk-4WIKOXYN.js";
|
|
11
11
|
import {
|
|
12
12
|
print,
|
|
13
13
|
printError,
|
|
14
14
|
printJson,
|
|
15
15
|
printSuccess,
|
|
16
16
|
printTable
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FRKJPHES.js";
|
|
18
18
|
|
|
19
19
|
// src/commands/rpc-configs.ts
|
|
20
20
|
async function run(args, flags) {
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-CE4DKHAY.js";
|
|
5
5
|
import {
|
|
6
6
|
listStateChanges
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-BEHAHSK3.js";
|
|
8
|
+
import "./chunk-4WIKOXYN.js";
|
|
9
9
|
import {
|
|
10
10
|
dim,
|
|
11
11
|
print,
|
|
12
12
|
printError,
|
|
13
13
|
printJson,
|
|
14
14
|
printTable
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FRKJPHES.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/state-changes.ts
|
|
18
18
|
async function run(args, flags) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getTemplate,
|
|
7
7
|
listTemplates
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BEHAHSK3.js";
|
|
9
|
+
import "./chunk-4WIKOXYN.js";
|
|
10
10
|
import {
|
|
11
11
|
bold,
|
|
12
12
|
dim,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
printJson,
|
|
16
16
|
printKV,
|
|
17
17
|
printTable
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FRKJPHES.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/templates.ts
|
|
21
21
|
async function run(args, flags) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainalert/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "ChainAlert CLI — manage blockchain monitoring from the command line",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "vitest run --passWithNoTests"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"openai": "^
|
|
27
|
+
"openai": "^5.23.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.10.5",
|