Skip to content

Commit 8f144bf

Browse files
feat: Add twak automate and x402 to cli reference
1 parent 2d1bdfe commit 8f144bf

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

agent-sdk/cli-reference.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,51 @@ Use `--quote-only` to preview without executing.
152152

153153
---
154154

155+
## automate
156+
157+
Create and manage DCA (dollar-cost-average) and limit-order automations. Both run as scheduled swaps under your stored wallet.
158+
159+
### automate add
160+
161+
Create a DCA automation by passing `--interval`; create a limit order by passing `--price` (and optional `--condition`). The two flags are mutually exclusive — exactly one must be supplied.
162+
163+
```bash
164+
twak automate add --from <token> --to <token> --amount <n> \
165+
[--chain <chain>] \
166+
(--interval <duration> | --price <usd> [--condition above|below]) \
167+
[--max-runs <n>] [--expires <date>] [--json]
168+
```
169+
170+
| Flag | Description |
171+
|------|-------------|
172+
| `--from` | Source asset ID, e.g. `c60_t0xA0b8...` for USDC on Ethereum |
173+
| `--to` | Destination asset ID, e.g. `c60` for ETH |
174+
| `--amount` | Amount of source token per run |
175+
| `--chain` | Source chain (default: `ethereum`) |
176+
| `--interval` | DCA interval — accepts `30s`, `5m`, `1h`, `7d`, etc. Creates a recurring swap. |
177+
| `--price` | Target USD price for a limit order (mutually exclusive with `--interval`) |
178+
| `--condition` | Limit-order trigger: `above` or `below` (default: `below`) |
179+
| `--max-runs` | Stop after N executions |
180+
| `--expires` | Expiry date in ISO 8601, e.g. `2026-04-01` |
181+
182+
### automate list
183+
184+
```bash
185+
twak automate list [--json]
186+
```
187+
188+
### automate pause / resume / delete
189+
190+
```bash
191+
twak automate pause <id> [--json]
192+
twak automate resume <id> [--json]
193+
twak automate delete <id> [--json]
194+
```
195+
196+
Use the `id` returned by `automate list`. Paused automations stop executing but stay in storage; deleted ones are removed.
197+
198+
---
199+
155200
## onramp
156201

157202
Buy crypto with fiat (onramp) or sell crypto for fiat (offramp) through third-party providers. Quotes are aggregated; the user completes KYC and payment in the provider's hosted browser flow. Available providers depend on the user's region.
@@ -407,6 +452,59 @@ twak alert delete <id> [--json]
407452

408453
---
409454

455+
## x402
456+
457+
Pay for HTTP endpoints that respond with `402 Payment Required`. The client signs an on-chain payment authorization (EIP-3009 gasless preferred over Permit2) and retries the request with the proof attached as a `PAYMENT-SIGNATURE` header.
458+
459+
### x402 quote
460+
461+
Preview the payment options an endpoint offers. Read-only — no wallet password required.
462+
463+
```bash
464+
twak x402 quote <url> [--method <method>] [--body <json>] [--json]
465+
```
466+
467+
Renders a table of available routes (chain + asset + amount + transfer method) sorted preferred-first, plus a `Next:` line with the exact `twak x402 request` command to run. Use the same `--method`/`--body` you plan to pay with — the server may emit a different challenge per verb.
468+
469+
### x402 request
470+
471+
Pay and fetch the resource.
472+
473+
```bash
474+
twak x402 request <url> --max-payment <atomic> \
475+
[--method <method>] [--body <json>] \
476+
[--prefer-network <chain>] [--prefer-method eip3009|permit2-exact] \
477+
[--prefer-asset <addr-or-name>] \
478+
[--yes] [--auto-approve] [--password <pw>] [--json]
479+
```
480+
481+
| Flag | Description |
482+
|------|-------------|
483+
| `--max-payment` | Required. Max payment to auto-approve, in atomic units of the chosen asset (e.g. `10000` = 0.01 USDC at 6dp). |
484+
| `--method` | HTTP method (default: `GET`). Body is stripped on `GET`/`HEAD`. |
485+
| `--body` | Raw request body. Sent with `Content-Type: application/json`. |
486+
| `--prefer-network` | Restrict route to a chain — TWAK key (`base`, `bsc`, …) or CAIP-2 (`eip155:8453`). |
487+
| `--prefer-method` | Restrict to `eip3009` (gasless) or `permit2-exact`. |
488+
| `--prefer-asset` | Restrict to a contract address or a token-name substring (e.g. `Tether`, `USDC`). |
489+
| `--yes` | Skip the per-payment confirmation prompt. Still capped by `--max-payment`. |
490+
| `--auto-approve` | Skip the one-time Permit2 `approve(Permit2, MAX)` prompt (you pay gas). Independent of `--yes`. |
491+
492+
Only `https://` URLs are accepted; loopback/private IPs are rejected before any network call. EIP-3009 wins by default whenever offered with valid `extra.name`/`extra.version` metadata. Common live routes: USDC on `base` (recommended), USDC/USDT on `bsc`.
493+
494+
### x402 info
495+
496+
```bash
497+
twak x402 info
498+
```
499+
500+
Prints inline help for the x402 subcommands.
501+
502+
### Server side
503+
504+
To gate your own REST endpoints behind x402, see `twak serve --x402` below.
505+
506+
---
507+
410508
## serve
411509

412510
Start an MCP server (stdio) or REST API server for AI agent integrations.

0 commit comments

Comments
 (0)