@solana-compass/cli 0.2.0 → 0.2.2

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,207 @@
1
+ # Trading Commands Reference
2
+
3
+ ## Swap Tokens
4
+
5
+ ```bash
6
+ sol token swap <amount> <from> <to>
7
+ ```
8
+
9
+ Swaps tokens via Jupiter aggregator — best price across all Solana DEXes.
10
+
11
+ ### Examples
12
+
13
+ ```bash
14
+ sol token swap 50 usdc bonk # buy BONK with USDC
15
+ sol token swap 1.5 sol usdc # sell SOL for USDC
16
+ sol token swap 100 usdc sol --wallet bot # from a specific wallet
17
+ sol token swap 50 usdc bonk --quote-only # preview without executing
18
+ sol token swap 50 usdc bonk --slippage 100 # 1% slippage (100 bps)
19
+ sol token swap 50 usdc bonk --yes # skip confirmation
20
+ ```
21
+
22
+ ### Flags
23
+
24
+ | Flag | Default | Description |
25
+ |------|---------|-------------|
26
+ | `--slippage <bps>` | 50 | Slippage tolerance in basis points (50 = 0.5%) |
27
+ | `--quote-only` | false | Show quote without executing |
28
+ | `--wallet <name>` | default | Wallet to swap from |
29
+ | `--yes` | false | Skip confirmation prompt |
30
+
31
+ ### Token Resolution
32
+
33
+ Tokens can be specified by symbol (`sol`, `usdc`, `bonk`) or mint
34
+ address. Resolution order:
35
+
36
+ 1. Hardcoded well-known list (SOL, USDC, USDT, JUP, BONK, mSOL,
37
+ jitoSOL, bSOL, ETH, wBTC, PYTH, JTO, WEN, RNDR, JLP)
38
+ 2. Local SQLite cache (24-hour TTL)
39
+ 3. Jupiter Token API (ranked by liquidity)
40
+
41
+ For safety with unfamiliar tokens, verify with `sol token info <symbol>`
42
+ first, or use the mint address directly.
43
+
44
+ ### JSON Output
45
+
46
+ ```json
47
+ {
48
+ "ok": true,
49
+ "data": {
50
+ "signature": "4xK9...abc",
51
+ "from_token": "USDC",
52
+ "from_amount": 50,
53
+ "to_token": "BONK",
54
+ "to_amount": 2500000,
55
+ "price_impact": "0.01%",
56
+ "from_price_usd": 1.0,
57
+ "to_price_usd": 0.00002
58
+ },
59
+ "meta": { "elapsed_ms": 2100 }
60
+ }
61
+ ```
62
+
63
+ ## Send Tokens
64
+
65
+ ```bash
66
+ sol token send <amount> <token> <recipient>
67
+ ```
68
+
69
+ Send SOL or any SPL token to a wallet address.
70
+
71
+ ### Examples
72
+
73
+ ```bash
74
+ sol token send 2 sol 7nY...xyz
75
+ sol token send 50 usdc GkX...abc
76
+ sol token send 1000 bonk AgE...def --yes
77
+ sol token send 0.5 sol 7nY...xyz --wallet trading
78
+ ```
79
+
80
+ ### Flags
81
+
82
+ | Flag | Default | Description |
83
+ |------|---------|-------------|
84
+ | `--wallet <name>` | default | Wallet to send from |
85
+ | `--yes` | false | Skip confirmation prompt |
86
+
87
+ In `--json` mode, confirmations are always skipped.
88
+
89
+ ### JSON Output
90
+
91
+ ```json
92
+ {
93
+ "ok": true,
94
+ "data": {
95
+ "signature": "5aB...xyz",
96
+ "token": "USDC",
97
+ "amount": 50,
98
+ "recipient": "GkX...abc",
99
+ "price_usd": 1.0
100
+ },
101
+ "meta": { "elapsed_ms": 1500 }
102
+ }
103
+ ```
104
+
105
+ ## Check Prices
106
+
107
+ ```bash
108
+ sol token price <symbols...>
109
+ ```
110
+
111
+ ### Examples
112
+
113
+ ```bash
114
+ sol token price sol # single token
115
+ sol token price sol usdc bonk eth # multiple at once
116
+ ```
117
+
118
+ Prices come from Jupiter Price API with CoinGecko fallback.
119
+
120
+ ### JSON Output
121
+
122
+ ```json
123
+ {
124
+ "ok": true,
125
+ "data": {
126
+ "prices": [
127
+ { "symbol": "SOL", "price_usd": 150.25, "mint": "So11...1112" }
128
+ ]
129
+ },
130
+ "meta": { "elapsed_ms": 200 }
131
+ }
132
+ ```
133
+
134
+ ## Token Info
135
+
136
+ ```bash
137
+ sol token info <symbol>
138
+ ```
139
+
140
+ Shows token metadata — mint address, decimals, total supply. Useful
141
+ for verifying which token a symbol resolves to before transacting.
142
+
143
+ ## List Tokens
144
+
145
+ ```bash
146
+ sol token list # default wallet
147
+ sol token list --wallet trading # specific wallet
148
+ ```
149
+
150
+ Lists all tokens held in the wallet with balances and USD values.
151
+
152
+ ## Burn Tokens
153
+
154
+ ```bash
155
+ sol token burn <symbol> [amount]
156
+ ```
157
+
158
+ ### Examples
159
+
160
+ ```bash
161
+ sol token burn bonk 1000 # burn specific amount
162
+ sol token burn bonk --all # burn entire balance
163
+ sol token burn bonk --all --close # burn and close the account
164
+ ```
165
+
166
+ ### Flags
167
+
168
+ | Flag | Description |
169
+ |------|-------------|
170
+ | `--all` | Burn entire balance |
171
+ | `--close` | Close the token account after burning (reclaims ~0.002 SOL rent) |
172
+ | `--wallet <name>` | Wallet to burn from |
173
+ | `--yes` | Skip confirmation |
174
+
175
+ ## Close Token Accounts
176
+
177
+ ```bash
178
+ sol token close [symbol]
179
+ ```
180
+
181
+ Closes empty token accounts and reclaims rent (~0.002 SOL each).
182
+
183
+ ### Examples
184
+
185
+ ```bash
186
+ sol token close usdc # close specific account
187
+ sol token close --all --yes # close all empty accounts
188
+ sol token close --all --burn --yes # burn dust + close all
189
+ ```
190
+
191
+ ### Flags
192
+
193
+ | Flag | Description |
194
+ |------|-------------|
195
+ | `--all` | Close all eligible accounts |
196
+ | `--burn` | Burn remaining dust before closing |
197
+ | `--wallet <name>` | Wallet to close accounts in |
198
+ | `--yes` | Skip confirmation |
199
+
200
+ ## Sync Token Cache
201
+
202
+ ```bash
203
+ sol token sync
204
+ ```
205
+
206
+ Refreshes the local token metadata cache from Jupiter's token list.
207
+ Normally not needed — tokens are cached on first use.
@@ -0,0 +1,158 @@
1
+ # Troubleshooting
2
+
3
+ ## RPC Issues
4
+
5
+ ### "Rate limited" or slow responses
6
+
7
+ The public Solana RPC (`api.mainnet-beta.solana.com`) rate-limits
8
+ aggressively. Set a dedicated RPC endpoint:
9
+
10
+ ```bash
11
+ sol config set rpc.url https://your-rpc-endpoint.com
12
+ ```
13
+
14
+ Free RPC tiers are available from Helius, Triton, and QuickNode.
15
+
16
+ ### RPC resolution order
17
+
18
+ The CLI finds an RPC endpoint in this order:
19
+
20
+ 1. `--rpc` flag on the command
21
+ 2. `SOL_RPC_URL` environment variable
22
+ 3. `~/.sol/config.toml` → `rpc.url`
23
+ 4. Solana CLI config (`solana config get`)
24
+ 5. Public mainnet RPC (with warning)
25
+
26
+ ### "Failed to fetch blockhash" / connection errors
27
+
28
+ - Check that your RPC URL is correct: `sol config get rpc.url`
29
+ - Verify the endpoint is reachable: `curl <your-rpc-url> -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}'`
30
+ - Try a different RPC provider
31
+
32
+ ## Token Resolution
33
+
34
+ ### Wrong token resolved
35
+
36
+ Symbol search is ranked by liquidity, but ambiguous symbols can
37
+ resolve to the wrong token. To verify:
38
+
39
+ ```bash
40
+ sol token info <symbol> # check the mint address
41
+ ```
42
+
43
+ To avoid ambiguity, use the mint address directly:
44
+
45
+ ```bash
46
+ sol token swap 50 usdc EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
47
+ ```
48
+
49
+ ### "Token not found"
50
+
51
+ - Run `sol token sync` to refresh the local cache
52
+ - Use the full mint address instead of a symbol
53
+ - Check if the token exists on Jupiter: some very new or illiquid
54
+ tokens may not be indexed yet
55
+
56
+ ## Transaction Issues
57
+
58
+ ### "Transaction simulation failed"
59
+
60
+ Common causes:
61
+ - **Insufficient balance**: Check with `sol wallet balance`
62
+ - **Slippage exceeded**: Increase with `--slippage <bps>` (e.g. `--slippage 200` for 2%)
63
+ - **Account not initialized**: The CLI creates associated token accounts
64
+ automatically, but some edge cases may require manual setup
65
+
66
+ ### "Transaction expired"
67
+
68
+ Solana transactions have a ~60-second lifetime. This can happen when:
69
+ - The RPC is slow to relay the transaction
70
+ - Network congestion is high
71
+
72
+ The CLI retries automatically with backoff. If it keeps failing, try
73
+ again or use a faster RPC endpoint.
74
+
75
+ ### "Blockhash not found"
76
+
77
+ Usually means the transaction took too long to confirm. The CLI
78
+ handles retry logic, but persistent failures suggest RPC issues.
79
+
80
+ ## Wallet Issues
81
+
82
+ ### "No wallets found"
83
+
84
+ Create one:
85
+
86
+ ```bash
87
+ sol wallet create --name main
88
+ ```
89
+
90
+ Or import from Solana CLI:
91
+
92
+ ```bash
93
+ sol wallet import --solana-cli
94
+ ```
95
+
96
+ ### "Wallet not found: <name>"
97
+
98
+ Check available wallets:
99
+
100
+ ```bash
101
+ sol wallet list
102
+ ```
103
+
104
+ Wallet names are case-sensitive.
105
+
106
+ ### Recovering a removed wallet
107
+
108
+ `sol wallet remove` renames the key file to `<name>.json.deleted` in
109
+ `~/.sol/wallets/`. To recover, rename it back:
110
+
111
+ ```bash
112
+ mv ~/.sol/wallets/old-wallet.json.deleted ~/.sol/wallets/old-wallet.json
113
+ ```
114
+
115
+ Then re-import it:
116
+
117
+ ```bash
118
+ sol wallet import ~/.sol/wallets/old-wallet.json --name old-wallet
119
+ ```
120
+
121
+ ## Staking Issues
122
+
123
+ ### "Stake account is activating"
124
+
125
+ New stakes take 1 epoch (~2-3 days) to become active. During this
126
+ time, the account shows as "activating" and cannot be withdrawn.
127
+
128
+ ### "Cannot withdraw active stake"
129
+
130
+ Active stake must be deactivated first. Use `--force` to deactivate:
131
+
132
+ ```bash
133
+ sol stake withdraw 7gK...abc --force
134
+ ```
135
+
136
+ After deactivation, wait one epoch for it to become inactive, then
137
+ withdraw.
138
+
139
+ ## Database Issues
140
+
141
+ ### Corrupted database
142
+
143
+ The SQLite database is at `~/.sol/data.db`. If it becomes corrupted:
144
+
145
+ ```bash
146
+ rm ~/.sol/data.db
147
+ ```
148
+
149
+ The CLI will recreate it on next run. You'll lose transaction history
150
+ and snapshots, but wallet key files are stored separately and are
151
+ not affected.
152
+
153
+ ## General Tips
154
+
155
+ - Use `--verbose` on any command to see debug output
156
+ - Use `--json` to get structured error messages with error codes
157
+ - Check `sol config list` to verify your settings
158
+ - Run `sol network` to verify RPC connectivity and see network status
@@ -0,0 +1,152 @@
1
+ # Wallet Commands Reference
2
+
3
+ ## Create a Wallet
4
+
5
+ ```bash
6
+ sol wallet create # auto-named (wallet-1, wallet-2, ...)
7
+ sol wallet create --name trading # pick a name
8
+ sol wallet create --name bot --count 5 # batch-create 5 wallets
9
+ ```
10
+
11
+ Creates a new Ed25519 keypair and stores it as a JSON key file in
12
+ `~/.sol/wallets/<name>.json` (Solana CLI compatible format, chmod 600).
13
+
14
+ The first wallet created becomes the default for all commands.
15
+
16
+ ## List Wallets
17
+
18
+ ```bash
19
+ sol wallet list # all wallets with SOL balances
20
+ sol wallet list --label trading # filter by label
21
+ ```
22
+
23
+ Shows wallet name, address, SOL balance, and whether it's the default.
24
+ Hints at `sol wallet balance <name>` for full token breakdown.
25
+
26
+ ## Check Balances
27
+
28
+ ```bash
29
+ sol wallet balance # default wallet, all tokens + USD
30
+ sol wallet balance trading # specific wallet
31
+ ```
32
+
33
+ Displays every token held with current USD values. Tokens below the
34
+ dust threshold ($0.0001) are grouped as dust.
35
+
36
+ ## Import an Existing Wallet
37
+
38
+ ```bash
39
+ sol wallet import --solana-cli # from ~/.config/solana/id.json
40
+ sol wallet import ./keypair.json --name cold
41
+ sol wallet import /path/to/key.json
42
+ ```
43
+
44
+ Copies the key file into `~/.sol/wallets/`. The `--solana-cli` flag
45
+ imports from the default Solana CLI keypair location.
46
+
47
+ ## Export / Show Key File Path
48
+
49
+ ```bash
50
+ sol wallet export main
51
+ ```
52
+
53
+ Prints the file system path to the key file. Does NOT print the
54
+ private key itself.
55
+
56
+ ## Remove a Wallet
57
+
58
+ ```bash
59
+ sol wallet remove old-wallet
60
+ ```
61
+
62
+ Removes the wallet from the registry. The key file is renamed with a
63
+ `.deleted` suffix (not permanently deleted) so it can be recovered.
64
+
65
+ ## Set Default Wallet
66
+
67
+ ```bash
68
+ sol wallet set-default trading
69
+ ```
70
+
71
+ Changes which wallet is used when `--wallet` is not specified.
72
+
73
+ ## Labels
74
+
75
+ ```bash
76
+ sol wallet label main --add trading # add a label
77
+ sol wallet label main --add defi --add bot # multiple labels
78
+ sol wallet label main --remove trading # remove a label
79
+ ```
80
+
81
+ Labels are freeform tags for organizing wallets. Use them with
82
+ `sol wallet list --label <label>` to filter.
83
+
84
+ ## Transaction History
85
+
86
+ ```bash
87
+ sol wallet history # recent transactions
88
+ sol wallet history --limit 20 # more results
89
+ sol wallet history --type swap # filter by type (swap, send, stake, lend)
90
+ sol wallet history trading # specific wallet
91
+ ```
92
+
93
+ Shows transactions from the local log — type, tokens, amounts, USD
94
+ values at execution time, and timestamps.
95
+
96
+ ## Fund via Fiat Onramp
97
+
98
+ ```bash
99
+ sol wallet fund # default wallet, default amount
100
+ sol wallet fund --amount 50 # specify USD amount
101
+ sol wallet fund trading --provider moonpay
102
+ ```
103
+
104
+ Generates a URL to purchase SOL via a fiat onramp provider. Opens
105
+ in your browser.
106
+
107
+ ## Wallet Flag
108
+
109
+ Any command accepts `--wallet <name>` to override the default wallet:
110
+
111
+ ```bash
112
+ sol wallet balance --wallet trading
113
+ sol token swap 50 usdc bonk --wallet trading
114
+ sol stake new 10 --wallet cold
115
+ sol lend deposit 100 usdc --wallet defi
116
+ sol portfolio --wallet trading
117
+ ```
118
+
119
+ ## JSON Output
120
+
121
+ All wallet commands support `--json`:
122
+
123
+ ```bash
124
+ sol wallet list --json
125
+ sol wallet balance --json
126
+ ```
127
+
128
+ ### Example: `sol wallet list --json`
129
+
130
+ ```json
131
+ {
132
+ "ok": true,
133
+ "data": {
134
+ "wallets": [
135
+ {
136
+ "name": "main",
137
+ "address": "7nY...xyz",
138
+ "sol_balance": 12.5,
139
+ "is_default": true,
140
+ "labels": ["trading"]
141
+ }
142
+ ]
143
+ },
144
+ "meta": { "elapsed_ms": 320 }
145
+ }
146
+ ```
147
+
148
+ ## Data Storage
149
+
150
+ - Key files: `~/.sol/wallets/<name>.json`
151
+ - Wallet registry: `~/.sol/data.db` (SQLite)
152
+ - Config: `~/.sol/config.toml`