@towns-labs/wallet 7.1.0 → 7.2.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.
Files changed (3) hide show
  1. package/README.md +182 -19
  2. package/dist/cli.js +419 -353
  3. package/package.json +8 -3
package/README.md CHANGED
@@ -49,10 +49,10 @@ Create a new account (interactive password prompt):
49
49
  tw account create
50
50
  ```
51
51
 
52
- Create a named profile in local dev:
52
+ Create a named profile:
53
53
 
54
54
  ```bash
55
- tw account create --env dev --profile agent
55
+ tw account create --profile agent
56
56
  ```
57
57
 
58
58
  Keystore layout:
@@ -65,7 +65,7 @@ Keystore layout:
65
65
  Resume a previously created profile:
66
66
 
67
67
  ```bash
68
- tw account create --resume --env dev --profile agent
68
+ tw account create --resume --profile agent
69
69
  ```
70
70
 
71
71
  Non-interactive mode (stdin password + JSON output):
@@ -77,7 +77,7 @@ echo "my-password" | tw account create --password-stdin --json
77
77
  Use an explicit keystore path:
78
78
 
79
79
  ```bash
80
- tw account create --keystore-path ~/.config/towns/tw/profiles/dev/team/default.keystore.json --env dev
80
+ tw account create --keystore-path ~/.config/towns/tw/profiles/prod/team/default.keystore.json
81
81
  ```
82
82
 
83
83
  ## Account Export
@@ -85,19 +85,19 @@ tw account create --keystore-path ~/.config/towns/tw/profiles/dev/team/default.k
85
85
  Export metadata only (safe default):
86
86
 
87
87
  ```bash
88
- tw account export --env dev --profile agent
88
+ tw account export --profile agent
89
89
  ```
90
90
 
91
91
  Export metadata in JSON:
92
92
 
93
93
  ```bash
94
- tw account export --env dev --profile agent --json
94
+ tw account export --profile agent --json
95
95
  ```
96
96
 
97
97
  Export decrypted private keys (interactive confirmation required):
98
98
 
99
99
  ```bash
100
- tw account export --env dev --profile agent --show-private
100
+ tw account export --profile agent --show-private
101
101
  ```
102
102
 
103
103
  ## Account Address
@@ -105,7 +105,7 @@ tw account export --env dev --profile agent --show-private
105
105
  Print the main/root account address:
106
106
 
107
107
  ```bash
108
- tw account address --env dev --profile agent
108
+ tw account address --profile agent
109
109
  ```
110
110
 
111
111
  ## Address (Root Alias)
@@ -141,17 +141,15 @@ tw address --token 0x1111111111111111111111111111111111111111 --amount 1 --decim
141
141
  Check USDC balance for the main/root account on Base (default):
142
142
 
143
143
  ```bash
144
- tw account balance --env dev --profile agent
144
+ tw account balance --profile agent
145
145
  ```
146
146
 
147
147
  Check USDC balance on Polygon:
148
148
 
149
149
  ```bash
150
- tw account balance --env prod --profile agent --chain polygon
150
+ tw account balance --profile agent --chain polygon
151
151
  ```
152
152
 
153
- For local dev (`--env dev`), default chain is Anvil (`http://127.0.0.1:8545`).
154
-
155
153
  ## Account Send
156
154
 
157
155
  Send USDC to an address:
@@ -169,7 +167,7 @@ tw account send 2.5 vitalik.eth --chain base
169
167
  Send USDC on Polygon with JSON output:
170
168
 
171
169
  ```bash
172
- tw account send 10 0x1111111111111111111111111111111111111111 --chain polygon --env prod --json
170
+ tw account send 10 0x1111111111111111111111111111111111111111 --chain polygon --json
173
171
  ```
174
172
 
175
173
  Send using a specific local session by name (without changing active session):
@@ -178,12 +176,33 @@ Send using a specific local session by name (without changing active session):
178
176
  tw account send 1 0x1111111111111111111111111111111111111111 --profile agent --session worker-2
