starkfi 0.4.3 β†’ 0.5.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 CHANGED
@@ -21,7 +21,7 @@ To integrate StarkFi into your AI environment, configure your MCP client setting
21
21
 
22
22
  ## Tool Registry
23
23
 
24
- Upon initialization, the StarkFi server dynamically provisions **27 tool schemas** to the connected AI client. Tools are organized into domain-specific registration modules (`src/mcp/tools/`): **auth** (2), **wallet** (5), **trade** (5), **staking** (8), and **lending** (7).
24
+ Upon initialization, the StarkFi server dynamically provisions **30 tool schemas** to the connected AI client. Tools are organized into domain-specific registration modules (`src/mcp/tools/`): **auth** (2), **wallet** (6), **trade** (5), **staking** (8), and **lending** (9).
25
25
 
26
26
  ---
27
27
 
@@ -268,6 +268,40 @@ Atomically closes an active Vesu V2 lending position. Repays all outstanding deb
268
268
  | `collateral_token` | string | **Yes** | Collateral token symbol of the position (e.g. `STRK`, `ETH`) |
269
269
  | `debt_token` | string | **Yes** | Borrowed token symbol of the position (e.g. `USDC`, `USDT`) |
270
270
 
271
+ #### `monitor_lending_position`
272
+
273
+ Monitors health factors across lending positions. Returns alerts and actionable recommendations when health factor drops below configurable thresholds.
274
+
275
+ | Parameter | Type | Required | Description |
276
+ | ------------------- | ------ | -------- | -------------------------------------------------------------------------------- |
277
+ | `pool` | string | No | Pool name or address. Omit to scan all pools for active borrow positions. |
278
+ | `collateral_token` | string | No | Collateral token symbol. Required when specifying a pool. |
279
+ | `borrow_token` | string | No | Debt token symbol. Required when specifying a pool. |
280
+ | `warning_threshold` | number | No | Custom warning threshold (default: `1.3`). |
281
+
282
+ #### `auto_rebalance_lending`
283
+
284
+ Automatically adjusts a lending position to restore health factor via debt repayment or additional collateral. Supports simulation mode.
285
+
286
+ | Parameter | Type | Required | Description |
287
+ | ---------------------- | ------- | -------- | ------------------------------------------------------------------------ |
288
+ | `pool` | string | **Yes** | Pool name or address |
289
+ | `collateral_token` | string | **Yes** | Collateral token symbol |
290
+ | `borrow_token` | string | **Yes** | Debt token symbol |
291
+ | `strategy` | enum | No | `repay`, `add-collateral`, or `auto` (default: `auto`) |
292
+ | `target_health_factor` | number | No | Target health factor (default: `1.3`) |
293
+ | `simulate` | boolean | No | Set `true` to preview adjustment without executing |
294
+
295
+ #### `rebalance_portfolio`
296
+
297
+ Rebalances a portfolio to match a target allocation. Calculates optimal swaps and executes as a single batch transaction via Fibrous routing.
298
+
299
+ | Parameter | Type | Required | Description |
300
+ | ----------- | ------- | -------- | ----------------------------------------------------------------- |
301
+ | `target` | string | **Yes** | Target allocation, e.g. `"50 ETH, 30 USDC, 20 STRK"` |
302
+ | `slippage` | number | No | Slippage tolerance % (default: `1`) |
303
+ | `simulate` | boolean | No | Set `true` to preview plan without executing |
304
+
271
305
  ---
272
306
 
273
307
  ### Configuration Utilities
@@ -279,7 +313,7 @@ Views and modifies global CLI behavior: RPC routing, network selection, and Gas
279
313
  | Parameter | Type | Required | Description |
280
314
  | --------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
281
315
  | `action` | enum | **Yes** | One of: `list`, `reset`, `set-rpc`, `get-rpc`, `set-network`, `set-gasfree`, `set-gas-token` |
