starkfi 0.1.0 → 0.2.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/MCP.md +70 -0
- package/README.md +120 -58
- package/dist/commands/auth/login.js +2 -2
- package/dist/commands/auth/login.js.map +1 -1
- package/dist/commands/auth/verify.d.ts.map +1 -1
- package/dist/commands/auth/verify.js +2 -2
- package/dist/commands/auth/verify.js.map +1 -1
- package/dist/commands/batch/batch.d.ts +3 -0
- package/dist/commands/batch/batch.d.ts.map +1 -0
- package/dist/commands/batch/batch.js +143 -0
- package/dist/commands/batch/batch.js.map +1 -0
- package/dist/commands/chain/tx-status.js +2 -2
- package/dist/commands/chain/tx-status.js.map +1 -1
- package/dist/commands/config/config.d.ts.map +1 -1
- package/dist/commands/config/config.js +14 -31
- package/dist/commands/config/config.js.map +1 -1
- package/dist/commands/lending/lending.d.ts +1 -0
- package/dist/commands/lending/lending.d.ts.map +1 -1
- package/dist/commands/lending/lending.js +187 -48
- package/dist/commands/lending/lending.js.map +1 -1
- package/dist/commands/portfolio/portfolio.d.ts +3 -0
- package/dist/commands/portfolio/portfolio.d.ts.map +1 -0
- package/dist/commands/portfolio/portfolio.js +76 -0
- package/dist/commands/portfolio/portfolio.js.map +1 -0
- package/dist/commands/staking/staking.d.ts +1 -1
- package/dist/commands/staking/staking.d.ts.map +1 -1
- package/dist/commands/staking/staking.js +142 -61
- package/dist/commands/staking/staking.js.map +1 -1
- package/dist/commands/trade/multi-swap.d.ts +3 -0
- package/dist/commands/trade/multi-swap.d.ts.map +1 -0
- package/dist/commands/trade/multi-swap.js +140 -0
- package/dist/commands/trade/multi-swap.js.map +1 -0
- package/dist/commands/trade/status.js +2 -2
- package/dist/commands/trade/status.js.map +1 -1
- package/dist/commands/trade/swap.d.ts.map +1 -1
- package/dist/commands/trade/swap.js +45 -10
- package/dist/commands/trade/swap.js.map +1 -1
- package/dist/commands/wallet/balance.d.ts.map +1 -1
- package/dist/commands/wallet/balance.js +19 -2
- package/dist/commands/wallet/balance.js.map +1 -1
- package/dist/commands/wallet/deploy.d.ts.map +1 -1
- package/dist/commands/wallet/deploy.js +2 -1
- package/dist/commands/wallet/deploy.js.map +1 -1
- package/dist/commands/wallet/send.d.ts.map +1 -1
- package/dist/commands/wallet/send.js +45 -8
- package/dist/commands/wallet/send.js.map +1 -1
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/banner.d.ts +6 -0
- package/dist/lib/banner.d.ts.map +1 -0
- package/dist/lib/banner.js +78 -0
- package/dist/lib/banner.js.map +1 -0
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +0 -20
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/errors.d.ts +2 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +2 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/format.d.ts +43 -2
- package/dist/lib/format.d.ts.map +1 -1
- package/dist/lib/format.js +51 -5
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/retry.d.ts +15 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/lib/retry.js +29 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/validation.d.ts +0 -12
- package/dist/lib/validation.d.ts.map +1 -1
- package/dist/lib/validation.js +1 -23
- package/dist/lib/validation.js.map +1 -1
- package/dist/mcp/handlers/batch.d.ts +13 -0
- package/dist/mcp/handlers/batch.d.ts.map +1 -0
- package/dist/mcp/handlers/batch.js +33 -0
- package/dist/mcp/handlers/batch.js.map +1 -0
- package/dist/mcp/handlers/config.d.ts +1 -1
- package/dist/mcp/handlers/config.d.ts.map +1 -1
- package/dist/mcp/handlers/config.js +11 -12
- package/dist/mcp/handlers/config.js.map +1 -1
- package/dist/mcp/handlers/index.d.ts +3 -0
- package/dist/mcp/handlers/index.d.ts.map +1 -1
- package/dist/mcp/handlers/index.js +3 -0
- package/dist/mcp/handlers/index.js.map +1 -1
- package/dist/mcp/handlers/lending.d.ts +12 -1
- package/dist/mcp/handlers/lending.d.ts.map +1 -1
- package/dist/mcp/handlers/lending.js +67 -23
- package/dist/mcp/handlers/lending.js.map +1 -1
- package/dist/mcp/handlers/multi-swap.d.ts +27 -0
- package/dist/mcp/handlers/multi-swap.d.ts.map +1 -0
- package/dist/mcp/handlers/multi-swap.js +73 -0
- package/dist/mcp/handlers/multi-swap.js.map +1 -0
- package/dist/mcp/handlers/portfolio.d.ts +7 -0
- package/dist/mcp/handlers/portfolio.d.ts.map +1 -0
- package/dist/mcp/handlers/portfolio.js +11 -0
- package/dist/mcp/handlers/portfolio.js.map +1 -0
- package/dist/mcp/handlers/staking.d.ts +13 -1
- package/dist/mcp/handlers/staking.d.ts.map +1 -1
- package/dist/mcp/handlers/staking.js +18 -5
- package/dist/mcp/handlers/staking.js.map +1 -1
- package/dist/mcp/handlers/trade.d.ts +1 -0
- package/dist/mcp/handlers/trade.d.ts.map +1 -1
- package/dist/mcp/handlers/trade.js +23 -9
- package/dist/mcp/handlers/trade.js.map +1 -1
- package/dist/mcp/handlers/wallet.d.ts +1 -0
- package/dist/mcp/handlers/wallet.d.ts.map +1 -1
- package/dist/mcp/handlers/wallet.js +16 -1
- package/dist/mcp/handlers/wallet.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +102 -33
- package/dist/mcp/tools.js.map +1 -1
- package/dist/services/api/client.d.ts +0 -12
- package/dist/services/api/client.d.ts.map +1 -1
- package/dist/services/api/client.js +3 -8
- package/dist/services/api/client.js.map +1 -1
- package/dist/services/auth/session.d.ts +1 -7
- package/dist/services/auth/session.d.ts.map +1 -1
- package/dist/services/auth/session.js +20 -0
- package/dist/services/auth/session.js.map +1 -1
- package/dist/services/batch/batch.d.ts +36 -0
- package/dist/services/batch/batch.d.ts.map +1 -0
- package/dist/services/batch/batch.js +111 -0
- package/dist/services/batch/batch.js.map +1 -0
- package/dist/services/config/config.d.ts +4 -0
- package/dist/services/config/config.d.ts.map +1 -1
- package/dist/services/config/config.js +31 -1
- package/dist/services/config/config.js.map +1 -1
- package/dist/services/fibrous/config.d.ts +4 -0
- package/dist/services/fibrous/config.d.ts.map +1 -0
- package/dist/services/fibrous/config.js +4 -0
- package/dist/services/fibrous/config.js.map +1 -0
- package/dist/services/fibrous/health.js +1 -1
- package/dist/services/fibrous/health.js.map +1 -1
- package/dist/services/fibrous/route.d.ts +19 -6
- package/dist/services/fibrous/route.d.ts.map +1 -1
- package/dist/services/fibrous/route.js +64 -3
- package/dist/services/fibrous/route.js.map +1 -1
- package/dist/services/portfolio/portfolio.d.ts +35 -0
- package/dist/services/portfolio/portfolio.d.ts.map +1 -0
- package/dist/services/portfolio/portfolio.js +106 -0
- package/dist/services/portfolio/portfolio.js.map +1 -0
- package/dist/services/simulate/simulate.d.ts +18 -0
- package/dist/services/simulate/simulate.d.ts.map +1 -0
- package/dist/services/simulate/simulate.js +61 -0
- package/dist/services/simulate/simulate.js.map +1 -0
- package/dist/services/staking/staking.d.ts +5 -13
- package/dist/services/staking/staking.d.ts.map +1 -1
- package/dist/services/staking/staking.js +44 -52
- package/dist/services/staking/staking.js.map +1 -1
- package/dist/services/starkzap/client.d.ts.map +1 -1
- package/dist/services/starkzap/client.js +38 -18
- package/dist/services/starkzap/client.js.map +1 -1
- package/dist/services/starkzap/config.d.ts +6 -0
- package/dist/services/starkzap/config.d.ts.map +1 -0
- package/dist/services/starkzap/config.js +13 -0
- package/dist/services/starkzap/config.js.map +1 -0
- package/dist/services/tokens/balances.d.ts.map +1 -1
- package/dist/services/tokens/balances.js +26 -14
- package/dist/services/tokens/balances.js.map +1 -1
- package/dist/services/tokens/tokens.d.ts +2 -3
- package/dist/services/tokens/tokens.d.ts.map +1 -1
- package/dist/services/tokens/tokens.js +3 -8
- package/dist/services/tokens/tokens.js.map +1 -1
- package/dist/services/vesu/api.d.ts +28 -0
- package/dist/services/vesu/api.d.ts.map +1 -0
- package/dist/services/vesu/api.js +97 -0
- package/dist/services/vesu/api.js.map +1 -0
- package/dist/services/vesu/config.d.ts +9 -0
- package/dist/services/vesu/config.d.ts.map +1 -0
- package/dist/services/vesu/config.js +32 -0
- package/dist/services/vesu/config.js.map +1 -0
- package/dist/services/vesu/index.d.ts +2 -0
- package/dist/services/vesu/index.d.ts.map +1 -1
- package/dist/services/vesu/index.js +2 -0
- package/dist/services/vesu/index.js.map +1 -1
- package/dist/services/vesu/lending.d.ts +8 -1
- package/dist/services/vesu/lending.d.ts.map +1 -1
- package/dist/services/vesu/lending.js +171 -52
- package/dist/services/vesu/lending.js.map +1 -1
- package/dist/services/vesu/pools.d.ts +5 -11
- package/dist/services/vesu/pools.d.ts.map +1 -1
- package/dist/services/vesu/pools.js +11 -31
- package/dist/services/vesu/pools.js.map +1 -1
- package/package.json +88 -82
- package/skills/README.md +63 -0
- package/skills/authenticate-wallet/SKILL.md +119 -0
- package/skills/balance/SKILL.md +80 -0
- package/skills/batch/SKILL.md +118 -0
- package/skills/config/SKILL.md +144 -0
- package/skills/lending/SKILL.md +209 -0
- package/skills/multi-swap/SKILL.md +95 -0
- package/skills/portfolio/SKILL.md +82 -0
- package/skills/send/SKILL.md +82 -0
- package/skills/staking/SKILL.md +188 -0
- package/skills/trade/SKILL.md +92 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: staking
|
|
3
|
+
description: Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, rewards, compounding, unstaking, or wants to earn yield on their STRK or BTC tokens.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Node.js 18+ and npx.
|
|
6
|
+
metadata:
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
author: ahmetenesdur
|
|
9
|
+
category: transaction
|
|
10
|
+
allowed-tools:
|
|
11
|
+
- Bash(npx starkfi@latest validators)
|
|
12
|
+
- Bash(npx starkfi@latest validators *)
|
|
13
|
+
- Bash(npx starkfi@latest pools *)
|
|
14
|
+
- Bash(npx starkfi@latest stake-status)
|
|
15
|
+
- Bash(npx starkfi@latest stake-status *)
|
|
16
|
+
- Bash(npx starkfi@latest stake *)
|
|
17
|
+
- Bash(npx starkfi@latest unstake *)
|
|
18
|
+
- Bash(npx starkfi@latest rewards *)
|
|
19
|
+
- Bash(npx starkfi@latest status)
|
|
20
|
+
- Bash(npx starkfi@latest balance)
|
|
21
|
+
- Bash(npx starkfi@latest balance *)
|
|
22
|
+
- Bash(npx starkfi@latest tx-status *)
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Staking
|
|
26
|
+
|
|
27
|
+
Manage Starknet staking operations: delegate tokens to validators, claim or compound rewards, and unstake positions. Supports multiple token types across various validators and pools.
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
- Active session required.
|
|
32
|
+
- Sufficient token balance for staking + gas fees.
|
|
33
|
+
|
|
34
|
+
## Supported Tokens
|
|
35
|
+
|
|
36
|
+
| Token | Type |
|
|
37
|
+
| ------- | ------- |
|
|
38
|
+
| STRK | Native |
|
|
39
|
+
| WBTC | Bitcoin |
|
|
40
|
+
| tBTC | Bitcoin |
|
|
41
|
+
| SolvBTC | Bitcoin |
|
|
42
|
+
| LBTC | Bitcoin |
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
1. BEFORE staking, you MUST run `npx starkfi@latest validators` to list available validators, then `npx starkfi@latest pools <validator>` to see available pools.
|
|
47
|
+
2. BEFORE staking, check `balance` to confirm the user has enough tokens.
|
|
48
|
+
3. Unstaking is a **two-step process**: first `unstake intent` starts a cooldown, then `unstake exit` finalizes after the cooldown period. The user must wait between these steps.
|
|
49
|
+
4. `rewards --compound` atomically claims and restakes in one transaction.
|
|
50
|
+
5. AFTER any transactional operation (stake, unstake, rewards), verify with `tx-status`.
|
|
51
|
+
6. Use `stake-status` to view the user's current staking positions across all validators.
|
|
52
|
+
7. Token defaults to `STRK` if `--token` is not specified.
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Discovery
|
|
58
|
+
npx starkfi@latest validators [--json]
|
|
59
|
+
npx starkfi@latest pools <validator> [--json]
|
|
60
|
+
npx starkfi@latest stake-status [validator] [--json]
|
|
61
|
+
|
|
62
|
+
# Stake tokens
|
|
63
|
+
npx starkfi@latest stake <amount> --validator <name> [--token <symbol>] [--simulate]
|
|
64
|
+
|
|
65
|
+
# Unstake (two-step)
|
|
66
|
+
npx starkfi@latest unstake intent --validator <name> --amount <amount> [--token <symbol>]
|
|
67
|
+
npx starkfi@latest unstake exit --validator <name> [--token <symbol>]
|
|
68
|
+
|
|
69
|
+
# Rewards
|
|
70
|
+
npx starkfi@latest rewards --claim --validator <name> [--token <symbol>]
|
|
71
|
+
npx starkfi@latest rewards --compound --validator <name> [--token <symbol>]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Parameters
|
|
75
|
+
|
|
76
|
+
### stake
|
|
77
|
+
|
|
78
|
+
| Parameter | Type | Description | Required |
|
|
79
|
+
| ------------- | ------ | ------------------------------------------------ | -------- |
|
|
80
|
+
| `amount` | number | Amount to stake (positional) | Yes |
|
|
81
|
+
| `--validator` | string | Validator name (from `validators` list) | Yes\* |
|
|
82
|
+
| `--pool` | string | Pool contract address (alternative to validator) | Yes\* |
|
|
83
|
+
| `--token` | string | Token symbol (default: `STRK`) | No |
|
|
84
|
+
| `--simulate` | flag | Estimate fees without broadcasting | No |
|
|
85
|
+
|
|
86
|
+
\*Provide either `--validator` or `--pool`.
|
|
87
|
+
|
|
88
|
+
### unstake
|
|
89
|
+
|
|
90
|
+
| Parameter | Type | Description | Required |
|
|
91
|
+
| ------------- | ------ | ----------------------------------------- | ---------- |
|
|
92
|
+
| action | string | `intent` or `exit` (positional) | Yes |
|
|
93
|
+
| `--validator` | string | Validator name | Yes\* |
|
|
94
|
+
| `--pool` | string | Pool contract address | Yes\* |
|
|
95
|
+
| `--amount` | number | Amount to unstake (required for `intent`) | For intent |
|
|
96
|
+
| `--token` | string | Token symbol (default: `STRK`) | No |
|
|
97
|
+
|
|
98
|
+
### rewards
|
|
99
|
+
|
|
100
|
+
| Parameter | Type | Description | Required |
|
|
101
|
+
| ------------- | ------ | ------------------------------ | -------- |
|
|
102
|
+
| `--claim` | flag | Claim pending rewards | Yes\* |
|
|
103
|
+
| `--compound` | flag | Claim and immediately restake | Yes\* |
|
|
104
|
+
| `--validator` | string | Validator name | Yes\*\* |
|
|
105
|
+
| `--pool` | string | Pool contract address | Yes\*\* |
|
|
106
|
+
| `--token` | string | Token symbol (default: `STRK`) | No |
|
|
107
|
+
|
|
108
|
+
\*Provide either `--claim` or `--compound`. \*\*Provide either `--validator` or `--pool`.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
**User:** "Which validators can I stake with?"
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npx starkfi@latest validators
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**User:** "Show me pools for Juno"
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx starkfi@latest pools Juno
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**User:** "Stake 1000 STRK with Juno"
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx starkfi@latest status
|
|
128
|
+
npx starkfi@latest balance --token STRK
|
|
129
|
+
npx starkfi@latest stake 1000 --validator Juno
|
|
130
|
+
npx starkfi@latest tx-status <hash>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**User:** "Stake 0.5 WBTC with Karnot"
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npx starkfi@latest balance --token WBTC
|
|
137
|
+
npx starkfi@latest stake 0.5 --validator Karnot --token WBTC
|
|
138
|
+
npx starkfi@latest tx-status <hash>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**User:** "Compound my STRK rewards from Juno"
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npx starkfi@latest rewards --compound --validator Juno
|
|
145
|
+
npx starkfi@latest tx-status <hash>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**User:** "Claim my rewards from Karnot"
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npx starkfi@latest rewards --claim --validator Karnot
|
|
152
|
+
npx starkfi@latest tx-status <hash>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**User:** "I want to unstake my STRK from Juno"
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Step 1: Start unstake cooldown
|
|
159
|
+
npx starkfi@latest unstake intent --validator Juno --amount 1000
|
|
160
|
+
npx starkfi@latest tx-status <hash>
|
|
161
|
+
# Inform user about cooldown period
|
|
162
|
+
# Step 2: After cooldown, finalize
|
|
163
|
+
npx starkfi@latest unstake exit --validator Juno
|
|
164
|
+
npx starkfi@latest tx-status <hash>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**User:** "Show me all my staking positions"
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx starkfi@latest stake-status
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Error Handling
|
|
174
|
+
|
|
175
|
+
| Error | Action |
|
|
176
|
+
| ----------------------- | ------------------------------------------------ |
|
|
177
|
+
| `Validator not found` | Run `validators` to list valid names. |
|
|
178
|
+
| `Pool not found` | Run `pools <validator>` to list available pools. |
|
|
179
|
+
| `Insufficient balance` | Check `balance` and suggest a smaller amount. |
|
|
180
|
+
| `Cooldown not complete` | User must wait before running `unstake exit`. |
|
|
181
|
+
| `No rewards to claim` | Position has no pending rewards. |
|
|
182
|
+
| `Not authenticated` | Run `authenticate-wallet` skill first. |
|
|
183
|
+
|
|
184
|
+
## Related Skills
|
|
185
|
+
|
|
186
|
+
- Use `balance` to check available tokens before staking.
|
|
187
|
+
- Use `portfolio` for a full overview including staking positions with USD values.
|
|
188
|
+
- Use `batch` to combine staking with other operations in one transaction.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: trade
|
|
3
|
+
description: Swap tokens on Starknet using Fibrous aggregation for optimal routing. Supports simulation (dry-run) before execution. Use this skill when the user wants to swap, exchange, trade, convert, or buy one token with another on Starknet.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Node.js 18+ and npx.
|
|
6
|
+
metadata:
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
author: ahmetenesdur
|
|
9
|
+
category: transaction
|
|
10
|
+
allowed-tools:
|
|
11
|
+
- Bash(npx starkfi@latest trade *)
|
|
12
|
+
- Bash(npx starkfi@latest status)
|
|
13
|
+
- Bash(npx starkfi@latest balance)
|
|
14
|
+
- Bash(npx starkfi@latest balance *)
|
|
15
|
+
- Bash(npx starkfi@latest tx-status *)
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Trade / Swap Tokens
|
|
19
|
+
|
|
20
|
+
Exchange one token for another on Starknet via Fibrous trade aggregation. The CLI finds the best route across multiple DEXs, simulates the swap, and executes. All transactions are routed through the Paymaster by default (gas paid in STRK or configured token).
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
- Active session required.
|
|
25
|
+
- Sufficient balance of the source token + gas fees.
|
|
26
|
+
|
|
27
|
+
## Rules
|
|
28
|
+
|
|
29
|
+
1. BEFORE any trade, you MUST run `npx starkfi@latest status` and `npx starkfi@latest balance` to verify connectivity and source token balance.
|
|
30
|
+
2. Default slippage is **1%**. To change, use `--slippage <percent>`.
|
|
31
|
+
3. Suggest using `--simulate` first for large trades so the user can review the estimated fee and expected output before committing.
|
|
32
|
+
4. AFTER a successful trade, you MUST verify the transaction using `npx starkfi@latest tx-status <hash>`.
|
|
33
|
+
5. For **multiple swaps in one transaction**, use the `multi-swap` skill instead.
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx starkfi@latest trade <amount> <from> <to> [--slippage <percent>] [--simulate] [--json]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Parameters
|
|
42
|
+
|
|
43
|
+
| Parameter | Type | Description | Required |
|
|
44
|
+
| ------------ | ------ | ---------------------------------------- | -------- |
|
|
45
|
+
| `amount` | number | Amount of source token to swap | Yes |
|
|
46
|
+
| `from` | string | Source token symbol (e.g. `ETH`, `USDC`) | Yes |
|
|
47
|
+
| `to` | string | Target token symbol (e.g. `STRK`, `DAI`) | Yes |
|
|
48
|
+
| `--slippage` | number | Slippage tolerance in % (default: `1`) | No |
|
|
49
|
+
| `--simulate` | flag | Estimate fees without broadcasting | No |
|
|
50
|
+
| `--json` | flag | Output as JSON | No |
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
**User:** "Swap 100 USDC for ETH"
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx starkfi@latest status
|
|
58
|
+
npx starkfi@latest balance --token USDC
|
|
59
|
+
npx starkfi@latest trade 100 USDC ETH
|
|
60
|
+
npx starkfi@latest tx-status <hash>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**User:** "How much ETH would I get for 500 USDC?"
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx starkfi@latest trade 500 USDC ETH --simulate
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**User:** "Convert 0.5 ETH to STRK with 2% slippage"
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx starkfi@latest status
|
|
73
|
+
npx starkfi@latest balance --token ETH
|
|
74
|
+
npx starkfi@latest trade 0.5 ETH STRK --slippage 2
|
|
75
|
+
npx starkfi@latest tx-status <hash>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Error Handling
|
|
79
|
+
|
|
80
|
+
| Error | Action |
|
|
81
|
+
| ---------------------- | ------------------------------------------------------- |
|
|
82
|
+
| `No route found` | Liquidity may be too low or pair doesn't exist. |
|
|
83
|
+
| `Insufficient balance` | Check `balance` and suggest a smaller amount. |
|
|
84
|
+
| `Simulation failed` | Route is invalid or would revert. Do not retry blindly. |
|
|
85
|
+
| `Not authenticated` | Run `authenticate-wallet` skill first. |
|
|
86
|
+
|
|
87
|
+
## Related Skills
|
|
88
|
+
|
|
89
|
+
- Use `balance` to check available tokens before trading.
|
|
90
|
+
- Use `multi-swap` for executing 2-3 swaps in a single transaction.
|
|
91
|
+
- Use `batch` for combining a swap with other operations (stake, supply, send).
|
|
92
|
+
- Use `config` to set a custom RPC if experiencing rate limits.
|