179
177
  ```
180
178
 
181
- Local dev defaults to Anvil:
179
+ ## Account History
180
+
181
+ Get paginated relayer call history for an EOA. By default this uses your local profile root EOA from keystore:
182
182
 
183
183
  ```bash
184
- tw account send 1 0x1111111111111111111111111111111111111111 --env dev
184
+ tw account history --profile agent
185
185
  ```
186
186
 
187
+ Query an explicit EOA (without reading local keystore):
188
+
189
+ ```bash
190
+ tw account history --address 0x1111111111111111111111111111111111111111 --limit 10 --offset 20
191
+ ```
192
+
193
+ Filter by one or more chains:
194
+
195
+ ```bash
196
+ tw account history --chain base,polygon --json
197
+ ```
198
+
199
+ Notes:
200
+
201
+ - `--limit` defaults to `20` and max is `100`
202
+ - `--offset` defaults to `0`
203
+ - `offset + limit` must be `<= 1000`
204
+ - History queries are EOA-based (root EOA), not delegated account address
205
+
187
206
  ## Contacts
188
207
 
189
208
  Store aliases in a global contacts file:
@@ -244,7 +263,7 @@ Send with a portable session file (no root keystore required):
244
263
 
245
264
  ```bash
246
265
  tw account send 1 0x1111111111111111111111111111111111111111 \
247
- --env prod --chain base --session-file ./worker-1.session.json
266
+ --chain base --session-file ./worker-1.session.json
248
267
  ```
249
268
 
250
269
  `--session` and `--session-file` are mutually exclusive.
@@ -254,13 +273,13 @@ tw account send 1 0x1111111111111111111111111111111111111111 \
254
273
  Show compact readiness status:
255
274
 
256
275
  ```bash
257
- tw account status --env dev --profile agent
276
+ tw account status --profile agent
258
277
  ```
259
278
 
260
279
  JSON output for automation:
261
280
 
262
281
  ```bash
263
- tw account status --env prod --profile agent --chain polygon --json
282
+ tw account status --profile agent --chain polygon --json
264
283
  ```
265
284
 
266
285
  ## Account Update Password
@@ -268,7 +287,7 @@ tw account status --env prod --profile agent --chain polygon --json
268
287
  Rotate local keystore encryption password (interactive):
269
288
 
270
289
  ```bash
271
- tw account update password --env dev --profile agent
290
+ tw account update password --profile agent
272
291
  ```
273
292
 
274
293
  Rotate password non-interactively using stdin lines:
@@ -397,6 +416,150 @@ Idempotent retry/cleanup when already revoked on-chain:
397
416
  echo "my-password" | tw session revoke worker-2 --profile agent --resume --password-stdin --json
398
417
  ```
399
418
 