282
- | `value` | string | No | `set-gasfree`: `on`/`off`. `set-gas-token`: symbol (`USDC`, `ETH`) or `reset`. `set-rpc`: URL string. `set-network`: `mainnet`/`sepolia`. |
316
+ | `value` | string | No | `set-gasfree`: `on`/`off`. `set-gas-token`: symbol (`USDC`, `ETH`) or `reset`/`off`. `set-rpc`: URL string. `set-network`: `mainnet`/`sepolia`. |
283
317
 
284
318
  ---
285
319
 
package/README.md CHANGED
@@ -23,7 +23,7 @@ npx starkfi@latest --help
23
23
 
24
24
  Most DeFi tools are built for humans clicking buttons. StarkFi is built for **agents**.
25
25
 
26
- - πŸ€– **27 MCP tools** β€” Any AI assistant (Cursor, Claude, Antigravity) can execute DeFi operations autonomously
26
+ - πŸ€– **30 MCP tools** β€” Any AI assistant (Cursor, Claude, Antigravity) can execute DeFi operations autonomously
27
27
  - ⚑ **Atomic Batching** β€” Combine swap + stake + lend + send into a single multicall transaction
28
28
  - πŸ’Έ **Gas Abstraction Built-In** β€” Pay gas in STRK, ETH, USDC, USDT, or DAI via AVNU Paymaster, or let the developer sponsor gas entirely (gasfree mode)
29
29
  - πŸ“Š **Full Portfolio** β€” Unified view of balances, staking positions, and lending positions with USD values
@@ -36,14 +36,14 @@ Most DeFi tools are built for humans clicking buttons. StarkFi is built for **ag
36
36
 
37
37
  ```
38
38
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
39
- β”‚ StarkFi β”‚
40
- β”‚ β”‚
41
- β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
42
- β”‚ β”‚ CLI β”‚ β”‚ MCP Server β”‚ β”‚ Agent Skills β”‚ β”‚ Telegram Bot β”‚ β”‚
43
- β”‚ β”‚ (30+ β”‚ β”‚ (27 tools) β”‚ β”‚ (10 workflows) β”‚ β”‚ (BYOAI Β· Chat DeFi) β”‚ β”‚
39
+ β”‚ StarkFi β”‚
40
+ β”‚ β”‚
41
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
42
+ β”‚ β”‚ CLI β”‚ β”‚ MCP Server β”‚ β”‚ Agent Skills β”‚ β”‚ Telegram Bot β”‚ β”‚
43
+ β”‚ β”‚ (30+ β”‚ β”‚ (30 tools) β”‚ β”‚ (10 workflows) β”‚ β”‚ (BYOAI Β· Chat DeFi) β”‚ β”‚
44
44
  β”‚ β”‚ commands)β”‚ β”‚ stdio transportβ”‚ β”‚ npx starkfi β”‚ β”‚ OpenAI / Claude / β”‚ β”‚
45
- β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Gemini β”‚ β”‚
46
- β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
45
+ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Gemini β”‚ β”‚
46
+ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
47
47
  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
48
48
  β”‚ β–Ό β–Ό β”‚
49
49
  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
@@ -52,13 +52,13 @@ Most DeFi tools are built for humans clicking buttons. StarkFi is built for **ag
52
52
  β”‚ β”‚ β”‚ Fibrous β”‚ β”‚ Staking β”‚ β”‚ Vesu β”‚ β”‚ Batch β”‚ β”‚ Portfolio β”‚ β”‚ β”‚
53
53
  β”‚ β”‚ β”‚ Swap β”‚ β”‚ Lifecycleβ”‚ β”‚ V2 β”‚ β”‚ Multicallβ”‚ β”‚ Dashboard β”‚ β”‚ β”‚
54
54
  β”‚ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
55
- β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
56
- β”‚ β”‚ β”‚ β”‚ β”‚
57
- β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
58
- β”‚ β”‚ β”‚ Starkzap SDK (starkzap v1.0.0) β”‚ β”‚ β”‚
59
- β”‚ β”‚ β”‚ Wallet Β· TxBuilder Β· Tokens Β· Paymaster β”‚ β”‚ β”‚
60
- β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
61
- β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
55
+ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
56
+ β”‚ β”‚ β”‚ β”‚ β”‚
57
+ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚
58
+ β”‚ β”‚ β”‚ Starkzap SDK (starkzap v1.0.0) β”‚ β”‚ β”‚
59
+ β”‚ β”‚ β”‚ Wallet Β· TxBuilder Β· Tokens Β· Paymaster β”‚ β”‚ β”‚
60
+ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
61
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
62
62
  β”‚ β–Ό β”‚
63
63
  β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
64
64
  β”‚ β”‚ Auth Server (Hono + Privy TEE) β”‚ β”‚ AVNU Paymaster β”‚ β”‚
@@ -136,6 +136,17 @@ npx starkfi@latest lend-status -p Prime --collateral-token STRK --borrow-token U
136
136
  npx starkfi@latest lend-close -p Prime --collateral-token STRK --borrow-token USDC
137
137
  ```
