zk-agent-cli 0.1.0-beta.9 → 0.1.0-rc.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.
- package/README.md +127 -173
- package/dist/index.js +1460 -154
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
# zk-agent-cli
|
|
2
2
|
|
|
3
|
-
`zk-agent-cli` is the packaged
|
|
4
|
-
and zkSync Sepolia.
|
|
3
|
+
`zk-agent-cli` is the packaged terminal CLI for the zk-agent operator path on
|
|
4
|
+
zkSync Era and zkSync Sepolia.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
This file is the canonical operator manual for CLI users.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- `next`-first operator guidance
|
|
10
|
-
- relay-backed approval and reapproval
|
|
11
|
-
- workflow orchestration for send, swap, bridge, deposit, and withdraw
|
|
12
|
-
- machine-readable JSON output for agent callers
|
|
13
|
-
|
|
14
|
-
## Public Entry Points
|
|
15
|
-
|
|
16
|
-
Choose the entrypoint that matches the environment.
|
|
17
|
-
|
|
18
|
-
If you are installing this repository into a compatible agent harness instead
|
|
19
|
-
of using the CLI directly, prefer the repo skill surface:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npx skills add https://github.com/AgiWeb3/zk-agent-cli
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This repo currently ships a repository skill bundle for compatible harnesses.
|
|
26
|
-
The repository root now also ships a native ChatGPT/Codex plugin manifest at
|
|
27
|
-
`.codex-plugin/plugin.json`, but that plugin source belongs to the repository
|
|
28
|
-
surface rather than this published npm tarball.
|
|
29
|
-
|
|
30
|
-
For direct terminal use, install the packaged CLI:
|
|
8
|
+
## Install
|
|
31
9
|
|
|
32
10
|
One-shot execution:
|
|
33
11
|
|
|
@@ -42,24 +20,22 @@ npm install -g zk-agent-cli
|
|
|
42
20
|
zk-agent --help
|
|
43
21
|
```
|
|
44
22
|
|
|
45
|
-
The package also ships the
|
|
23
|
+
The package also ships the alias:
|
|
46
24
|
|
|
47
25
|
```bash
|
|
48
26
|
zksync-agent --help
|
|
49
27
|
```
|
|
50
28
|
|
|
51
|
-
##
|
|
29
|
+
## Defaults and prerequisites
|
|
52
30
|
|
|
53
|
-
- Node.js `>=24`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
`http://localhost:4444`. Override it with
|
|
58
|
-
`zk-agent setup --connector-url <url>` when needed.
|
|
59
|
-
- The CLI auto-loads `.env` from the current working directory.
|
|
31
|
+
- Node.js `>=24`
|
|
32
|
+
- the default chain is `zksync-sepolia`
|
|
33
|
+
- the default local approval callback is `http://localhost:4444`
|
|
34
|
+
- the CLI auto-loads `.env` from the current working directory
|
|
60
35
|
|
|
61
|
-
You do not need a custom `.env` just to run `setup`, `next`, or
|
|
62
|
-
wallet request. You usually do need
|
|
36
|
+
You do not need a custom `.env` just to run `setup`, `next`, `doctor`, or
|
|
37
|
+
create a wallet request. You usually do need RPC values for live reads or
|
|
38
|
+
broadcasts.
|
|
63
39
|
|
|
64
40
|
Most relevant environment variables:
|
|
65
41
|
|
|
@@ -70,18 +46,9 @@ ZK_AGENT_TOKEN_DIRECTORY_ROOT=
|
|
|
70
46
|
ZK_AGENT_STORAGE_DIR=
|
|
71
47
|
```
|
|
72
48
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `ZKSYNC_SEPOLIA_RPC_URL` for explicit zkSync Sepolia reads/broadcasts
|
|
76
|
-
- `ETHEREUM_SEPOLIA_RPC_URL` for L1 deposit/bridge follow-up flows on Sepolia
|
|
77
|
-
- `ZK_AGENT_TOKEN_DIRECTORY_ROOT` when you want local token-directory symbol
|
|
78
|
-
resolution
|
|
79
|
-
- `ZK_AGENT_STORAGE_DIR` only when you need to override the default local
|
|
80
|
-
storage path
|
|
49
|
+
## Fastest verified path
|
|
81
50
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Fresh setup:
|
|
51
|
+
Use this path unless the task explicitly needs a lower-level command:
|
|
85
52
|
|
|
86
53
|
```bash
|
|
87
54
|
zk-agent setup
|
|
@@ -91,218 +58,205 @@ zk-agent next
|
|
|
91
58
|
zk-agent workflow pay --wallet main --to <address> --amount <amount>
|
|
92
59
|
```
|
|
93
60
|
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
Interpretation:
|
|
62
|
+
|
|
63
|
+
- `setup` writes local defaults
|
|
64
|
+
- `next` gives the shortest valid follow-up step
|
|
65
|
+
- `wallet create --await-local` is the preferred local approval path
|
|
66
|
+
- `workflow pay` is the flagship zkSync-native AA native-send path
|
|
67
|
+
|
|
68
|
+
If readiness is unclear before you choose a fix, use:
|
|
96
69
|
|
|
97
70
|
```bash
|
|
98
|
-
zk-agent
|
|
99
|
-
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
100
|
-
zk-agent next
|
|
71
|
+
zk-agent doctor
|
|
101
72
|
```
|
|
102
73
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
signer is missing:
|
|
74
|
+
## Existing wallet recovery
|
|
75
|
+
|
|
76
|
+
If the wallet already exists and approval is missing or expired:
|
|
107
77
|
|
|
108
78
|
```bash
|
|
109
79
|
zk-agent wallet reapprove --name main --await-local
|
|
110
80
|
zk-agent next
|
|
111
|
-
zk-agent wallet signer attach --name main --private-key <hex>
|
|
112
|
-
zk-agent next
|
|
113
81
|
```
|
|
114
82
|
|
|
115
|
-
|
|
83
|
+
If approval is still present but the local execution signer is missing:
|
|
116
84
|
|
|
117
85
|
```bash
|
|
118
|
-
zk-agent
|
|
86
|
+
zk-agent wallet signer attach --name main --private-key <hex>
|
|
87
|
+
zk-agent next
|
|
119
88
|
```
|
|
120
89
|
|
|
121
|
-
|
|
90
|
+
Use these inspection commands when the blocker is wallet-specific:
|
|
122
91
|
|
|
123
92
|
```bash
|
|
124
|
-
zk-agent
|
|
125
|
-
zk-agent
|
|
93
|
+
zk-agent wallet status --name main
|
|
94
|
+
zk-agent wallet next --name main
|
|
126
95
|
```
|
|
127
96
|
|
|
128
|
-
|
|
129
|
-
`daily-spend-limit` for profile-specific policy experiments, not as the main
|
|
130
|
-
operator baseline.
|
|
97
|
+
## Remote approval
|
|
131
98
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
through the intent-scoped approval path, and defaults to the validated
|
|
135
|
-
approval-based paymaster mode unless you override it.
|
|
136
|
-
When that approval-based path still needs a fee-token candidate, recover with
|
|
137
|
-
`zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token` and
|
|
138
|
-
`zk-agent resolve-token --chain zksync-sepolia --symbol <symbol> --role paymaster-fee-token`.
|
|
99
|
+
Use the relay-backed path only when the browser is not colocated with the
|
|
100
|
+
terminal:
|
|
139
101
|
|
|
140
|
-
|
|
102
|
+
```bash
|
|
103
|
+
zk-agent relay inspect --relay-url <relay-url>
|
|
104
|
+
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
105
|
+
zk-agent next
|
|
106
|
+
```
|
|
141
107
|
|
|
142
|
-
|
|
143
|
-
needs token context:
|
|
108
|
+
For an existing wallet:
|
|
144
109
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
symbol-first discovery before choosing an explicit token address
|
|
150
|
-
- `zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token` and
|
|
151
|
-
`zk-agent resolve-token --chain zksync-sepolia --symbol <symbol> --role paymaster-fee-token`
|
|
152
|
-
for approval-based paymaster fee-token discovery on the flagship pay path
|
|
153
|
-
- `zk-agent defaults` for the machine-readable registry/defaults catalog:
|
|
154
|
-
tracked token roles, paymaster metadata, source order, and validated/fallback
|
|
155
|
-
route metadata
|
|
110
|
+
```bash
|
|
111
|
+
zk-agent wallet reapprove --name main --relay-url <relay-url> --wait-relay --prompt-code
|
|
112
|
+
zk-agent next
|
|
113
|
+
```
|
|
156
114
|
|
|
157
|
-
|
|
115
|
+
If the relay is self-hosted through the built-in server:
|
|
158
116
|
|
|
159
|
-
|
|
160
|
-
|
|
117
|
+
```bash
|
|
118
|
+
zk-agent relay serve --public-origin https://relay.example.com
|
|
119
|
+
```
|
|
161
120
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- `zk-agent deposit --wallet main --symbol USDC --amount <amount>`
|
|
166
|
-
- `zk-agent withdraw --wallet main --symbol USDC --amount <amount>`
|
|
121
|
+
Use `relay inspect` before sending users to a share link. It exposes hosted
|
|
122
|
+
readiness, URL shape, persistence mode, and the exact create/reapprove follow-up
|
|
123
|
+
path.
|
|
167
124
|
|
|
168
|
-
|
|
125
|
+
For the supported hosted operating contract, use
|
|
126
|
+
[`docs/16-hosted-approval-operated-baseline.md`](../../docs/16-hosted-approval-operated-baseline.md).
|
|
169
127
|
|
|
170
|
-
|
|
171
|
-
resolution when the local registry can resolve the active chain token
|
|
172
|
-
- `swap` follows the current registry-backed validated route by default when
|
|
173
|
-
`--protocol` is omitted
|
|
174
|
-
- `bridge` can reuse the tracked default destination route when one is already
|
|
175
|
-
known for the current wallet chain
|
|
128
|
+
## Funding and execution
|
|
176
129
|
|
|
177
|
-
|
|
130
|
+
Only fund when the CLI tells you funding is required:
|
|
178
131
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
132
|
+
```bash
|
|
133
|
+
zk-agent workflow fund --wallet main
|
|
134
|
+
zk-agent workflow fund --wallet main --amount <amount> --execute
|
|
135
|
+
```
|
|
182
136
|
|
|
183
|
-
|
|
137
|
+
Flagship pay path:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
zk-agent workflow pay --wallet main --to <address> --amount <amount>
|
|
141
|
+
zk-agent workflow pay --wallet main --to <address> --amount <amount> --broadcast
|
|
142
|
+
```
|
|
184
143
|
|
|
185
|
-
- `
|
|
186
|
-
|
|
187
|
-
- `zk-agent agent show`
|
|
144
|
+
Keep `sed-lite` as the default AA baseline. Use `daily-spend-limit` only when
|
|
145
|
+
you intentionally need that narrower policy profile.
|
|
188
146
|
|
|
189
|
-
##
|
|
147
|
+
## Operator suite
|
|
190
148
|
|
|
191
|
-
|
|
149
|
+
Use:
|
|
192
150
|
|
|
193
151
|
```bash
|
|
194
|
-
zk-agent
|
|
195
|
-
zk-agent wallet create --relay-url <relay-url> --wait-relay --prompt-code
|
|
152
|
+
zk-agent suite
|
|
196
153
|
```
|
|
197
154
|
|
|
198
|
-
|
|
155
|
+
when you want the flagship path plus the current post-flagship surfaces in one
|
|
156
|
+
place.
|
|
199
157
|
|
|
200
|
-
|
|
201
|
-
zk-agent wallet reapprove --name main --relay-url <relay-url> --wait-relay --prompt-code
|
|
202
|
-
```
|
|
158
|
+
Current suite shape:
|
|
203
159
|
|
|
204
|
-
|
|
205
|
-
|
|
160
|
+
- flagship pay:
|
|
161
|
+
`zk-agent workflow pay --wallet main --to <address> --amount <amount>`
|
|
162
|
+
- discovery/defaults:
|
|
163
|
+
`zk-agent assets --wallet main`
|
|
164
|
+
`zk-agent defaults`
|
|
165
|
+
`zk-agent resolve-token --chain zksync-sepolia --symbol USDC`
|
|
166
|
+
- funding readiness:
|
|
167
|
+
`zk-agent workflow fund --wallet main`
|
|
168
|
+
- paymaster readiness:
|
|
169
|
+
`zk-agent workflow pay --wallet main --to <address> --amount <amount> --paymaster-mode approval-based`
|
|
170
|
+
`zk-agent tokens --chain zksync-sepolia --role paymaster-fee-token`
|
|
206
171
|
|
|
207
|
-
|
|
208
|
-
repair that locally instead of forcing a new approval round-trip:
|
|
172
|
+
## Discovery and direct commands
|
|
209
173
|
|
|
210
|
-
|
|
211
|
-
zk-agent wallet signer attach --name main --private-key <hex>
|
|
212
|
-
zk-agent next
|
|
213
|
-
```
|
|
174
|
+
Preferred discovery order:
|
|
214
175
|
|
|
215
|
-
|
|
176
|
+
- `zk-agent assets --wallet main`
|
|
177
|
+
- `zk-agent tokens --wallet main --owned`
|
|
178
|
+
- `zk-agent defaults`
|
|
179
|
+
- `zk-agent resolve-token --chain zksync-sepolia --symbol <symbol>`
|
|
216
180
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
zk-agent wallet create --relay-url <relay-url>
|
|
220
|
-
zk-agent wallet request approve --request-id <id> --relay-url <relay-url> --code <code> --wait
|
|
221
|
-
```
|
|
181
|
+
Use the direct commands when you intentionally want to bypass the workflow
|
|
182
|
+
layer:
|
|
222
183
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
`relay serve`, so hosted share-link approval no longer depends on a separate
|
|
229
|
-
source checkout just to serve the UI. `relay inspect` now also reports
|
|
230
|
-
`stateBackend`, `deploymentScope`, and `sameHostRestartPersists` so the
|
|
231
|
-
single-host local-filesystem constraint is explicit before you rely on a hosted
|
|
232
|
-
URL.
|
|
184
|
+
- `zk-agent send-token --wallet main --symbol USDC --to <address> --amount <amount>`
|
|
185
|
+
- `zk-agent swap --wallet main --token-in-symbol USDC --token-out-symbol ETH --amount-in <amount>`
|
|
186
|
+
- `zk-agent fund --wallet main --symbol USDC --amount <amount>`
|
|
187
|
+
- `zk-agent deposit --wallet main --symbol USDC --amount <amount>`
|
|
188
|
+
- `zk-agent withdraw --wallet main --symbol USDC --amount <amount>`
|
|
233
189
|
|
|
234
|
-
## Local
|
|
190
|
+
## Local storage
|
|
235
191
|
|
|
236
|
-
By default the CLI stores
|
|
237
|
-
under:
|
|
192
|
+
By default the CLI stores local state under:
|
|
238
193
|
|
|
239
194
|
```text
|
|
240
195
|
~/.zk-agent/
|
|
241
196
|
```
|
|
242
197
|
|
|
243
|
-
Common files
|
|
198
|
+
Common files:
|
|
244
199
|
|
|
245
200
|
- `config.json`
|
|
246
201
|
- `wallets/*.json`
|
|
247
202
|
- `requests/*.json`
|
|
248
203
|
- `workflows/*.json`
|
|
249
204
|
|
|
250
|
-
## Smart-
|
|
205
|
+
## Smart-account profiles
|
|
206
|
+
|
|
207
|
+
The packaged CLI includes built-in profile artifacts for:
|
|
251
208
|
|
|
252
|
-
|
|
253
|
-
|
|
209
|
+
- `sed-lite`
|
|
210
|
+
- `daily-spend-limit`
|
|
211
|
+
|
|
212
|
+
Inspect them with:
|
|
254
213
|
|
|
255
214
|
```bash
|
|
256
215
|
zk-agent wallet smart-account profiles --json
|
|
257
216
|
```
|
|
258
217
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
- `zk-agent wallet smart-account predict --profile sed-lite`
|
|
262
|
-
- `zk-agent wallet smart-account deploy --profile sed-lite`
|
|
263
|
-
- the same built-in path for `daily-spend-limit`
|
|
218
|
+
Use the packaged path for:
|
|
264
219
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
-
|
|
268
|
-
|
|
269
|
-
- `ZK_AGENT_ACCOUNT_PROFILES_ROOT` is now only a source-checkout override for
|
|
270
|
-
development or custom runtime layouts
|
|
220
|
+
```bash
|
|
221
|
+
zk-agent wallet smart-account predict --profile sed-lite
|
|
222
|
+
zk-agent wallet smart-account deploy --profile sed-lite
|
|
223
|
+
```
|
|
271
224
|
|
|
272
|
-
## Common
|
|
225
|
+
## Common failures
|
|
273
226
|
|
|
274
227
|
Connector callback never arrives:
|
|
275
228
|
|
|
276
229
|
- verify the connector URL saved by `zk-agent setup`
|
|
277
|
-
- if local callback is
|
|
278
|
-
|
|
230
|
+
- if local callback is impossible in the current environment, switch to the
|
|
231
|
+
relay-backed path
|
|
279
232
|
|
|
280
233
|
CLI says the wallet is missing a writable session:
|
|
281
234
|
|
|
235
|
+
- run `zk-agent doctor --wallet <wallet>`
|
|
282
236
|
- inspect `zk-agent wallet status --name <wallet>`
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
`zk-agent wallet signer attach --name <wallet> --private-key <hex>`
|
|
286
|
-
- then rerun `zk-agent next` or the blocked workflow command
|
|
237
|
+
- reapprove when approval is missing
|
|
238
|
+
- attach the signer when approval is present but local write readiness is not
|
|
287
239
|
|
|
288
240
|
Workflow stops on funding:
|
|
289
241
|
|
|
290
242
|
- do not guess the route
|
|
291
243
|
- run the exact `workflow fund` command suggested by the CLI
|
|
292
244
|
|
|
293
|
-
|
|
245
|
+
Locked-down environment blocks local callback or relay binding:
|
|
294
246
|
|
|
295
|
-
-
|
|
296
|
-
-
|
|
247
|
+
- rerun from a normal host shell
|
|
248
|
+
- or use a relay/manual approval path that matches the environment
|
|
297
249
|
|
|
298
|
-
## Command
|
|
250
|
+
## Command help
|
|
299
251
|
|
|
300
|
-
|
|
252
|
+
Use:
|
|
301
253
|
|
|
302
254
|
```bash
|
|
303
255
|
zk-agent --help
|
|
256
|
+
zk-agent doctor --help
|
|
304
257
|
zk-agent wallet --help
|
|
305
258
|
zk-agent workflow --help
|
|
259
|
+
zk-agent suite --help
|
|
306
260
|
```
|
|
307
261
|
|
|
308
262
|
## License
|