@solana-compass/cli 0.2.0 → 0.2.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,128 @@
1
+ # Portfolio Commands Reference
2
+
3
+ ## View Portfolio
4
+
5
+ ```bash
6
+ sol portfolio
7
+ sol portfolio --wallet trading
8
+ ```
9
+
10
+ Unified view of everything you hold — tokens, staked SOL, and lending
11
+ positions — with USD values.
12
+
13
+ ### JSON Output
14
+
15
+ ```json
16
+ {
17
+ "ok": true,
18
+ "data": {
19
+ "positions": [
20
+ {
21
+ "type": "token",
22
+ "symbol": "SOL",
23
+ "amount": 12.5,
24
+ "value_usd": 1878.13
25
+ },
26
+ {
27
+ "type": "stake",
28
+ "symbol": "SOL",
29
+ "amount": 10,
30
+ "value_usd": 1502.50,
31
+ "validator": "Comp...ass",
32
+ "status": "active"
33
+ },
34
+ {
35
+ "type": "lend",
36
+ "symbol": "USDC",
37
+ "amount": 100,
38
+ "value_usd": 100,
39
+ "protocol": "kamino",
40
+ "apy": "8.5%"
41
+ }
42
+ ],
43
+ "total_value_usd": 3480.63
44
+ },
45
+ "meta": { "elapsed_ms": 2500 }
46
+ }
47
+ ```
48
+
49
+ ## Take a Snapshot
50
+
51
+ ```bash
52
+ sol portfolio snapshot
53
+ sol portfolio snapshot --label "pre-trade"
54
+ sol portfolio snapshot --wallet trading
55
+ ```
56
+
57
+ Saves the current portfolio state to SQLite for later comparison.
58
+
59
+ ### Flags
60
+
61
+ | Flag | Description |
62
+ |------|-------------|
63
+ | `--label <text>` | Human-readable label for the snapshot |
64
+ | `--wallet <name>` | Snapshot a specific wallet only |
65
+
66
+ Snapshots include ALL position types — tokens, stakes, and lending.
67
+
68
+ ## List Snapshot History
69
+
70
+ ```bash
71
+ sol portfolio history
72
+ ```
73
+
74
+ Lists all saved snapshots with ID, timestamp, label, and total value.
75
+
76
+ ## Compare to a Snapshot
77
+
78
+ ```bash
79
+ sol portfolio compare # vs latest snapshot
80
+ sol portfolio compare 3 # vs snapshot #3
81
+ sol portfolio compare --wallet trading
82
+ ```
83
+
84
+ Shows what changed since the snapshot — added/removed positions,
85
+ value changes, token price movements.
86
+
87
+ ## Profit and Loss
88
+
89
+ ```bash
90
+ sol portfolio pnl
91
+ sol portfolio pnl --since 5 # P&L since snapshot #5
92
+ sol portfolio pnl --wallet trading
93
+ ```
94
+
95
+ Calculates profit and loss based on the transaction log and snapshots.
96
+ The transaction log records USD prices at execution time, so cost
97
+ basis is computed automatically.
98
+
99
+ ### Flags
100
+
101
+ | Flag | Default | Description |
102
+ |------|---------|-------------|
103
+ | `--since <id>` | first snapshot | Calculate P&L from this snapshot |
104
+ | `--wallet <name>` | all wallets | Limit to a specific wallet |
105
+
106
+ ## Delete a Snapshot
107
+
108
+ ```bash
109
+ sol portfolio delete 3
110
+ ```
111
+
112
+ Permanently removes a snapshot by ID.
113
+
114
+ ## Automated Snapshots
115
+
116
+ ```bash
117
+ sol portfolio cron
118
+ ```
119
+
120
+ Prints a crontab entry you can install to take snapshots automatically
121
+ (e.g. daily at midnight). Useful for long-running portfolio tracking.
122
+
123
+ ## Tips
124
+
125
+ - Take snapshots before and after significant trades to measure impact
126
+ - Use labels to mark meaningful points ("post-rebalance", "pre-airdrop")
127
+ - The transaction log is the source of truth for cost basis — snapshots
128
+ are for point-in-time comparisons
@@ -0,0 +1,150 @@
1
+ # Staking Commands Reference
2
+
3
+ ## Create a New Stake
4
+
5
+ ```bash
6
+ sol stake new <amount>
7
+ ```
8
+
9
+ Creates a stake account, funds it with `<amount>` SOL, and delegates
10
+ to a validator — all in a single transaction.
11
+
12
+ ### Examples
13
+
14
+ ```bash
15
+ sol stake new 10 # stake 10 SOL (default validator)
16
+ sol stake new 5 --validator DPm...xyz # specific validator
17
+ sol stake new 10 --wallet cold # from a specific wallet
18
+ ```
19
+
20
+ ### Flags
21
+
22
+ | Flag | Default | Description |
23
+ |------|---------|-------------|
24
+ | `--validator <vote-address>` | Solana Compass | Validator to delegate to |
25
+ | `--wallet <name>` | default | Wallet to fund the stake from |
26
+
27
+ ### JSON Output
28
+
29
+ ```json
30
+ {
31
+ "ok": true,
32
+ "data": {
33
+ "signature": "3xY...abc",
34
+ "stake_account": "7gK...def",
35
+ "amount_sol": 10,
36
+ "validator": "Comp...ass"
37
+ },
38
+ "meta": { "elapsed_ms": 2500 }
39
+ }
40
+ ```
41
+
42
+ ## List Stake Accounts
43
+
44
+ ```bash
45
+ sol stake list
46
+ sol stake list --wallet cold
47
+ ```
48
+
49
+ Shows all stake accounts for the wallet — address, amount staked,
50
+ validator, status (activating/active/deactivating/inactive), and
51
+ any claimable MEV tips.
52
+
53
+ Hints at `sol stake claim-mev` when tips are available.
54
+
55
+ ### JSON Output
56
+
57
+ ```json
58
+ {
59
+ "ok": true,
60
+ "data": {
61
+ "stakes": [
62
+ {
63
+ "address": "7gK...def",
64
+ "amount_sol": 10,
65
+ "validator": "Comp...ass",
66
+ "status": "active",
67
+ "claimable_mev_sol": 0.05
68
+ }
69
+ ],
70
+ "total_staked_sol": 10,
71
+ "total_claimable_mev_sol": 0.05
72
+ },
73
+ "meta": { "elapsed_ms": 1200 }
74
+ }
75
+ ```
76
+
77
+ ## Claim MEV Tips
78
+
79
+ ```bash
80
+ sol stake claim-mev
81
+ sol stake claim-mev --withdraw
82
+ sol stake claim-mev 7gK...def
83
+ ```
84
+
85
+ Claims MEV tips earned by your stake accounts.
86
+
87
+ | Flag | Default | Description |
88
+ |------|---------|-------------|
89
+ | `--withdraw` | false | Send tips to wallet instead of re-staking (compounding) |
90
+ | `--wallet <name>` | default | Wallet that owns the stake accounts |
91
+
92
+ By default, tips are compounded (re-staked). Use `--withdraw` to
93
+ withdraw them to your wallet instead.
94
+
95
+ You can specify a single stake account address to claim from, or
96
+ omit it to claim from all accounts.
97
+
98
+ ## Withdraw / Unstake
99
+
100
+ ```bash
101
+ sol stake withdraw <stake-account> [amount]
102
+ ```
103
+
104
+ Withdraws SOL from a stake account. Handles the deactivation process
105
+ automatically:
106
+
107
+ - **Active stake**: Deactivates first, then you can withdraw after the
108
+ cooldown epoch
109
+ - **Inactive stake**: Withdraws immediately
110
+ - **Partially withdraw**: Specify an amount to split and withdraw
111
+
112
+ ### Examples
113
+
114
+ ```bash
115
+ sol stake withdraw 7gK...abc # withdraw all from this account
116
+ sol stake withdraw 7gK...abc 5 # withdraw 5 SOL (splits if needed)
117
+ sol stake withdraw 7gK...abc --force # force deactivate active stake
118
+ ```
119
+
120
+ ### Flags
121
+
122
+ | Flag | Default | Description |
123
+ |------|---------|-------------|
124
+ | `--wallet <name>` | default | Authority wallet |
125
+ | `--force` | false | Force deactivation of active stake |
126
+
127
+ ### JSON Output
128
+
129
+ ```json
130
+ {
131
+ "ok": true,
132
+ "data": {
133
+ "signature": "2bC...xyz",
134
+ "stake_account": "7gK...abc",
135
+ "withdrawn_sol": 10,
136
+ "action": "withdrawn"
137
+ },
138
+ "meta": { "elapsed_ms": 1800 }
139
+ }
140
+ ```
141
+
142
+ ## Validator Selection
143
+
144
+ The default validator is Solana Compass. Override with `--validator`:
145
+
146
+ ```bash
147
+ sol stake new 10 --validator DPmsofDi1YBSvDJzeUSGMiHjEGkzKFKMZRiM7GYsTKcf
148
+ ```
149
+
150
+ Use a vote account address (not the node identity).
@@ -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