138
138
 
139
+ ### 🩺 Lending Agent (Health Monitoring)
140
+
141
+ Real-time health factor monitoring with risk classification and automated position rebalancing.
142
+
143
+ ```bash
144
+ npx starkfi@latest lend-monitor # Scan all positions
145
+ npx starkfi@latest lend-monitor -p Prime --collateral-token ETH --borrow-token USDC
146
+ npx starkfi@latest lend-auto -p Prime --collateral-token ETH --borrow-token USDC
147
+ npx starkfi@latest lend-auto -p Prime --collateral-token ETH --borrow-token USDC --simulate
148
+ ```
149
+
139
150
  ### πŸ’Έ Gas Abstraction
140
151
 
141
152
  Users pay gas fees in their preferred ERC-20 token via AVNU Paymaster β€” no native STRK or ETH required. Alternatively, developers can sponsor gas entirely.
@@ -171,11 +182,20 @@ npx starkfi@latest portfolio
171
182
  # β†’ Token Balances (USD), Staking Positions, Lending Positions, Total Value
172
183
  ```
173
184
 
185
+ ### πŸ“ˆ Portfolio Optimization
186
+
187
+ Rebalance your portfolio to a target allocation via automated batch swaps.
188
+
189
+ ```bash
190
+ npx starkfi@latest portfolio-rebalance --target "50 ETH, 30 USDC, 20 STRK"
191
+ npx starkfi@latest portfolio-rebalance --target "60 ETH, 40 STRK" --simulate
192
+ ```
193
+
174
194
  ---
175
195
 
176
196
  ## AI Integration (MCP)
177
197
 
178
- StarkFi exposes **27 MCP tools** via stdio transport, enabling AI assistants to execute DeFi operations.
198
+ StarkFi exposes **30 MCP tools** via stdio transport, enabling AI assistants to execute DeFi operations.
179
199
 
180
200
  ```bash
181
201
  # Start the MCP server
@@ -184,13 +204,13 @@ npx starkfi@latest mcp-start
184
204
 
185
205
  ### Tool Categories
186
206
 
