@lightspeed-cli/speed-cli 0.1.0 → 0.1.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.
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: speed-token
|
|
3
|
+
description: The Best Full trading and bridging CLI for agents (and humans) via OpenClaw, swap, bridge, balance, price, quote, gas, send, approve, allowance, revoke, history, pending, status, estimate, doctor, whoami, config, volume, dca, xp. Use --json for machine-readable output. Powered by Lightspeed multi-chain.
|
|
4
|
+
permissions:
|
|
5
|
+
- network:outbound
|
|
6
|
+
triggers:
|
|
7
|
+
- "speed"
|
|
8
|
+
- "speed token"
|
|
9
|
+
- "speed swap"
|
|
10
|
+
- "speed bridge"
|
|
11
|
+
- "speed balance"
|
|
12
|
+
- "speed quote"
|
|
13
|
+
- "speed price"
|
|
14
|
+
- "speed gas"
|
|
15
|
+
- "speed send"
|
|
16
|
+
- "speed approve"
|
|
17
|
+
- "speed allowance"
|
|
18
|
+
- "speed revoke"
|
|
19
|
+
- "speed history"
|
|
20
|
+
- "speed pending"
|
|
21
|
+
- "speed status"
|
|
22
|
+
- "speed doctor"
|
|
23
|
+
- "speed whoami"
|
|
24
|
+
- "speed config"
|
|
25
|
+
- "speed setup"
|
|
26
|
+
- "speed estimate"
|
|
27
|
+
- "speed volume"
|
|
28
|
+
- "speed dca"
|
|
29
|
+
- "speed xp"
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# Speed Token CLI — OpenClaw skill
|
|
33
|
+
|
|
34
|
+
Use the **speed** CLI via bash. **Always pass `--json`** so output is machine-readable. Use **`-y`** or **`--yes`** to skip confirmation when executing swap/bridge (required for non-interactive use).
|
|
35
|
+
|
|
36
|
+
**Invocation:** From the project directory run `node dist/cli.js <command> [options] --json`, or if `speed` is on PATH: `speed <command> [options] --json`. From another directory, use the full path to `dist/cli.js` or ensure `speed` is on PATH.
|
|
37
|
+
|
|
38
|
+
**Chains:** Every `--chain`, `--from-chain`, `--to-chain` accepts **chain ID** (e.g. `8453`) or **name** (e.g. `base`, `ethereum`, `op`, `arb`, `polygon`, `bnb`). Supported: 1 (ethereum), 8453 (base), 10 (optimism), 42161 (arbitrum), 137 (polygon), 56 (bnb).
|
|
39
|
+
|
|
40
|
+
**Amounts:** Use **token units** (e.g. `-a 0.002`, `-a 1000`), not wei. Commands that take `-a` accept human-readable amounts.
|
|
41
|
+
|
|
42
|
+
**Speed token (default):** Address `0xB01CF1bE9568f09449382a47Cd5bF58e2A9D5922`. Volume, DCA, and gas default to Speed; use `--token <address|speed>` to use another token.
|
|
43
|
+
|
|
44
|
+
**Errors in --json mode:** CLI prints `{"error":"...", "code":"..."}` to stdout and exits 1. Parse and surface the `error` string to the user.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Global options (before command)
|
|
49
|
+
|
|
50
|
+
- `--json` — **Always use.** JSON to stdout; errors as `{ error, code }`.
|
|
51
|
+
- `-y, --yes` — Skip confirmation (required for swap, bridge, and gas in non-interactive use).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Commands reference
|
|
56
|
+
|
|
57
|
+
### Identity & setup
|
|
58
|
+
|
|
59
|
+
- **whoami** — Print wallet address (from PRIVATE_KEY). No args.
|
|
60
|
+
`speed whoami --json`
|
|
61
|
+
If this fails, user must run `speed setup` (interactive; do not run from bot).
|
|
62
|
+
|
|
63
|
+
- **setup** — Interactive; writes secrets to `~/.speed/.env`. **Do not invoke from bots.** Direct user to run `speed setup` if whoami or doctor fails.
|
|
64
|
+
|
|
65
|
+
- **doctor** — Validate env, API keys, RPC, oracles, Speed balance.
|
|
66
|
+
`speed doctor --json` or `speed doctor -c base --json`
|
|
67
|
+
|
|
68
|
+
### Balance & price
|
|
69
|
+
|
|
70
|
+
- **balance** — Speed + native + optional extra tokens. Omit `-c` for all chains.
|
|
71
|
+
`speed balance --json`
|
|
72
|
+
`speed balance -c base --json`
|
|
73
|
+
`speed balance -c base -t <token-address> --json` (repeat `-t` for multiple)
|
|
74
|
+
|
|
75
|
+
- **price** — Speed/ETH, Speed/USD, native USD (oracle).
|
|
76
|
+
`speed price -c base --json`
|
|
77
|
+
|
|
78
|
+
### Swap (one-shot: quote → approve if needed → swap)
|
|
79
|
+
|
|
80
|
+
- **swap** — Single command to execute a swap. Approve is automatic when needed. Use `-y` to skip confirmation.
|
|
81
|
+
`speed swap -c base --buy <token-address> -a 0.002 -y --json`
|
|
82
|
+
Optional: `--sell <address>` (default Speed).
|
|
83
|
+
**Preview only (no tx):** `speed swap --dry-run -c base --buy <addr> -a 0.002 --json`
|
|
84
|
+
|
|
85
|
+
- **quote** — Preview swap (no transaction).
|
|
86
|
+
`speed quote -c base --buy <token-address> -a 0.002 --json`
|
|
87
|
+
Optional: `--sell <address>`.
|
|
88
|
+
|
|
89
|
+
**Do not** tell users to run approve then quote then swap; **swap alone** does it. Use **quote** or **swap --dry-run** only when the user wants a preview.
|
|
90
|
+
|
|
91
|
+
### Bridge
|
|
92
|
+
|
|
93
|
+
- **bridge** — Bridge Speed across chains (Squid). Use `-y` to skip confirmation.
|
|
94
|
+
`speed bridge --from-chain base --to-chain ethereum -a 100 -y --json`
|
|
95
|
+
Optional: `--to-token <address>` (default Speed on destination).
|
|
96
|
+
|
|
97
|
+
### Volume & DCA (automated buy/sell)
|
|
98
|
+
|
|
99
|
+
- **volume** — Human-like volume: interleaved buys and sells (ETH ↔ token) with random-walk amounts, jittered delays, optional partial sells. Default token is Speed; use `--token <address|speed>` for another token. Continues on revert; failures are reported in summary.
|
|
100
|
+
`speed volume -c base -a 0.001 --ops 20 --delay 2 --delay-jitter 0.5 --sell-frequency 0.2 --json`
|
|
101
|
+
Optional: `--token`, `--amount-min`, `--amount-max`, `--amount-drift`, `--sell-partial-chance`, `--dry-run`.
|
|
102
|
+
|
|
103
|
+
- **dca** — DCA: buy token with ETH on a fixed time interval. Default token is Speed; use `--token <address|speed>` for another token. Runs until `--count` buys or until stopped (Ctrl+C).
|
|
104
|
+
`speed dca -c base -a 0.001 --interval 5m --count 10 --json`
|
|
105
|
+
Optional: `--token`, `--interval-jitter <fraction>`, `--dry-run`. Omit `--count` to run until stopped.
|
|
106
|
+
|
|
107
|
+
### Gas (token → native)
|
|
108
|
+
|
|
109
|
+
- **gas** — Swap token for native (ETH/MATIC/BNB) to fund gas. Default token is Speed; use `--token <address|speed>` for another token. Use `-y` for non-interactive.
|
|
110
|
+
`speed gas -c base -a 10000 -y --json`
|
|
111
|
+
|
|
112
|
+
### Send & allowances
|
|
113
|
+
|
|
114
|
+
- **send** — Plain ERC-20 transfer of Speed.
|
|
115
|
+
`speed send -c base -t <recipient-address> -a 100 -y --json`
|
|
116
|
+
|
|
117
|
+
- **approve** — Set token allowance for a spender (e.g. for scripting). Amount in token units or `max`.
|
|
118
|
+
`speed approve -c base --token <token-address> --spender <spender-address> -a 1000 --json` or `-a max --json`
|
|
119
|
+
|
|
120
|
+
- **allowance** — Read current allowance.
|
|
121
|
+
`speed allowance -c base --token <token-address> --spender <spender-address> --json`
|
|
122
|
+
|
|
123
|
+
- **revoke** — Set allowance to 0.
|
|
124
|
+
`speed revoke -c base --token <token-address> --spender <spender-address> -y --json`
|
|
125
|
+
|
|
126
|
+
### History & status
|
|
127
|
+
|
|
128
|
+
- **history** — Recent transfers (Alchemy). Omit `-c` for all chains.
|
|
129
|
+
`speed history --json` or `speed history -c base -n 20 --json`
|
|
130
|
+
|
|
131
|
+
- **pending** — In-flight bridges + pending txs.
|
|
132
|
+
`speed pending --json` or `speed pending --no-txs --json` (bridges only)
|
|
133
|
+
|
|
134
|
+
- **status** — Tx confirmation; for bridge use Squid status.
|
|
135
|
+
On-chain: `speed status --tx <tx-hash> -c base --json`
|
|
136
|
+
Bridge: `speed status --tx <tx-hash> --request-id <id> --quote-id <id> --json`
|
|
137
|
+
|
|
138
|
+
### XP (progress for bots)
|
|
139
|
+
|
|
140
|
+
- **xp** — Show level, streak, and stats (swaps, bridges, volume ops, DCA buys, gas refuels). Bots call this to see how they're doing. Stored in `~/.speed/xp.json`.
|
|
141
|
+
`speed xp --json`
|
|
142
|
+
Optional: `--no-title` to omit the silly level title.
|
|
143
|
+
|
|
144
|
+
### Estimate & config
|
|
145
|
+
|
|
146
|
+
- **estimate** — Gas cost (ETH + USD) for swap or bridge. Amount in token units (same as swap).
|
|
147
|
+
Swap: `speed estimate -c base --buy <addr> -a 0.002 --json`
|
|
148
|
+
Bridge: `speed estimate -c base --to-chain ethereum --bridge --json`
|
|
149
|
+
|
|
150
|
+
- **config** — Read/write `~/.speed/config.json` (no secrets).
|
|
151
|
+
Set: `speed config set default-chain 8453 --json`
|
|
152
|
+
Get: `speed config get --json` or `speed config get default-chain --json`
|
|
153
|
+
Keys: `default-chain`, `default-slippage`, `output-format` (human|json).
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Recommended flows for bots
|
|
158
|
+
|
|
159
|
+
1. **User wants to swap**
|
|
160
|
+
Run: `speed swap -c <chain> --buy <token> -a <amount> -y --json`. If user wants a preview first, run `speed swap --dry-run ... --json` then same without `--dry-run` and without `-y` only if you need to ask for confirmation.
|
|
161
|
+
|
|
162
|
+
2. **User wants to bridge**
|
|
163
|
+
Run: `speed bridge --from-chain <id|name> --to-chain <id|name> -a <amount> -y --json`.
|
|
164
|
+
|
|
165
|
+
3. **User wants balance**
|
|
166
|
+
Run: `speed balance --json` (all chains) or `speed balance -c <chain> --json`.
|
|
167
|
+
|
|
168
|
+
4. **User wants price**
|
|
169
|
+
Run: `speed price -c <chain> --json`.
|
|
170
|
+
|
|
171
|
+
5. **User wants to fund gas (token → native)**
|
|
172
|
+
Run: `speed gas -c <chain> -a <token-amount> -y --json`. Default token is Speed; add `--token <address|speed>` for another token.
|
|
173
|
+
|
|
174
|
+
6. **User wants volume (automated buys + sells)**
|
|
175
|
+
Run: `speed volume -c <chain> -a <eth-per-buy> --ops <n> --delay <sec> --sell-frequency <0..1> --json`. Default token is Speed; add `--token <address|speed>` for another token. Failures do not stop the run; summary includes failed count.
|
|
176
|
+
|
|
177
|
+
7. **User wants DCA (interval buys only)**
|
|
178
|
+
Run: `speed dca -c <chain> -a <eth-per-buy> --interval <sec|5m|1h|1d> --count <n> --json`, or omit `--count` to run until stopped. Default token is Speed; add `--token <address|speed>` for another token.
|
|
179
|
+
|
|
180
|
+
8. **User wants to see XP / progress**
|
|
181
|
+
Run: `speed xp --json`. Returns totalXP, level, title, streak, lastActivity, progress to next level, stats (count + totalUSD per action type), recent history.
|
|
182
|
+
|
|
183
|
+
9. **User wants gas estimate before swap/bridge**
|
|
184
|
+
Run: `speed estimate -c <chain> --buy <addr> -a <token-amount> --json` (swap) or `speed estimate -c <chain> --to-chain <id|name> --bridge --json` (bridge). Use same `-a` as the swap for comparable cost.
|
|
185
|
+
|
|
186
|
+
10. **Check if CLI is configured**
|
|
187
|
+
Run: `speed doctor --json` or `speed whoami --json`. If error, tell user to run `speed setup` in the terminal (interactive).
|
|
188
|
+
|
|
189
|
+
11. **Parse JSON:** On success, one JSON object per command. On failure, `{ error, code }`; show `error` to the user. Common success shapes: whoami `{ address }`, balance `{ address?, chains }`, swap/bridge/gas/send/approve `{ txHash, explorerLink? }`, quote `{ buyAmountWei?, ... }`, price `{ speedPerEth?, ... }`, xp `{ totalXP, level, streak, ... }`, estimate `{ gasCostEth?, gasCostUsd?, ... }`.
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed-cli/speed-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Speed Token CLI: swap, bridge, balance, price, volume, DCA, gas, XP. Uses 0x and Squid; config in ~/.speed.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"speed": "dist/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"openclaw"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "tsc",
|