fuego-cli 0.1.0 ā 1.1.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.
- package/README.md +292 -49
- package/dist/commands/addbook.d.ts +9 -0
- package/dist/commands/addbook.d.ts.map +1 -0
- package/dist/commands/addbook.js +111 -0
- package/dist/commands/addbook.js.map +1 -0
- package/dist/commands/addrpc.d.ts +7 -0
- package/dist/commands/addrpc.d.ts.map +1 -0
- package/dist/commands/addrpc.js +41 -0
- package/dist/commands/addrpc.js.map +1 -0
- package/dist/commands/balance.d.ts +2 -0
- package/dist/commands/balance.d.ts.map +1 -0
- package/dist/commands/balance.js +58 -0
- package/dist/commands/balance.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +26 -9
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +51 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +11 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/send.d.ts +7 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +128 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +39 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/update.d.ts +7 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +92 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +25 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +56 -0
- package/dist/lib/config.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/addbook.ts +155 -0
- package/src/commands/addrpc.ts +57 -0
- package/src/commands/balance.ts +82 -0
- package/src/commands/create.ts +30 -9
- package/src/commands/dashboard.ts +59 -0
- package/src/commands/install.ts +14 -1
- package/src/commands/send.ts +162 -0
- package/src/commands/serve.ts +48 -0
- package/src/commands/update.ts +120 -0
- package/src/index.ts +71 -0
- package/src/lib/config.ts +75 -3
- package/fuego-cli-0.1.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,64 +1,282 @@
|
|
|
1
|
-
# š„
|
|
1
|
+
# š„ fuego-cli
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<pre>
|
|
6
|
+
āāāāāāāāāāā āāāāāāāāāāā āāāāāāā āāāāāāā
|
|
7
|
+
āāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāā
|
|
8
|
+
āāāāāā āāā āāāāāāāāā āāā āāāāāāā āāā
|
|
9
|
+
āāāāāā āāā āāāāāāāāā āāā āāāāāā āāā
|
|
10
|
+
āāā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
11
|
+
āāā āāāāāāā āāāāāāāā āāāāāāā āāāāāāā
|
|
12
|
+
</pre>
|
|
13
|
+
<h3>š„š¦ Agentic Solana Wallet CLI š¦š„</h3>
|
|
14
|
+
<p><strong>Zero friction. Maximum agent autonomy.</strong></p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="https://www.npmjs.com/package/fuego-cli"><img src="https://img.shields.io/npm/v/fuego-cli.svg?style=flat-square" alt="npm version"></a>
|
|
18
|
+
<a href="https://github.com/willmcdeezy/fuego-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License"></a>
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
2
21
|
|
|
3
|
-
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Why Fuego?
|
|
25
|
+
|
|
26
|
+
**The first Solana wallet CLI designed FOR autonomous agents.**
|
|
27
|
+
|
|
28
|
+
- ā” **Zero friction** ā No prompts, no waiting, just instant signing
|
|
29
|
+
- š¤ **Agent-first** ā Built for automated workflows
|
|
30
|
+
- š **Local-only** ā Keys never leave your machine
|
|
31
|
+
- š **Auto-updating** ā Stay current with `fuego update`
|
|
4
32
|
|
|
5
|
-
|
|
33
|
+
---
|
|
6
34
|
|
|
7
35
|
## Installation
|
|
8
36
|
|
|
9
37
|
```bash
|
|
10
|
-
npm install -g
|
|
38
|
+
npm install -g fuego-cli
|
|
11
39
|
```
|
|
12
40
|
|
|
41
|
+
---
|
|
42
|
+
|
|
13
43
|
## Quick Start
|
|
14
44
|
|
|
15
45
|
```bash
|
|
16
|
-
#
|
|
17
|
-
fuego
|
|
18
|
-
|
|
19
|
-
# Create a new Fuego wallet
|
|
20
|
-
fuego create --name my-wallet
|
|
46
|
+
# 1. Create a wallet
|
|
47
|
+
fuego create
|
|
21
48
|
|
|
22
|
-
# Install the
|
|
49
|
+
# 2. Install the Fuego server & tools
|
|
23
50
|
fuego install
|
|
51
|
+
|
|
52
|
+
# 3. Start the server
|
|
53
|
+
fuego serve
|
|
54
|
+
|
|
55
|
+
# 4. Check your balance
|
|
56
|
+
fuego balance
|
|
57
|
+
|
|
58
|
+
# 5. Open the dashboard
|
|
59
|
+
fuego dashboard
|
|
24
60
|
```
|
|
25
61
|
|
|
62
|
+
---
|
|
63
|
+
|
|
26
64
|
## Commands
|
|
27
65
|
|
|
28
|
-
###
|
|
66
|
+
### Wallet Management
|
|
29
67
|
|
|
30
|
-
|
|
68
|
+
| Command | Description |
|
|
69
|
+
|---------|-------------|
|
|
70
|
+
| `fuego create` | Create a new Solana wallet |
|
|
71
|
+
| `fuego address` | Show your wallet address |
|
|
72
|
+
| `fuego balance` | Check SOL, USDC, USDT balances |
|
|
73
|
+
| `fuego addrpc` | Configure your Solana RPC endpoint |
|
|
74
|
+
| `fuego addbook` | Manage your address book |
|
|
75
|
+
| `fuego send` | Send SOL, USDC, or USDT to an address or contact |
|
|
31
76
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
77
|
+
### Project Management
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| `fuego install` | Install the [Fuego server & tools](https://github.com/willmcdeezy/fuego) |
|
|
82
|
+
| `fuego serve` | Start the Rust server (`cargo run`) |
|
|
83
|
+
| `fuego dashboard` | Open the HTML dashboard |
|
|
84
|
+
| `fuego update` | Update CLI and/or Fuego project |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Detailed Usage
|
|
89
|
+
|
|
90
|
+
### `fuego create [options]`
|
|
91
|
+
|
|
92
|
+
Create a new Fuego wallet with zero passwords.
|
|
36
93
|
|
|
37
|
-
**Example:**
|
|
38
94
|
```bash
|
|
39
95
|
fuego create --name prod-wallet
|
|
40
96
|
```
|
|
41
97
|
|
|
42
|
-
|
|
98
|
+
**Options:**
|
|
99
|
+
- `-f, --force` ā Overwrite existing wallet
|
|
100
|
+
- `-n, --name <name>` ā Wallet name (default: "default")
|
|
101
|
+
|
|
102
|
+
**Creates:**
|
|
43
103
|
```
|
|
44
104
|
~/.fuego/
|
|
45
|
-
āāā wallet.json # Private key (
|
|
46
|
-
āāā wallet-config.json #
|
|
47
|
-
|
|
105
|
+
āāā wallet.json # Private key (600 permissions)
|
|
106
|
+
āāā wallet-config.json # Public key + metadata
|
|
107
|
+
āāā config.json # CLI config with versions
|
|
108
|
+
āāā contacts/
|
|
109
|
+
āāā address-book.json # Your saved contacts
|
|
48
110
|
```
|
|
49
111
|
|
|
50
|
-
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### `fuego balance`
|
|
115
|
+
|
|
116
|
+
Check balances via the Fuego server.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
fuego balance
|
|
120
|
+
# or
|
|
121
|
+
fuego bal
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Output:**
|
|
125
|
+
```
|
|
126
|
+
š° Your Balances
|
|
127
|
+
|
|
128
|
+
Address: DmFy...eUZF
|
|
129
|
+
|
|
130
|
+
- SOL: 1.234567890
|
|
131
|
+
- USDC: $0.00
|
|
132
|
+
- USDT: $0.00
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### `fuego serve`
|
|
138
|
+
|
|
139
|
+
Start the Fuego Rust server.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
fuego serve
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Auto-detects installation at:
|
|
146
|
+
- `~/.openclaw/workspace/fuego` (OpenClaw agents)
|
|
147
|
+
- `./fuego` (local installs)
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### `fuego dashboard`
|
|
152
|
+
|
|
153
|
+
Open the dashboard in your default browser.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
fuego dashboard
|
|
157
|
+
# or
|
|
158
|
+
fuego dash
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### `fuego update [options]`
|
|
164
|
+
|
|
165
|
+
Update everything with one command.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Update both
|
|
169
|
+
fuego update
|
|
170
|
+
|
|
171
|
+
# Update only CLI
|
|
172
|
+
fuego update --cli
|
|
173
|
+
|
|
174
|
+
# Update only Fuego project
|
|
175
|
+
fuego update --fuego
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Tracks versions in `~/.fuego/config.json`:**
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"fuego-cli": {
|
|
182
|
+
"version": "0.1.0",
|
|
183
|
+
"lastUpdated": "2026-02-24T18:30:00.000Z"
|
|
184
|
+
},
|
|
185
|
+
"fuego": {
|
|
186
|
+
"version": "a1b2c3d",
|
|
187
|
+
"lastUpdated": "2026-02-24T18:35:00.000Z"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### `fuego addrpc [options]`
|
|
51
195
|
|
|
52
|
-
|
|
196
|
+
Configure your Solana RPC endpoint for faster or more reliable connections.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Show current RPC configuration
|
|
200
|
+
fuego addrpc
|
|
201
|
+
|
|
202
|
+
# Set a custom RPC endpoint
|
|
203
|
+
fuego addrpc --url https://helius.xyz/... --network mainnet
|
|
204
|
+
|
|
205
|
+
# Use public mainnet
|
|
206
|
+
fuego addrpc --url https://api.mainnet-beta.solana.com
|
|
207
|
+
```
|
|
53
208
|
|
|
54
209
|
**Options:**
|
|
55
|
-
- `-
|
|
210
|
+
- `-u, --url <url>` ā RPC endpoint URL
|
|
211
|
+
- `-n, --network <network>` ā Network type: `mainnet`, `devnet`, `testnet` (default: `mainnet`)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### `fuego addbook <subcommand>`
|
|
216
|
+
|
|
217
|
+
Manage your address book for quick access to frequently used addresses.
|
|
56
218
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
219
|
+
```bash
|
|
220
|
+
# Add a contact
|
|
221
|
+
fuego addbook add melanie GvCoHGGBR97Yphzc6SrRycZyS31oUYBM8m9hLRtJT7r5 --label "Melanie's wallet"
|
|
222
|
+
|
|
223
|
+
# List all contacts
|
|
224
|
+
fuego addbook list
|
|
225
|
+
|
|
226
|
+
# Show specific contact
|
|
227
|
+
fuego addbook show melanie
|
|
228
|
+
|
|
229
|
+
# Remove contact (with confirmation)
|
|
230
|
+
fuego addbook remove melanie --yes
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Storage:** `~/.fuego/contacts/address-book.json`
|
|
234
|
+
|
|
235
|
+
**Commands:**
|
|
236
|
+
- `add <name> <address> [--label "description"]` ā Add a contact
|
|
237
|
+
- `list` ā Show all contacts
|
|
238
|
+
- `show <name>` ā Show contact details
|
|
239
|
+
- `remove <name> [--yes]` ā Remove a contact
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### `fuego send <recipient> <amount>`
|
|
244
|
+
|
|
245
|
+
Send SOL, USDC, or USDT to a Solana address or address book contact.
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Send SOL to an address
|
|
249
|
+
fuego send GvCoHGGBR97Yphzc6SrRycZyS31oUYBM8m9hLRtJT7r5 0.5 --token SOL
|
|
250
|
+
|
|
251
|
+
# Send USDC to an address book contact
|
|
252
|
+
fuego send melanie 10 --token USDC
|
|
253
|
+
|
|
254
|
+
# Send and confirm immediately
|
|
255
|
+
fuego send melanie 5 --token USDT --yes
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Options:**
|
|
259
|
+
- `-t, --token <token>` ā **Required.** Token to send: `SOL`, `USDC`, or `USDT`
|
|
260
|
+
- `-y, --yes` ā Skip confirmation prompt and send immediately
|
|
261
|
+
|
|
262
|
+
**Recipient can be:**
|
|
263
|
+
- A full Solana address (e.g., `GvCoHGGBR97Yphzc6SrRycZyS31oUYBM8m9hLRtJT7r5`)
|
|
264
|
+
- An address book contact name (e.g., `melanie`)
|
|
265
|
+
|
|
266
|
+
**Safety:** By default, `fuego send` shows a transaction preview and requires `--yes` to confirm. This prevents accidental sends.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### `fuego install [options]`
|
|
271
|
+
|
|
272
|
+
Install the [Fuego project](https://github.com/willmcdeezy/fuego) ā Rust server, Python scripts, and dashboard.
|
|
273
|
+
|
|
274
|
+
**Auto-detection:**
|
|
275
|
+
1. Checks for `~/.openclaw/workspace` first (OpenClaw agent machines)
|
|
276
|
+
2. If not found, creates `./fuego` in your **current directory**
|
|
277
|
+
|
|
278
|
+
> **Note:** This installs the Fuego server to `./fuego/` (or your custom path), not to `~/.fuego/`. The `~/.fuego/` folder is only for your wallet files and CLI config.
|
|
60
279
|
|
|
61
|
-
**Example:**
|
|
62
280
|
```bash
|
|
63
281
|
# Auto-detect best location
|
|
64
282
|
fuego install
|
|
@@ -67,43 +285,68 @@ fuego install
|
|
|
67
285
|
fuego install --path ~/projects/my-fuego
|
|
68
286
|
```
|
|
69
287
|
|
|
70
|
-
|
|
288
|
+
---
|
|
71
289
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
290
|
+
## Architecture
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
āāāāāāāāāāāāāāāāāāā
|
|
294
|
+
ā fuego-cli ā ā This package (wallet + commands)
|
|
295
|
+
ā (Node.js/npm) ā
|
|
296
|
+
āāāāāāāāāā¬āāāāāāāāā
|
|
297
|
+
ā
|
|
298
|
+
ā¼
|
|
299
|
+
āāāāāāāāāāāāāāāāāāā
|
|
300
|
+
ā ~/.fuego/ ā ā Wallet storage
|
|
301
|
+
ā wallet.json ā
|
|
302
|
+
āāāāāāāāāā¬āāāāāāāāā
|
|
303
|
+
ā
|
|
304
|
+
ā¼
|
|
305
|
+
āāāāāāāāāāāāāāāāāāā
|
|
306
|
+
ā Fuego Server ā ā Rust server (separate repo)
|
|
307
|
+
ā (cargo run) ā
|
|
308
|
+
āāāāāāāāāā¬āāāāāāāāā
|
|
309
|
+
ā
|
|
310
|
+
ā¼
|
|
311
|
+
āāāāāāāāāāāāāāāāāāā
|
|
312
|
+
ā Solana Network ā ā mainnet/devnet
|
|
313
|
+
āāāāāāāāāāāāāāāāāāā
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
76
317
|
|
|
77
318
|
## Development
|
|
78
319
|
|
|
79
320
|
```bash
|
|
80
|
-
# Clone and setup
|
|
81
321
|
git clone https://github.com/willmcdeezy/fuego-cli.git
|
|
82
322
|
cd fuego-cli
|
|
83
323
|
npm install
|
|
84
|
-
|
|
85
|
-
# Build (uses npx tsc)
|
|
86
324
|
npm run build
|
|
87
|
-
|
|
88
|
-
# Test locally
|
|
89
|
-
npm start -- --help
|
|
90
|
-
npm start create --name test
|
|
91
|
-
|
|
92
|
-
# Link for global testing
|
|
93
|
-
npm link
|
|
94
|
-
fuego --help
|
|
325
|
+
npm link # Global testing
|
|
95
326
|
```
|
|
96
327
|
|
|
328
|
+
---
|
|
329
|
+
|
|
97
330
|
## Security
|
|
98
331
|
|
|
99
|
-
- Private keys
|
|
100
|
-
-
|
|
101
|
-
-
|
|
332
|
+
- ā
Private keys: `chmod 600` (owner only)
|
|
333
|
+
- ā
Local-first: No cloud, no hosted wallets
|
|
334
|
+
- ā
Separate concerns: CLI vs server vs wallet
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Related Projects
|
|
339
|
+
|
|
340
|
+
- š„ [fuego](https://github.com/willmcdeezy/fuego) ā Rust server, Python scripts, dashboard
|
|
341
|
+
|
|
342
|
+
---
|
|
102
343
|
|
|
103
344
|
## License
|
|
104
345
|
|
|
105
|
-
MIT
|
|
346
|
+
MIT Ā© Will McDeezy
|
|
106
347
|
|
|
107
348
|
---
|
|
108
349
|
|
|
109
|
-
|
|
350
|
+
<div align="center">
|
|
351
|
+
<sub>Built with š„ for the agent economy</sub>
|
|
352
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function addBookAddCommand(name: string, address: string, options: {
|
|
2
|
+
label?: string;
|
|
3
|
+
}): Promise<void>;
|
|
4
|
+
export declare function addBookListCommand(): Promise<void>;
|
|
5
|
+
export declare function addBookShowCommand(name: string): Promise<void>;
|
|
6
|
+
export declare function addBookRemoveCommand(name: string, options: {
|
|
7
|
+
yes?: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=addbook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addbook.d.ts","sourceRoot":"","sources":["../../src/commands/addbook.ts"],"names":[],"mappings":"AAqCA,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCjH;AAGD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqBxD;AAGD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBpE;AAGD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BlG"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
import { showSuccess, showInfo, showWarning, flameDivider } from '../lib/ascii.js';
|
|
6
|
+
const CONTACTS_DIR = path.join(os.homedir(), '.fuego', 'contacts');
|
|
7
|
+
const ADDRESS_BOOK_FILE = path.join(CONTACTS_DIR, 'address-book.json');
|
|
8
|
+
function loadAddressBook() {
|
|
9
|
+
if (!fs.existsSync(ADDRESS_BOOK_FILE)) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
return fs.readJsonSync(ADDRESS_BOOK_FILE);
|
|
13
|
+
}
|
|
14
|
+
function saveAddressBook(book) {
|
|
15
|
+
fs.ensureDirSync(CONTACTS_DIR);
|
|
16
|
+
fs.writeJsonSync(ADDRESS_BOOK_FILE, book, { spaces: 2 });
|
|
17
|
+
}
|
|
18
|
+
function isValidSolanaAddress(address) {
|
|
19
|
+
// Basic Solana address validation (32-44 chars, base58)
|
|
20
|
+
return /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
|
|
21
|
+
}
|
|
22
|
+
// Add a contact
|
|
23
|
+
export async function addBookAddCommand(name, address, options) {
|
|
24
|
+
console.log();
|
|
25
|
+
if (!name || !address) {
|
|
26
|
+
console.log(chalk.red('ā Usage: fuego addbook add <name> <address> [--label "description"]'));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// Validate address
|
|
30
|
+
if (!isValidSolanaAddress(address)) {
|
|
31
|
+
console.log(chalk.red('ā Invalid Solana address format.'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const book = loadAddressBook();
|
|
35
|
+
// Check if name already exists
|
|
36
|
+
if (book[name]) {
|
|
37
|
+
showWarning(`Contact "${name}" already exists.\n\nUse a different name or remove the existing contact first.`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Add contact
|
|
41
|
+
book[name] = {
|
|
42
|
+
address,
|
|
43
|
+
label: options.label,
|
|
44
|
+
addedAt: new Date().toISOString()
|
|
45
|
+
};
|
|
46
|
+
saveAddressBook(book);
|
|
47
|
+
showSuccess('ā
Contact Added', `Name: ${chalk.cyan(name)}\nAddress: ${chalk.cyan(address.slice(0, 8))}...${chalk.cyan(address.slice(-8))}${options.label ? '\nLabel: ' + chalk.cyan(options.label) : ''}`);
|
|
48
|
+
flameDivider();
|
|
49
|
+
}
|
|
50
|
+
// List all contacts
|
|
51
|
+
export async function addBookListCommand() {
|
|
52
|
+
console.log();
|
|
53
|
+
const book = loadAddressBook();
|
|
54
|
+
const contacts = Object.entries(book);
|
|
55
|
+
if (contacts.length === 0) {
|
|
56
|
+
showInfo('š Address Book', ['No contacts yet.', '', chalk.yellow('Add one: fuego addbook add <name> <address>')]);
|
|
57
|
+
flameDivider();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const lines = [`${contacts.length} contact${contacts.length === 1 ? '' : 's'}\n`];
|
|
61
|
+
for (const [name, entry] of contacts) {
|
|
62
|
+
const shortAddr = `${entry.address.slice(0, 6)}...${entry.address.slice(-6)}`;
|
|
63
|
+
lines.push(`${chalk.cyan(name)}: ${chalk.white(shortAddr)}${entry.label ? chalk.gray(` (${entry.label})`) : ''}`);
|
|
64
|
+
}
|
|
65
|
+
showInfo('š Address Book', lines);
|
|
66
|
+
flameDivider();
|
|
67
|
+
}
|
|
68
|
+
// Show a specific contact
|
|
69
|
+
export async function addBookShowCommand(name) {
|
|
70
|
+
console.log();
|
|
71
|
+
if (!name) {
|
|
72
|
+
console.log(chalk.red('ā Usage: fuego addbook show <name>'));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
const book = loadAddressBook();
|
|
76
|
+
const entry = book[name];
|
|
77
|
+
if (!entry) {
|
|
78
|
+
console.log(chalk.red(`ā Contact "${name}" not found.`));
|
|
79
|
+
console.log(chalk.gray('\nUse "fuego addbook list" to see all contacts.'));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
showInfo(`š ${name}`, [
|
|
83
|
+
`Address: ${chalk.white(entry.address)}`,
|
|
84
|
+
entry.label ? `Label: ${chalk.cyan(entry.label)}` : '',
|
|
85
|
+
`Added: ${chalk.gray(new Date(entry.addedAt).toLocaleDateString())}`
|
|
86
|
+
].filter(Boolean));
|
|
87
|
+
flameDivider();
|
|
88
|
+
}
|
|
89
|
+
// Remove a contact
|
|
90
|
+
export async function addBookRemoveCommand(name, options) {
|
|
91
|
+
console.log();
|
|
92
|
+
if (!name) {
|
|
93
|
+
console.log(chalk.red('ā Usage: fuego addbook remove <name> [--yes]'));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const book = loadAddressBook();
|
|
97
|
+
if (!book[name]) {
|
|
98
|
+
console.log(chalk.red(`ā Contact "${name}" not found.`));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
// Confirm unless --yes flag
|
|
102
|
+
if (!options.yes) {
|
|
103
|
+
showWarning(`About to remove "${name}" (${book[name].address.slice(0, 8)}...${book[name].address.slice(-8)})\n\nUse --yes to confirm, or omit to review.`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
delete book[name];
|
|
107
|
+
saveAddressBook(book);
|
|
108
|
+
showSuccess('ā
Contact Removed', `Removed "${chalk.cyan(name)}" from address book.`);
|
|
109
|
+
flameDivider();
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=addbook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addbook.js","sourceRoot":"","sources":["../../src/commands/addbook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACnE,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;AAYvE,SAAS,eAAe;IACtB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,eAAe,CAAC,IAAiB;IACxC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/B,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,wDAAwD;IACxD,OAAO,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,OAAe,E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AAC,8CAA8C,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAE/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,IAAI,cAAc,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,WAAW,CAAC,oBAAoB,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC;QAC3J,OAAO;IACT,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtB,WAAW,CAAC,mBAAmB,EAAE,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACrF,YAAY,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addrpc.d.ts","sourceRoot":"","sources":["../../src/commands/addrpc.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA+CzE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { setConfig, getConfig } from '../lib/config.js';
|
|
3
|
+
import { showSuccess, showInfo, flameDivider } from '../lib/ascii.js';
|
|
4
|
+
export async function addRpcCommand(options) {
|
|
5
|
+
console.log(); // spacer
|
|
6
|
+
// If no URL provided, show current config and help
|
|
7
|
+
if (!options.url) {
|
|
8
|
+
const currentRpc = getConfig('rpcUrl');
|
|
9
|
+
const currentNetwork = getConfig('network');
|
|
10
|
+
showInfo('āļø Current RPC Configuration', [
|
|
11
|
+
`RPC URL: ${currentRpc ? chalk.cyan(currentRpc) : chalk.gray('Not set')}`,
|
|
12
|
+
`Network: ${currentNetwork ? chalk.cyan(currentNetwork) : chalk.gray('mainnet')}`,
|
|
13
|
+
'',
|
|
14
|
+
`${chalk.yellow('Usage:')} fuego addrpc --url https://api.mainnet-beta.solana.com`,
|
|
15
|
+
`${chalk.yellow('Or:')} fuego addrpc --url https://helius.xyz/... --network mainnet`
|
|
16
|
+
]);
|
|
17
|
+
flameDivider();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Validate URL
|
|
21
|
+
try {
|
|
22
|
+
new URL(options.url);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
console.log(chalk.red('ā Invalid URL. Please provide a valid RPC endpoint.'));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
// Set the RPC URL
|
|
29
|
+
setConfig('rpcUrl', options.url);
|
|
30
|
+
// Set network if provided, default to mainnet
|
|
31
|
+
const network = options.network || 'mainnet';
|
|
32
|
+
setConfig('network', network);
|
|
33
|
+
showSuccess('ā
RPC Configuration Updated', `URL: ${chalk.cyan(options.url)}\nNetwork: ${chalk.cyan(network)}`);
|
|
34
|
+
showInfo('š” Tips', [
|
|
35
|
+
'Premium RPCs (Helius, QuickNode) offer better performance',
|
|
36
|
+
'Free public RPCs may have rate limits',
|
|
37
|
+
'Your wallet address remains the same across networks'
|
|
38
|
+
]);
|
|
39
|
+
flameDivider();
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=addrpc.js.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QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,kBAAkB;IAClB,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAEjC,8CAA8C;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC;IAC7C,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE9B,WAAW,CACT,6BAA6B,EAC7B,QAAQ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CACnE,CAAC;IAEF,QAAQ,CAAC,SAAS,EAAE;QAClB,2DAA2D;QAC3D,uCAAuC;QACvC,sDAAsD;KACvD,CAAC,CAAC;IAEH,YAAY,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAqBA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA4DpD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { loadWalletConfig } from '../lib/config.js';
|
|
3
|
+
import { showInfo, formatPublicKey, flameDivider } from '../lib/ascii.js';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
const FUEGO_SERVER_URL = 'http://127.0.0.1:8080';
|
|
6
|
+
export async function balanceCommand() {
|
|
7
|
+
console.log(); // spacer
|
|
8
|
+
const config = loadWalletConfig();
|
|
9
|
+
if (!config) {
|
|
10
|
+
console.log(chalk.red('ā No wallet found. Run "fuego create" first.'));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
const spinner = ora('Fetching balances from Fuego server...').start();
|
|
14
|
+
try {
|
|
15
|
+
const publicKey = config.publicKey;
|
|
16
|
+
const network = 'mainnet-beta';
|
|
17
|
+
// Query SOL balance
|
|
18
|
+
const solResponse = await fetch(`${FUEGO_SERVER_URL}/balance`, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: { 'Content-Type': 'application/json' },
|
|
21
|
+
body: JSON.stringify({ network, address: publicKey })
|
|
22
|
+
});
|
|
23
|
+
const solData = await solResponse.json();
|
|
24
|
+
const solBalance = solData.success ? solData.data.sol : 0;
|
|
25
|
+
// Query USDC balance
|
|
26
|
+
const usdcResponse = await fetch(`${FUEGO_SERVER_URL}/usdc-balance`, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
body: JSON.stringify({ network, address: publicKey })
|
|
30
|
+
});
|
|
31
|
+
const usdcData = await usdcResponse.json();
|
|
32
|
+
const usdcBalance = usdcData.success ? parseFloat(usdcData.data.ui_amount) : 0;
|
|
33
|
+
// Query USDT balance
|
|
34
|
+
const usdtResponse = await fetch(`${FUEGO_SERVER_URL}/usdt-balance`, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: { 'Content-Type': 'application/json' },
|
|
37
|
+
body: JSON.stringify({ network, address: publicKey })
|
|
38
|
+
});
|
|
39
|
+
const usdtData = await usdtResponse.json();
|
|
40
|
+
const usdtBalance = usdtData.success ? parseFloat(usdtData.data.ui_amount) : 0;
|
|
41
|
+
spinner.stop();
|
|
42
|
+
showInfo('š° Your Balances', [
|
|
43
|
+
`Address: ${formatPublicKey(publicKey)}`,
|
|
44
|
+
'',
|
|
45
|
+
`${chalk.yellow('- SOL:')} ${chalk.white(solBalance.toFixed(9))}`,
|
|
46
|
+
`${chalk.green('- USDC:')} ${chalk.white('$' + usdcBalance.toFixed(2))}`,
|
|
47
|
+
`${chalk.cyan('- USDT:')} ${chalk.white('$' + usdtBalance.toFixed(2))}`,
|
|
48
|
+
]);
|
|
49
|
+
flameDivider();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
spinner.stop();
|
|
53
|
+
console.log(chalk.red(`\nā Failed to fetch balances: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
54
|
+
console.log(chalk.gray('\nMake sure the Fuego server is running: cd fuego/server && cargo run'));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAgBjD,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,SAAS;IAExB,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAElC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,wCAAwC,CAAC,CAAC,KAAK,EAAE,CAAC;IAEtE,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACnC,MAAM,OAAO,GAAG,cAAc,CAAC;QAE/B,oBAAoB;QACpB,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,GAAG,gBAAgB,UAAU,EAAE;YAC7D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,E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Q,CAAC,kBAAkB,EAAE;YAC3B,YAAY,eAAe,CAAC,SAAS,CAAC,EAAE;YACxC,EAAE;YACF,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YACrE,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YAC1E,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;SAC1E,CAAC,CAAC;QAEH,YAAY,EAAE,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;QACpH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC,CAAC;QACjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAQA,UAAU,aAAa;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAuFzE"}
|