187
- | Category | Tools | Count |
188
- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
189
- | **Auth & Config** | `get_auth_status`, `config_action` | 2 |
190
- | **Wallet** | `get_balance`, `get_portfolio`, `deploy_account`, `send_tokens`, `get_tx_status` | 5 |
191
- | **Trade** | `get_swap_quote`, `swap_tokens`, `get_multi_swap_quote`, `multi_swap`, `batch_execute` | 5 |
192
- | **Staking** | `list_validators`, `list_pools`, `get_staking_info`, `get_stake_status`, `stake_tokens`, `unstake_tokens`, `claim_rewards`, `compound_rewards` | 8 |
193
- | **Lending** | `list_lending_pools`, `get_lending_position`, `supply_assets`, `withdraw_assets`, `borrow_assets`, `repay_debt`, `close_position` | 7 |
207
+ | Category | Tools | Count |
208
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
209
+ | **Auth & Config** | `get_auth_status`, `config_action` | 2 |
210
+ | **Wallet** | `get_balance`, `get_portfolio`, `deploy_account`, `send_tokens`, `get_tx_status`, `rebalance_portfolio` | 6 |
211
+ | **Trade** | `get_swap_quote`, `swap_tokens`, `get_multi_swap_quote`, `multi_swap`, `batch_execute` | 5 |
212
+ | **Staking** | `list_validators`, `list_pools`, `get_staking_info`, `get_stake_status`, `stake_tokens`, `unstake_tokens`, `claim_rewards`, `compound_rewards` | 8 |
213
+ | **Lending** | `list_lending_pools`, `get_lending_position`, `supply_assets`, `withdraw_assets`, `borrow_assets`, `repay_debt`, `close_position`, `monitor_lending_position`, `auto_rebalance_lending` | 9 |
194
214
 
195
215
  ### Example β€” AI Agent Workflow
196
216
 
@@ -312,22 +332,31 @@ npx starkfi@latest trade 10 STRK ETH # Execute
312
332
  | ----------------------------------------------------------------------------- | ---------------------- |
313
333
  | `validators [--json]` | List active validators |
314
334
  | `pools <validator> [--json]` | Show delegation pools |
315
- | `stake <amount> --validator <name> [--token <symbol>] [--simulate] [--json]` | Stake tokens |
335
+ | `stake <amount> --validator <name> [--token <symbol>] [--simulate] [--json]` | Stake tokens |
316
336
  | `stake-status [validator] [--json]` | Staking dashboard |
317
337
  | `rewards --validator <name> [--token <symbol>] <--claim\|--compound>` | Manage rewards |
318
338
  | `unstake <intent\|exit> --validator <name> [--token <symbol>] [--amount <n>]` | Unstake (2-step) |
319
339
 
320
340
  ### Lending (Vesu V2)
321
341
 
322
- | Command | Description |
323
- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
324
- | `lend-pools [name]` | List lending pools |
325
- | `lend-supply <amount> -p <pool> -t <token>` | Supply assets |
326
- | `lend-withdraw <amount> -p <pool> -t <token>` | Withdraw assets |
327
- | `lend-borrow -p <pool> --collateral-amount <n> --collateral-token <t> --borrow-amount <n> --borrow-token <t> [--use-supplied]` | Borrow |
328
- | `lend-repay <amount> -p <pool> -t <token> --collateral-token <t>` | Repay debt |
342
+ | Command | Description |
343
+ | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
344
+ | `lend-pools [name]` | List lending pools |
345
+ | `lend-supply <amount> -p <pool> -t <token>` | Supply assets |
346
+ | `lend-withdraw <amount> -p <pool> -t <token>` | Withdraw assets |
347
+ | `lend-borrow -p <pool> --collateral-amount <n> --collateral-token <t> --borrow-amount <n> --borrow-token <t> [--use-supplied]` | Borrow |
348
+ | `lend-repay <amount> -p <pool> -t <token> --collateral-token <t>` | Repay debt |
329
349
  | `lend-status [-p <pool> --collateral-token <t> [--borrow-token <t>]]` | Position status (auto-scan if no args) |
330
- | `lend-close -p <pool> --collateral-token <t> --borrow-token <t>` | Close position atomically |
350
+ | `lend-close -p <pool> --collateral-token <t> --borrow-token <t>` | Close position atomically |
351
+ | `lend-monitor [-p <pool> --collateral-token <t> --borrow-token <t>]` | Monitor health factors |
352
+ | `lend-auto -p <pool> --collateral-token <t> --borrow-token <t> [--strategy <type>]` | Auto-rebalance position |
353
+
354
+ ### Portfolio
355
+
356
+ | Command | Description |
357
+ | -------------------------------------------------------------------------------------- | ------------------------------- |
358
+ | `portfolio [--json]` | Full DeFi dashboard |
359
+ | `portfolio-rebalance --target "<allocation>" [--slippage <%>] [--simulate] [--json]` | Rebalance to target allocation |
331
360
 
