@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.
- package/.claude-plugin/marketplace.json +21 -0
- package/.claude-plugin/plugin.json +8 -0
- package/README.md +40 -77
- package/dist/commands/network.js +23 -2
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/wallet.js +10 -4
- package/dist/commands/wallet.js.map +1 -1
- package/package.json +4 -2
- package/skills/solana-payments-wallets-trading/SKILL.md +204 -0
- package/skills/solana-payments-wallets-trading/references/json-output-format.md +132 -0
- package/skills/solana-payments-wallets-trading/references/lending-commands.md +174 -0
- package/skills/solana-payments-wallets-trading/references/portfolio-commands.md +128 -0
- package/skills/solana-payments-wallets-trading/references/staking-commands.md +150 -0
- package/skills/solana-payments-wallets-trading/references/trading-commands.md +207 -0
- package/skills/solana-payments-wallets-trading/references/troubleshooting.md +158 -0
- package/skills/solana-payments-wallets-trading/references/wallet-commands.md +152 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# JSON Output Format Reference
|
|
2
|
+
|
|
3
|
+
Every Sol CLI command supports `--json` for structured output.
|
|
4
|
+
|
|
5
|
+
## Response Envelope
|
|
6
|
+
|
|
7
|
+
All responses use the `CommandResult<T>` envelope:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"ok": true,
|
|
12
|
+
"data": { ... },
|
|
13
|
+
"meta": {
|
|
14
|
+
"elapsed_ms": 450
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Fields
|
|
20
|
+
|
|
21
|
+
| Field | Type | Description |
|
|
22
|
+
|-------|------|-------------|
|
|
23
|
+
| `ok` | `boolean` | `true` on success, `false` on failure |
|
|
24
|
+
| `data` | `T` | Command-specific response data (present on success) |
|
|
25
|
+
| `error` | `string` | Error code in `UPPER_SNAKE_CASE` (present on failure) |
|
|
26
|
+
| `message` | `string` | Human-readable error description (present on failure) |
|
|
27
|
+
| `meta` | `object` | Metadata — always includes `elapsed_ms` |
|
|
28
|
+
|
|
29
|
+
## Success Response
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"ok": true,
|
|
34
|
+
"data": {
|
|
35
|
+
"signature": "4xK9...abc",
|
|
36
|
+
"from_token": "USDC",
|
|
37
|
+
"to_token": "BONK",
|
|
38
|
+
"from_amount": 50,
|
|
39
|
+
"to_amount": 2500000
|
|
40
|
+
},
|
|
41
|
+
"meta": { "elapsed_ms": 2100 }
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Always check `ok === true` before reading `data`.
|
|
46
|
+
|
|
47
|
+
## Error Response
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"ok": false,
|
|
52
|
+
"error": "SWAP_FAILED",
|
|
53
|
+
"message": "Insufficient balance: need 50 USDC, have 12.5 USDC",
|
|
54
|
+
"meta": { "elapsed_ms": 150 }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Error Code Convention
|
|
59
|
+
|
|
60
|
+
Error codes follow `NOUN_VERB_FAILED` format in `UPPER_SNAKE_CASE`:
|
|
61
|
+
|
|
62
|
+
| Code | When |
|
|
63
|
+
|------|------|
|
|
64
|
+
| `WALLET_CREATE_FAILED` | Wallet creation fails |
|
|
65
|
+
| `BALANCE_FAILED` | Balance lookup fails |
|
|
66
|
+
| `SWAP_FAILED` | Token swap fails |
|
|
67
|
+
| `SEND_FAILED` | Token send fails |
|
|
68
|
+
| `STAKE_NEW_FAILED` | Stake creation fails |
|
|
69
|
+
| `STAKE_WITHDRAW_FAILED` | Stake withdrawal fails |
|
|
70
|
+
| `LEND_DEPOSIT_FAILED` | Lending deposit fails |
|
|
71
|
+
| `LEND_WITHDRAW_FAILED` | Lending withdrawal fails |
|
|
72
|
+
| `LEND_BORROW_FAILED` | Borrowing fails |
|
|
73
|
+
| `LEND_REPAY_FAILED` | Loan repayment fails |
|
|
74
|
+
| `PORTFOLIO_FETCH_FAILED` | Portfolio fetch fails |
|
|
75
|
+
| `CONFIG_SET_FAILED` | Config update fails |
|
|
76
|
+
| `NETWORK_FAILED` | Network info fetch fails |
|
|
77
|
+
| `TOKEN_LIST_FAILED` | Token list fetch fails |
|
|
78
|
+
|
|
79
|
+
## Exit Codes
|
|
80
|
+
|
|
81
|
+
- `0` — Success
|
|
82
|
+
- `1` — Command failed (error details in JSON response)
|
|
83
|
+
|
|
84
|
+
## JSON Mode Behavior
|
|
85
|
+
|
|
86
|
+
When `--json` is active:
|
|
87
|
+
|
|
88
|
+
- Confirmation prompts are skipped automatically (equivalent to `--yes`)
|
|
89
|
+
- Human-readable output is suppressed
|
|
90
|
+
- Only the JSON envelope is printed to stdout
|
|
91
|
+
- Debug/verbose output goes to stderr (if `--verbose` is also set)
|
|
92
|
+
|
|
93
|
+
## Global Flags
|
|
94
|
+
|
|
95
|
+
These flags work with any command:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
sol <command> --json # structured output
|
|
99
|
+
sol <command> --rpc https://my-rpc.com # override RPC
|
|
100
|
+
sol <command> --verbose # debug logging
|
|
101
|
+
sol <command> --wallet trading # override wallet
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Usage in Scripts
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Check if a swap succeeded
|
|
108
|
+
result=$(sol token swap 50 usdc bonk --json)
|
|
109
|
+
if echo "$result" | jq -e '.ok' > /dev/null; then
|
|
110
|
+
sig=$(echo "$result" | jq -r '.data.signature')
|
|
111
|
+
echo "Swap succeeded: $sig"
|
|
112
|
+
else
|
|
113
|
+
error=$(echo "$result" | jq -r '.error')
|
|
114
|
+
echo "Swap failed: $error"
|
|
115
|
+
fi
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Usage in Agent Code
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
import { execSync } from 'node:child_process';
|
|
122
|
+
|
|
123
|
+
const result = JSON.parse(
|
|
124
|
+
execSync('sol token swap 50 usdc bonk --json').toString()
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (result.ok) {
|
|
128
|
+
console.log(`Swapped — tx: ${result.data.signature}`);
|
|
129
|
+
} else {
|
|
130
|
+
console.error(`Failed: ${result.error} — ${result.message}`);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
@@ -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).
|