@solana-compass/cli 0.1.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,174 @@
1
+ # Lending Commands Reference
2
+
3
+ Lending and borrowing on Kamino Finance.
4
+
5
+ ## Check Rates
6
+
7
+ ```bash
8
+ sol lend rates <token>
9
+ ```
10
+
11
+ Shows current deposit APY and borrow APY for a token on Kamino.
12
+
13
+ ### Examples
14
+
15
+ ```bash
16
+ sol lend rates usdc
17
+ sol lend rates sol
18
+ ```
19
+
20
+ ### JSON Output
21
+
22
+ ```json
23
+ {
24
+ "ok": true,
25
+ "data": {
26
+ "token": "USDC",
27
+ "deposit_apy": "8.5%",
28
+ "borrow_apy": "12.3%",
29
+ "total_deposits": 150000000,
30
+ "total_borrows": 95000000,
31
+ "utilization": "63.3%"
32
+ },
33
+ "meta": { "elapsed_ms": 800 }
34
+ }
35
+ ```
36
+
37
+ ## Deposit
38
+
39
+ ```bash
40
+ sol lend deposit <amount> <token>
41
+ ```
42
+
43
+ Deposits tokens into a Kamino vault to earn yield.
44
+
45
+ ### Examples
46
+
47
+ ```bash
48
+ sol lend deposit 100 usdc
49
+ sol lend deposit 5 sol
50
+ sol lend deposit 100 usdc --wallet trading
51
+ ```
52
+
53
+ ### Flags
54
+
55
+ | Flag | Default | Description |
56
+ |------|---------|-------------|
57
+ | `--wallet <name>` | default | Wallet to deposit from |
58
+
59
+ ## Withdraw
60
+
61
+ ```bash
62
+ sol lend withdraw <amount|max> <token>
63
+ ```
64
+
65
+ Withdraws tokens from Kamino.
66
+
67
+ ### Examples
68
+
69
+ ```bash
70
+ sol lend withdraw 50 usdc # partial withdrawal
71
+ sol lend withdraw max sol # withdraw everything
72
+ sol lend withdraw max usdc --wallet defi
73
+ ```
74
+
75
+ Use `max` to withdraw the entire deposited amount.
76
+
77
+ ### Flags
78
+
79
+ | Flag | Default | Description |
80
+ |------|---------|-------------|
81
+ | `--wallet <name>` | default | Wallet that owns the deposit |
82
+
83
+ ## Borrow
84
+
85
+ ```bash
86
+ sol lend borrow <amount> <token> --collateral <token>
87
+ ```
88
+
89
+ Borrows tokens against deposited collateral.
90
+
91
+ ### Examples
92
+
93
+ ```bash
94
+ sol lend borrow 500 usdc --collateral sol
95
+ sol lend borrow 1 sol --collateral usdc
96
+ ```
97
+
98
+ You must have sufficient collateral deposited first. The CLI will
99
+ warn if the resulting health factor would be dangerously low.
100
+
101
+ ### Flags
102
+
103
+ | Flag | Description |
104
+ |------|-------------|
105
+ | `--collateral <token>` | Required. Token to use as collateral |
106
+ | `--wallet <name>` | Wallet that owns the collateral |
107
+
108
+ ## Repay
109
+
110
+ ```bash
111
+ sol lend repay <amount|max> <token>
112
+ ```
113
+
114
+ Repays borrowed tokens.
115
+
116
+ ### Examples
117
+
118
+ ```bash
119
+ sol lend repay 250 usdc # partial repay
120
+ sol lend repay max usdc # repay full outstanding debt
121
+ ```
122
+
123
+ Use `max` to repay the entire borrowed amount.
124
+
125
+ ## View Positions
126
+
127
+ ```bash
128
+ sol lend positions
129
+ sol lend positions --wallet trading
130
+ ```
131
+
132
+ Lists all deposits and borrows — token, amount, APY, USD value,
133
+ and health factor.
134
+
135
+ The CLI warns when health factor drops below 1.1.
136
+
137
+ ### JSON Output
138
+
139
+ ```json
140
+ {
141
+ "ok": true,
142
+ "data": {
143
+ "deposits": [
144
+ {
145
+ "token": "USDC",
146
+ "amount": 100,
147
+ "value_usd": 100,
148
+ "apy": "8.5%"
149
+ }
150
+ ],
151
+ "borrows": [
152
+ {
153
+ "token": "USDC",
154
+ "amount": 50,
155
+ "value_usd": 50,
156
+ "apy": "12.3%"
157
+ }
158
+ ],
159
+ "health_factor": 2.1,
160
+ "net_value_usd": 50
161
+ },
162
+ "meta": { "elapsed_ms": 1000 }
163
+ }
164
+ ```
165
+
166
+ ## Health Factor
167
+
168
+ Health factor = total collateral value / total borrow value (weighted
169
+ by liquidation thresholds). Below 1.0 means liquidation risk.
170
+
171
+ - **> 2.0**: Safe
172
+ - **1.1 – 2.0**: Monitor closely
173
+ - **< 1.1**: CLI warns — consider repaying or adding collateral
174
+ - **< 1.0**: Liquidation possible
@@ -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.