332
361
  ### Configuration
333
362
 
@@ -375,23 +404,24 @@ StarkFi has a dedicated **[Telegram bot](https://github.com/ahmetenesdur/starkfi
375
404
 
376
405
  **BYOAI Model** β€” each user provides their own API key (OpenAI, Claude, or Gemini). No shared keys, no centralized billing.
377
406
 
378
- | Feature | Description |
379
- | --- | --- |
380
- | **Swap** | DEX-aggregated trading via Fibrous |
381
- | **Stake** | Multi-token staking (STRK, WBTC, tBTC, SolvBTC, LBTC) |
382
- | **Lend** | Supply, borrow, repay, withdraw, close on Vesu V2 |
383
- | **Portfolio** | Balances with USD valuations and position health |
384
- | **Batch** | Combine swap + stake + supply + send in one transaction |
407
+ | Feature | Description |
408
+ | ------------- | --------------------------------------------------------- |
409
+ | **Swap** | DEX-aggregated trading via Fibrous |
410
+ | **Stake** | Multi-token staking (STRK, WBTC, tBTC, SolvBTC, LBTC) |
411
+ | **Lend** | Supply, borrow, repay, withdraw, close on Vesu V2 |
412
+ | **Portfolio** | Balances with USD valuations and position health |
413
+ | **Batch** | Combine swap + stake + supply + send in one transaction |
385
414
  | **Gas Modes** | Gasless (pay in ERC-20) and gasfree (developer-sponsored) |
386
415
 
387
416
  ```bash
388
417
  git clone https://github.com/ahmetenesdur/starkfi-telegram-bot.git
389
- cd starkfi-telegram-bot && pnpm install
418
+ cd starkfi-telegram-bot
419
+ pnpm install
390
420
  cp .env.example .env # Configure TELEGRAM_BOT_TOKEN, BOT_ENCRYPTION_SECRET
391
421
  pnpm dev
392
422
  ```
393
423
 
394
- See the [starkfi-telegram-bot](https://github.com/ahmetenesdur/starkfi-telegram-bot) repo for full setup and deployment (Docker support included).
424
+ See [`starkfi-telegram-bot/`](https://github.com/ahmetenesdur/starkfi-telegram-bot) for full setup and deployment (Docker support included).
395
425
 
396
426
  ---
397
427
 
@@ -412,31 +442,40 @@ See the [starkfi-telegram-bot](https://github.com/ahmetenesdur/starkfi-telegram-
412
442
 
413
443
  ## Error Handling
414
444
 
415
- StarkFi implements a robust error handling system with a custom `StarkfiError` class and **25 specific error codes** organized by domain:
445
+ StarkFi implements a robust error handling system with a custom `StarkfiError` class and **28 specific error codes** organized by domain:
416
446
 
417
447
  | Domain | Error Codes |
418
448
  | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
419
449
  | **Auth** | `AUTH_REQUIRED`, `AUTH_FAILED`, `SESSION_EXPIRED` |
420
450
  | **Wallet** | `WALLET_NOT_DEPLOYED`, `WALLET_NOT_FOUND`, `INSUFFICIENT_BALANCE` |
421
451
  | **Network** | `NETWORK_ERROR`, `RATE_LIMITED`, `TX_FAILED`, `TX_NOT_FOUND`, `PAYMASTER_ERROR` |
422
- | **Validation** | `INVALID_CONFIG`, `INVALID_ADDRESS`, `INVALID_AMOUNT` |
423
- | **DeFi** | `SWAP_FAILED`, `NO_ROUTE_FOUND`, `SLIPPAGE_EXCEEDED`, `STAKING_FAILED`, `LENDING_FAILED`, `POOL_NOT_FOUND`, `EXIT_NOT_READY`, `VALIDATOR_NOT_FOUND` |
452
+ | **Validation** | `INVALID_CONFIG`, `INVALID_ADDRESS`, `INVALID_AMOUNT`, `INVALID_ALLOCATION` |
453
+ | **DeFi** | `SWAP_FAILED`, `NO_ROUTE_FOUND`, `SLIPPAGE_EXCEEDED`, `STAKING_FAILED`, `LENDING_FAILED`, `POOL_NOT_FOUND`, `EXIT_NOT_READY`, `VALIDATOR_NOT_FOUND`, `MONITOR_FAILED`, `REBALANCE_FAILED` |
424
454
  | **System** | `SIMULATION_FAILED`, `BATCH_LIMIT_EXCEEDED`, `UNKNOWN` |
425
455
 
426
456
  All network operations include **automatic retry with exponential backoff** (500ms base, max 2 retries). Parallel operations use a **sliding-window concurrency pool** to prevent RPC rate-limiting.
427
457
 
428
458
  ### Readable Starknet Errors
429
459
 
430
- Raw Starknet JSON-RPC errors (hex-encoded Cairo strings like `u256_sub Overflow`) are automatically parsed into human-readable messages:
431
-
432
- | Raw Error | Displayed Message |
433
- |-----------|------------------|
434
- | `u256_sub Overflow` | Insufficient balance β€” you don't have enough tokens (including gas fees) |
435
- | `ERC20: insufficient allowance` | Token approval required β€” not enough allowance for this operation |
436
- | `UNAUTHORIZED` | Unauthorized β€” session may have expired, try: starkfi auth login |
437
- | `argent/multicall-failed` | One or more calls in the transaction failed |
438
- | `dusty-collateral-balance` | Collateral amount is below the pool's minimum (dust limit). Please increase the amount. |
439
- | `dusty-debt-balance` | Borrow amount is below the pool's minimum (dust limit). Please increase the amount. |
460
+ Raw Starknet JSON-RPC errors (hex-encoded Cairo strings like `u256_sub Overflow`) are automatically parsed into human-readable messages (15 patterns):
461
+
462
+ | Raw Error | Displayed Message |
463
+ | ---------------------------------------- | --------------------------------------------------------------------------------------- |
464
+ | `u256_sub Overflow` | Insufficient balance β€” you don't have enough tokens (including gas fees) |
465
+ | `u256_add Overflow` | Amount overflow β€” the value is too large |
466
+ | `ERC20: transfer amount exceeds balance` | Insufficient token balance for this transfer |
467
+ | `ERC20: burn amount exceeds balance` | Insufficient token balance to burn |
468
+ | `ERC20: insufficient allowance` | Token approval required β€” not enough allowance for this operation |
469
+ | `argent/multicall-failed` | One or more calls in the transaction failed |
470
+ | `argent/invalid-signature` | Invalid signature β€” try re-authenticating with: starkfi auth login |
471
+ | `argent/invalid-timestamp` | Transaction expired β€” please retry |
472
+ | `is_valid_signature` | Signature validation failed β€” try re-authenticating |
473
+ | `assert_not_zero` | Operation failed β€” a required value was zero |
474
+ | `Contract not found` | Contract not found β€” the target contract does not exist on this network |
475
+ | `UNAUTHORIZED` | Unauthorized β€” session may have expired, try: starkfi auth login |
476
+ | `nonce` | Transaction nonce error β€” please retry |
477
+ | `dusty-collateral-balance` | Collateral amount is below the pool's minimum (dust limit). Please increase the amount. |
478
+ | `dusty-debt-balance` | Borrow amount is below the pool's minimum (dust limit). Please increase the amount. |
440
479
 
441
480
  This applies to both CLI output (`formatError`) and MCP responses (`withErrorHandling`).
442
481