419
+ ## Agent Commands
420
+
421
+ Agents are session-key-backed Towns identities with their own encryption device and named channel bindings.
422
+
423
+ Agent keystore files live alongside normal sessions:
424
+
425
+ ```text
426
+ ~/.config/towns/tw/profiles/<env>/<profile>/sessions/agent-<name>.json
427
+ ~/.config/towns/tw/profiles/<env>/<profile>/agent-channels.json
428
+ ```
429
+
430
+ Create two local agents:
431
+
432
+ ```bash
433
+ TW_PASSWORD="my-password" tw agent create alice --profile agent
434
+ TW_PASSWORD="my-password" tw agent create bob --profile agent
435
+ ```
436
+
437
+ List local agents:
438
+
439
+ ```bash
440
+ TW_PASSWORD="my-password" tw agent list --profile agent --json
441
+ ```
442
+
443
+ Create or bind a named channel:
444
+
445
+ ```bash
446
+ TW_PASSWORD="my-password" tw agent connect --from alice --channel art --to bob --profile agent
447
+ ```
448
+
449
+ The first `connect` returns:
450
+
451
+ - `streamId` — the underlying GDM stream
452
+ - `secret` — the shared rendezvous secret, returned only when the binding is first created
453
+
454
+ Bind the same named channel from the other side:
455
+
456
+ ```bash
457
+ TW_PASSWORD="my-password" tw agent connect --from bob --channel art --secret "<shared-secret>" --to alice --profile agent
458
+ ```
459
+
460
+ Send to a named channel:
461
+
462
+ ```bash
463
+ TW_PASSWORD="my-password" tw agent send --from alice --channel art "hello from alice" --profile agent
464
+ ```
465
+
466
+ Send directly to a raw stream ID:
467
+
468
+ ```bash
469
+ TW_PASSWORD="my-password" tw agent send --from alice 77aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "debug message" --profile agent
470
+ ```
471
+
472
+ Listen on a named channel:
473
+
474
+ ```bash
475
+ TW_PASSWORD="my-password" tw agent listen --from bob --channel art --profile agent
476
+ ```
477
+
478
+ Listen on a specific stream:
479
+
480
+ ```bash
481
+ TW_PASSWORD="my-password" tw agent listen --from bob --stream 77aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --profile agent
482
+ ```
483
+
484
+ Inspect local named bindings:
485
+
486
+ ```bash
487
+ TW_PASSWORD="my-password" tw agent channels --from alice --profile agent --json
488
+ ```
489
+
490
+ Remove an agent:
491
+
492
+ ```bash
493
+ TW_PASSWORD="my-password" tw agent remove bob --profile agent
494
+ ```
495
+
496
+ ## Agent Quickstart
497
+
498
+ This is the shortest end-to-end flow to start a conversation between two local agents.
499
+
500
+ 1. Create or reuse a wallet profile:
501
+
502
+ ```bash
503
+ tw account create --profile agent
504
+ ```
505
+
506
+ 2. Create two agents:
507
+
508
+ ```bash
509
+ TW_PASSWORD="my-password" tw agent create alice --profile agent
510
+ TW_PASSWORD="my-password" tw agent create bob --profile agent
511
+ ```
512
+
513
+ 3. Create a named channel and copy the returned `secret` and `streamId`:
514
+
515
+ ```bash
516
+ TW_PASSWORD="my-password" tw agent connect --from alice --channel art --to bob --profile agent
517
+ ```
518
+
519
+ 4. Bind the same channel from Bob using that secret:
520
+
521
+ ```bash
522
+ TW_PASSWORD="my-password" tw agent connect --from bob --channel art --secret "<shared-secret>" --to alice --profile agent
523
+ ```
524
+
525
+ 5. Start a listener in one terminal:
526
+
527
+ ```bash
528
+ TW_PASSWORD="my-password" tw agent listen --from bob --channel art --profile agent
529
+ ```
530
+
531
+ 6. Send from another terminal:
532
+
533
+ ```bash
534
+ TW_PASSWORD="my-password" tw agent send --from alice --channel art "hello from alice" --profile agent
535
+ ```
536
+
537
+ 7. Bob's listener prints NDJSON when the message arrives:
538
+
539
+ ```json
540
+ {
541
+ "type": "message",
542
+ "streamId": "77...",
543
+ "senderId": "0x...",
544
+ "eventId": "0x...",
545
+ "timestamp": 1709654400,
546
+ "content": "hello from alice"
547
+ }
548
+ ```
549
+
550
+ 8. Inspect the local binding if you need the underlying stream:
551
+
552
+ ```bash
553
+ TW_PASSWORD="my-password" tw agent channels --from alice --profile agent
554
+ ```
555
+
556
+ For a single-command live verification, run the built-in smoke script:
557
+
558
+ ```bash
559
+ cd packages/wallet
560
+ TW_PASSWORD="my-password" bun run smoke:agent
561
+ ```
562
+
400
563
  ## Permissions List
401
564
 
402
565
  List all on-chain keys with summarized call/spend permissions: