starkfi 0.4.4 → 0.6.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starkfi",
3
- "version": "0.4.4",
4
- "description": "AI-native Starknet DeFi CLI + MCP Server + Agent Skills — Swaps, multi-swap, batch (multicall), staking, lending, simulation, portfolio, gas abstraction",
3
+ "version": "0.6.0",
4
+ "description": "AI-native Starknet DeFi CLI + MCP Server + Agent Skills — Swaps, multi-swap, batch (multicall), staking, lending, DCA, confidential transfers, simulation, portfolio, gas abstraction",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "starkfi": "./dist/index.js"
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "build": "tsup",
22
- "dev": "node --import tsx/esm src/index.ts",
22
+ "dev": "tsx --import ./scripts/stub-peers-loader.mjs src/index.ts",
23
23
  "typecheck": "tsc --noEmit",
24
24
  "lint": "eslint src/",
25
25
  "lint:fix": "eslint src/ --fix",
@@ -48,6 +48,9 @@
48
48
  "lending",
49
49
  "gasless",
50
50
  "gas-abstraction",
51
+ "dca",
52
+ "confidential",
53
+ "tongo",
51
54
  "vesu",
52
55
  "fibrous",
53
56
  "web3",
@@ -66,9 +69,10 @@
66
69
  "engines": {
67
70
  "node": ">=18"
68
71
  },
69
- "dependencies": {},
70
72
  "pnpm": {
71
- "onlyBuiltDependencies": ["esbuild"]
73
+ "onlyBuiltDependencies": [
74
+ "esbuild"
75
+ ]
72
76
  },
73
77
  "devDependencies": {
74
78
  "@eslint/js": "^10.0.1",
@@ -77,17 +81,20 @@
77
81
  "chalk": "^5.6.2",
78
82
  "commander": "^14.0.3",
79
83
  "env-paths": "^3.0.0",
80
- "eslint": "^10.0.3",
84
+ "eslint": "^10.1.0",
81
85
  "eslint-config-prettier": "^10.1.8",
82
86
  "globals": "^17.4.0",
83
87
  "jiti": "^2.6.1",
84
88
  "ora": "^9.3.0",
85
89
  "prettier": "^3.8.1",
86
- "starkzap": "^1.0.0",
90
+ "starkzap": "^2.0.0",
87
91
  "tsup": "^8.5.1",
88
92
  "tsx": "^4.21.0",
89
93
  "typescript": "^5.9.3",
90
- "typescript-eslint": "^8.57.0",
94
+ "typescript-eslint": "^8.57.2",
91
95
  "zod": "^4.3.6"
96
+ },
97
+ "dependencies": {
98
+ "@fatsolutions/tongo-sdk": "^1.3.2"
92
99
  }
93
100
  }
package/skills/README.md CHANGED
@@ -9,12 +9,14 @@ Agent Skills for the [StarkFi](https://github.com/ahmetenesdur/starkfi) CLI —
9
9
  | [authenticate-wallet](./authenticate-wallet/SKILL.md) | auth | Email OTP login, session management, wallet deploy |
10
10
  | [balance](./balance/SKILL.md) | wallet-data | Check STRK, ETH, and ERC-20 token balances |
11
11
  | [send](./send/SKILL.md) | transaction | Transfer tokens to a Starknet address |
12
- | [trade](./trade/SKILL.md) | transaction | Swap tokens via Fibrous aggregation |
12
+ | [trade](./trade/SKILL.md) | transaction | Swap tokens via Fibrous (default), AVNU, or Ekubo |
13
13
  | [multi-swap](./multi-swap/SKILL.md) | transaction | Multiple swaps in one transaction (up to 3) |
14
- | [batch](./batch/SKILL.md) | transaction | Combine swap + stake + supply + send in one multicall |
14
+ | [batch](./batch/SKILL.md) | transaction | Combine swap + stake + supply + send + borrow + repay + withdraw + DCA in one multicall |
15
15
  | [staking](./staking/SKILL.md) | transaction | Stake, unstake, claim, compound (STRK, WBTC, tBTC, SolvBTC, LBTC) |
16
- | [lending](./lending/SKILL.md) | transaction | Vesu V2 lending: supply, borrow, repay, withdraw, close |
17
- | [portfolio](./portfolio/SKILL.md) | wallet-data | Aggregated DeFi dashboard with USD valuations |
16
+ | [lending](./lending/SKILL.md) | transaction | Vesu V2 lending: supply, borrow, repay, monitor, auto-rebalance |
17
+ | [dca](./dca/SKILL.md) | transaction | Dollar-Cost Averaging: create, preview, list, cancel recurring orders |
18
+ | [confidential](./confidential/SKILL.md) | transaction | Tongo Cash: fund, transfer, withdraw, ragequit, rollover (ZK privacy) |
19
+ | [portfolio](./portfolio/SKILL.md) | wallet-data | DeFi dashboard + portfolio optimization via rebalancing |
18
20
  | [config](./config/SKILL.md) | utility | RPC, network, gas settings, transaction status |
19
21
 
20
22
  ## Installation
@@ -36,7 +38,7 @@ npx skills add ahmetenesdur/starkfi
36
38
 
37
39
  1. **Authenticate** → `authenticate-wallet` (required first)
38
40
  2. **Check funds** → `balance` or `portfolio`
39
- 3. **Execute** → `send`, `trade`, `multi-swap`, `batch`, `staking`, or `lending`
41
+ 3. **Execute** → `send`, `trade`, `multi-swap`, `batch`, `staking`, `lending`, `dca`, or `confidential`
40
42
  4. **Verify** → `tx-status` (via `config` skill)
41
43
 
42
44
  ## Trigger Examples
@@ -49,10 +51,19 @@ npx skills add ahmetenesdur/starkfi
49
51
  | "Swap 100 USDC for ETH" | `trade` |
50
52
  | "Swap USDC to ETH and USDT to STRK" | `multi-swap` |
51
53
  | "Swap ETH and then stake STRK" | `batch` |
54
+ | "Withdraw from lending and swap" | `batch` |
52
55
  | "Stake 1000 STRK with Karnot" | `staking` |
53
56
  | "Supply 500 USDC to Prime pool" | `lending` |
57
+ | "Is my position safe?" | `lending` |
58
+ | "Fix my risky position" | `lending` |
54
59
  | "Show me my portfolio" | `portfolio` |
60
+ | "Rebalance to 50% ETH, 30% USDC" | `portfolio` |
61
+ | "DCA 100 USDC into ETH daily" | `dca` |
62
+ | "Show my active DCA orders" | `dca` |
55
63
  | "I'm getting rate limit errors" | `config` |
64
+ | "Set up my Tongo account" | `confidential` |
65
+ | "Fund 100 USDC confidentially" | `confidential` |
66
+ | "Send 50 privately" | `confidential` |
56
67
 
57
68
  ## License
58
69
 
@@ -77,4 +77,6 @@ npx starkfi@latest balance --json
77
77
  - Run this BEFORE `send` or `trade` to verify sufficient funds.
78
78
  - Run this BEFORE `staking` to confirm available STRK/BTC tokens.
79
79
  - Run this BEFORE `lending` supply operations to confirm available assets.
80
+ - Run this BEFORE `dca` to verify sufficient sell token balance for the total DCA amount.
81
+ - Run this BEFORE `confidential` `conf-fund` to verify sufficient tokens for funding the confidential account.
80
82
  - Use `portfolio` for a complete view including staking and lending positions with USD values.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: batch
3
- description: Execute multiple different DeFi operations in a single Starknet transaction — combine swaps, staking, lending supply, and token sends into one multicall. Use this skill when the user wants to batch, combine, bundle, or chain multiple diverse operations together in one atomic transaction, such as "swap ETH and then stake STRK" or "swap and send in one go". Also trigger when the user mentions multicall, combining operations, doing multiple things at once, or wants to save gas by bundling actions — even if they don't use the word "batch".
3
+ description: Execute multiple different DeFi operations in a single Starknet transaction — combine swaps, staking, lending supply/borrow/repay/withdraw, token sends, and DCA orders into one multicall. Use this skill when the user wants to batch, combine, bundle, or chain multiple diverse operations together in one atomic transaction, such as "swap ETH and then stake STRK" or "withdraw from lending and swap" or "repay debt and stake" or "swap and send in one go" or "create a DCA order and stake". Also trigger when the user mentions multicall, combining operations, doing multiple things at once, or wants to save gas by bundling actions — even if they don't use the word "batch".
4
4
  license: MIT
5
5
  compatibility: Requires Node.js 18+ and npx.
6
6
  metadata:
@@ -17,7 +17,7 @@ allowed-tools:
17
17
 
18
18
  # Batch Execute
19
19
 
20
- Bundle multiple diverse DeFi operations into a single Starknet multicall transaction. Supports combining **swaps**, **staking**, **lending supply**, and **token sends** — all executed atomically in one on-chain call.
20
+ Bundle multiple diverse DeFi operations into a single Starknet multicall transaction. Supports combining **swaps**, **staking**, **lending supply/borrow/repay/withdraw**, **token sends**, and **DCA orders** — all executed atomically in one on-chain call.
21
21
 
22
22
  ## Prerequisites
23
23
 
@@ -28,8 +28,8 @@ Bundle multiple diverse DeFi operations into a single Starknet multicall transac
28
28
  ## Rules
29
29
 
30
30
  1. BEFORE any batch, you MUST run `npx starkfi@latest status` and `npx starkfi@latest balance` to verify connectivity and funds.
31
- 2. A batch MUST include at least **2 operations**. For single operations, use the dedicated skill (`trade`, `send`, `staking`, or `lending`).
32
- 3. Each `--swap`, `--stake`, `--supply`, and `--send` flag can appear **multiple times** (repeatable).
31
+ 2. A batch MUST include at least **2 operations**. For single operations, use the dedicated skill (`trade`, `send`, `staking`, `lending`, or `dca`).
32
+ 3. Each `--swap`, `--stake`, `--supply`, `--send`, `--dca-create`, and `--dca-cancel` flag can appear **multiple times** (repeatable).
33
33
  4. If the batch includes a `--send` operation, you MUST confirm the recipient address with the user before executing.
34
34
  5. Suggest using `--simulate` first to verify the entire batch would succeed.
35
35
  6. AFTER a successful batch, verify with `npx starkfi@latest tx-status <hash>`.
@@ -41,8 +41,13 @@ Bundle multiple diverse DeFi operations into a single Starknet multicall transac
41
41
  npx starkfi@latest batch [--simulate] [--json] \
42
42
  --swap "<amount> <from> <to>" \
43
43
  --stake "<amount> <token> <validator_or_pool>" \
44
- --supply "<amount> <token> <pool_address>" \
45
- --send "<amount> <token> <recipient>"
44
+ --supply "<amount> <token> <pool>" \
45
+ --send "<amount> <token> <recipient>" \
46
+ --borrow "<col_amt> <col_token> <bor_amt> <bor_token> <pool>" \
47
+ --repay "<amount> <token> <col_token> <pool>" \
48
+ --withdraw "<amount> <token> <pool>" \
49
+ --dca-create "<amount> <sell> <buy> <perCycle> [frequency]" \
50
+ --dca-cancel "<orderId>"
46
51
  ```
47
52
 
48
53
  ## Operation Formats
@@ -51,8 +56,13 @@ npx starkfi@latest batch [--simulate] [--json] \
51
56
  | ---------- | ------------------------------------------ | ------------------------------- |
52
57
  | `--swap` | `"<amount> <from> <to>"` | `--swap "100 USDC ETH"` |
53
58
  | `--stake` | `"<amount> <token> <validator_or_0xPool>"` | `--stake "500 STRK Karnot"` |
54
- | `--supply` | `"<amount> <token> <0xPool>"` | `--supply "100 USDC 0x04a3..."` |
55
- | `--send` | `"<amount> <token> <0xRecipient>"` | `--send "10 STRK 0x07b2..."` |
59
+ | `--supply` | `"<amount> <token> <pool>"` | `--supply "100 USDC Prime"` |
60
+ | `--send` | `"<amount> <token> <0xRecipient>"` | `--send "10 STRK 0x07b2..."` |
61
+ | `--borrow` | `"<col_amt> <col_token> <bor_amt> <bor_token> <pool>"` | `--borrow "0.5 ETH 500 USDC Prime"` |
62
+ | `--repay` | `"<amount> <token> <col_token> <pool>"` | `--repay "100 USDC ETH Prime"` |
63
+ | `--withdraw` | `"<amount> <token> <pool>"` | `--withdraw "200 USDC Prime"` |
64
+ | `--dca-create` | `"<amount> <sell> <buy> <perCycle> [freq]"` | `--dca-create "1000 USDC ETH 10 P1D"` |
65
+ | `--dca-cancel` | `"<orderId>"` | `--dca-cancel "abc123"` |
56
66
 
57
67
  > **Note:** `--stake` accepts either a validator name (e.g. `Karnot`) or a pool contract address (starting with `0x`). The CLI auto-detects the format.
58
68
 
@@ -63,7 +73,12 @@ npx starkfi@latest batch [--simulate] [--json] \
63
73
  | `--swap` | string | Swap operation (repeatable) | No\* |
64
74
  | `--stake` | string | Stake operation (repeatable) | No\* |
65
75
  | `--supply` | string | Lending supply operation (repeatable) | No\* |
66
- | `--send` | string | Token transfer operation (repeatable) | No\* |
76
+ | `--send` | string | Token transfer operation (repeatable) | No\* |
77
+ | `--borrow` | string | Borrow from lending pool (repeatable) | No\* |
78
+ | `--repay` | string | Repay lending debt (repeatable) | No\* |
79
+ | `--withdraw` | string | Withdraw from lending pool (repeatable) | No\* |
80
+ | `--dca-create` | string | Create DCA order (repeatable) | No\* |
81
+ | `--dca-cancel` | string | Cancel DCA order (repeatable) | No\* |
67
82
  | `--simulate` | flag | Estimate fees without broadcasting | No |
68
83
  | `--json` | flag | Output as JSON | No |
69
84
 
@@ -80,15 +95,32 @@ npx starkfi@latest batch --swap "100 USDC ETH" --stake "500 STRK Karnot"
80
95
  npx starkfi@latest tx-status <hash>
81
96
  ```
82
97
 
83
- **User:** "Batch: swap 50 USDT to STRK, supply 100 USDC and send 10 STRK"
98
+ **User:** "Withdraw my USDC from Prime lending and swap it to ETH"
99
+
100
+ ```bash
101
+ npx starkfi@latest status
102
+ npx starkfi@latest balance
103
+ npx starkfi@latest batch --withdraw "200 USDC Prime" --swap "200 USDC ETH"
104
+ npx starkfi@latest tx-status <hash>
105
+ ```
106
+
107
+ **User:** "Repay my USDC debt on Prime and stake STRK"
108
+
109
+ ```bash
110
+ npx starkfi@latest status
111
+ npx starkfi@latest balance
112
+ npx starkfi@latest batch --repay "100 USDC ETH Prime" --stake "50 STRK karnot"
113
+ npx starkfi@latest tx-status <hash>
114
+ ```
115
+
116
+ **User:** "Borrow USDC using ETH as collateral and swap half to STRK"
84
117
 
85
118
  ```bash
86
119
  npx starkfi@latest status
87
120
  npx starkfi@latest balance
88
121
  npx starkfi@latest batch \
89
- --swap "50 USDT STRK" \
90
- --supply "100 USDC 0x04a3..." \
91
- --send "10 STRK 0x07b2..."
122
+ --borrow "0.5 ETH 500 USDC Prime" \
123
+ --swap "250 USDC STRK"
92
124
  npx starkfi@latest tx-status <hash>
93
125
  ```
94
126
 
@@ -117,3 +149,4 @@ npx starkfi@latest batch --simulate \
117
149
  - Use `staking` for standalone staking operations.
118
150
  - Use `lending` for standalone lending operations.
119
151
  - Use `send` for standalone token transfers.
152
+ - Use `dca` for standalone DCA order management.
@@ -0,0 +1,183 @@
1
+ ---
2
+ name: confidential
3
+ description: Manage confidential (private) transfers via Tongo Cash on Starknet — setup, fund, transfer, withdraw, ragequit, rollover using ZK proofs. Use this skill when the user wants to send tokens privately, hide transfer amounts, use zero-knowledge proofs, set up Tongo, fund or withdraw from a confidential account, perform an emergency exit (ragequit), or activate pending balance (rollover). Also trigger when the user says "send privately", "confidential transfer", "hide my transaction", "Tongo Cash", "ZK transfer", or any variation about privacy-preserving transfers — even if they don't use the word "confidential".
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 conf-setup *)
12
+ - Bash(npx starkfi@latest conf-balance)
13
+ - Bash(npx starkfi@latest conf-balance *)
14
+ - Bash(npx starkfi@latest conf-fund *)
15
+ - Bash(npx starkfi@latest conf-transfer *)
16
+ - Bash(npx starkfi@latest conf-withdraw *)
17
+ - Bash(npx starkfi@latest conf-ragequit)
18
+ - Bash(npx starkfi@latest conf-ragequit *)
19
+ - Bash(npx starkfi@latest conf-rollover)
20
+ - Bash(npx starkfi@latest conf-rollover *)
21
+ - Bash(npx starkfi@latest status)
22
+ - Bash(npx starkfi@latest balance)
23
+ - Bash(npx starkfi@latest balance *)
24
+ - Bash(npx starkfi@latest tx-status *)
25
+ ---
26
+
27
+ # Confidential Transfers (Tongo Cash)
28
+
29
+ Privacy-preserving token transfers using ZK proofs on Starknet. Amounts are hidden on-chain; recipients are identified by elliptic curve public keys, not Starknet addresses.
30
+
31
+ ## Prerequisites
32
+
33
+ - Active session required. If not authenticated, run `authenticate-wallet` skill first.
34
+ - Tongo credentials configured (`conf-setup`). Must be done once before any other confidential command.
35
+ - Sufficient public token balance for `conf-fund` operations.
36
+
37
+ ## Rules
38
+
39
+ 1. BEFORE any confidential operation, run `npx starkfi@latest status` to verify authentication.
40
+ 2. `conf-setup` MUST be called before any other confidential command. It only needs to run once.
41
+ 3. BEFORE `conf-fund`, check `balance` to verify sufficient public token balance.
42
+ 4. BEFORE `conf-transfer` or `conf-withdraw`, check `conf-balance` to verify sufficient active balance.
43
+ 5. After the recipient receives a transfer, remind them to run `conf-rollover` to activate pending balance.
44
+ 6. `conf-ragequit` is a DESTRUCTIVE operation — it empties the entire confidential balance. Always warn the user and get explicit confirmation.
45
+ 7. AFTER any transactional operation (`conf-fund`, `conf-transfer`, `conf-withdraw`, `conf-ragequit`, `conf-rollover`), verify with `tx-status`.
46
+ 8. The Tongo private key is stored locally at `~/.local/share/starkfi/confidential.json` with strict `0o600` permissions and is **never sent to the network**.
47
+
48
+ ## Setup (One-Time)
49
+
50
+ ```bash
51
+ npx starkfi@latest conf-setup --key <TONGO_PRIVATE_KEY> --contract 0x1234…
52
+ ```
53
+
54
+ ## Commands
55
+
56
+ ### Check Balance
57
+
58
+ ```bash
59
+ npx starkfi@latest conf-balance [--json]
60
+ ```
61
+
62
+ Returns: active balance, pending balance, nonce, Tongo address.
63
+
64
+ ### Fund Confidential Account
65
+
66
+ Move public ERC-20 tokens into a private confidential balance.
67
+
68
+ ```bash
69
+ npx starkfi@latest conf-fund <amount> [--token <symbol>] [--simulate] [--json]
70
+ ```
71
+
72
+ ### Transfer Confidentially
73
+
74
+ Send tokens privately to another Tongo account. Recipient is identified by their public key coordinates (x, y).
75
+
76
+ ```bash
77
+ npx starkfi@latest conf-transfer <amount> --recipient-x <x> --recipient-y <y> [--token <symbol>] [--simulate] [--json]
78
+ ```
79
+
80
+ ### Withdraw to Public
81
+
82
+ Convert private balance back to public ERC-20 tokens.
83
+
84
+ ```bash
85
+ npx starkfi@latest conf-withdraw <amount> [--to <address>] [--token <symbol>] [--simulate] [--json]
86
+ ```
87
+
88
+ ### Ragequit (Emergency Exit)
89
+
90
+ Withdraw the entire confidential balance to a public address immediately.
91
+
92
+ ```bash
93
+ npx starkfi@latest conf-ragequit [--to <address>] [--json]
94
+ ```
95
+
96
+ ### Rollover (Activate Pending)
97
+
98
+ Received transfers start as "pending" and must be rolled over to become spendable.
99
+
100
+ ```bash
101
+ npx starkfi@latest conf-rollover [--json]
102
+ ```
103
+
104
+ ## Parameters
105
+
106
+ | Parameter | Type | Description | Required |
107
+ | ---------------- | ------ | ---------------------------------------- | ---------- |
108
+ | `amount` | number | Amount for fund/transfer/withdraw | Yes |
109
+ | `--key` | string | Tongo private key (setup only) | Yes (setup)|
110
+ | `--contract` | string | Tongo contract address | Yes (setup)|
111
+ | `--recipient-x` | string | Recipient public key X coordinate | Yes (transfer) |
112
+ | `--recipient-y` | string | Recipient public key Y coordinate | Yes (transfer) |
113
+ | `--token` | string | Token symbol (default: `USDC`) | No |
114
+ | `--to` | string | Recipient Starknet address | No |
115
+ | `--simulate` | flag | Estimate fees without broadcasting | No |
116
+ | `--json` | flag | Output as JSON | No |
117
+
118
+ ## Examples
119
+
120
+ **User:** "Set up my Tongo account"
121
+
122
+ ```bash
123
+ npx starkfi@latest conf-setup --key <KEY> --contract 0x1234…
124
+ ```
125
+
126
+ **User:** "Fund 100 USDC into my confidential account"
127
+
128
+ ```bash
129
+ npx starkfi@latest status
130
+ npx starkfi@latest balance --token USDC
131
+ npx starkfi@latest conf-fund 100 --token USDC --simulate
132
+ npx starkfi@latest conf-fund 100 --token USDC
133
+ npx starkfi@latest tx-status <hash>
134
+ ```
135
+
136
+ **User:** "Send 50 privately to this public key"
137
+
138
+ ```bash
139
+ npx starkfi@latest conf-balance
140
+ npx starkfi@latest conf-transfer 50 --recipient-x 0xABC --recipient-y 0xDEF --simulate
141
+ npx starkfi@latest conf-transfer 50 --recipient-x 0xABC --recipient-y 0xDEF
142
+ npx starkfi@latest tx-status <hash>
143
+ ```
144
+
145
+ **User:** "Withdraw 100 from my confidential account"
146
+
147
+ ```bash
148
+ npx starkfi@latest conf-balance
149
+ npx starkfi@latest conf-withdraw 100 --simulate
150
+ npx starkfi@latest conf-withdraw 100
151
+ npx starkfi@latest tx-status <hash>
152
+ ```
153
+
154
+ **User:** "Emergency withdraw everything"
155
+
156
+ ```bash
157
+ # WARN: This empties the entire confidential balance
158
+ npx starkfi@latest conf-ragequit
159
+ npx starkfi@latest tx-status <hash>
160
+ ```
161
+
162
+ **User:** "Activate my pending balance"
163
+
164
+ ```bash
165
+ npx starkfi@latest conf-rollover
166
+ npx starkfi@latest tx-status <hash>
167
+ ```
168
+
169
+ ## Error Handling
170
+
171
+ | Error | Action |
172
+ | ------------------------------- | ---------------------------------------------------------- |
173
+ | `CONFIDENTIAL_NOT_CONFIGURED` | Run `conf-setup` with valid Tongo key and contract address.|
174
+ | `CONFIDENTIAL_FAILED` | Check balance, credentials, and retry. |
175
+ | `Insufficient balance` | Check `conf-balance` for active balance before operations. |
176
+ | `Not authenticated` | Run `authenticate-wallet` skill first. |
177
+
178
+ ## Related Skills
179
+
180
+ - Use `authenticate-wallet` to ensure an active session before confidential operations.
181
+ - Use `balance` to verify public token balance before funding.
182
+ - Use `send` for standard (non-private) token transfers.
183
+ - Use `config` to set a custom RPC if experiencing rate limits.
@@ -19,7 +19,7 @@ Manage local configuration for the StarkFi CLI and check transaction status on-c
19
19
  ## Prerequisites
20
20
 
21
21
  - None for configuration commands (`config list`, `config set-*`, `config get-rpc`).
22
- - Active session required for `tx-status` (it reads the network from the session).
22
+ - Active session required for `tx-status` and for `config list` to show the effective network source.
23
23
 
24
24
  ## Configuration Commands
25
25
 
@@ -36,7 +36,7 @@ npx starkfi@latest config set-rpc <url>
36
36
  # Get current RPC URL
37
37
  npx starkfi@latest config get-rpc
38
38
 
39
- # Switch network
39
+ # Switch network (takes effect immediately, no re-login needed)
40
40
  npx starkfi@latest config set-network <network>
41
41
 
42
42
  # Toggle developer-sponsored gas (Gasfree mode)
@@ -81,8 +81,9 @@ Gasfree and Gasless are mutually exclusive — enabling one disables the other.
81
81
 
82
82
  1. **Rate Limits**: If any skill fails with "rate limit" or "429" errors, use `config set-rpc` to set a custom RPC endpoint.
83
83
  2. **Persistence**: Settings are stored locally and persist across sessions.
84
- 3. Use `tx-status` AFTER every `send`, `trade`, `multi-swap`, `batch`, and staking/lending transaction to verify success.
85
- 4. Use `config get-rpc` to check the current RPC URL before changing it.
84
+ 3. **Network switching**: `set-network` takes effect instantly for all commands — no re-login required. The config setting overrides the session's login network. `config list` shows the effective network with its source (e.g. `sepolia (config override, session: mainnet)`).
85
+ 4. Use `tx-status` AFTER every `send`, `trade`, `multi-swap`, `batch`, `dca-create`, `dca-cancel`, `conf-fund`, `conf-transfer`, `conf-withdraw`, and staking/lending transaction to verify success.
86
+ 5. Use `config get-rpc` to check the current RPC URL before changing it.
86
87
 
87
88
  ## Examples
88
89
 
@@ -103,6 +104,7 @@ npx starkfi@latest config list
103
104
 
104
105
  ```bash
105
106
  npx starkfi@latest config set-network sepolia
107
+ npx starkfi@latest config list # Verify: shows "sepolia (config override, session: mainnet)"
106
108
  ```
107
109
 
108
110
  **User:** "Enable free gas mode"
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: dca
3
+ description: Create, preview, list, and cancel recurring Dollar-Cost Averaging (DCA) buy orders on Starknet via AVNU or Ekubo. Use this skill when the user wants to set up automatic recurring purchases, dollar cost average into a token, create a DCA order, schedule periodic buys, or manage existing DCA orders — even if they don't use the term "DCA" explicitly.
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 dca-create *)
12
+ - Bash(npx starkfi@latest dca-list *)
13
+ - Bash(npx starkfi@latest dca-cancel *)
14
+ - Bash(npx starkfi@latest dca-preview *)
15
+ - Bash(npx starkfi@latest status)
16
+ - Bash(npx starkfi@latest balance)
17
+ - Bash(npx starkfi@latest balance *)
18
+ - Bash(npx starkfi@latest tx-status *)
19
+ ---
20
+
21
+ # Dollar-Cost Averaging (DCA)
22
+
23
+ Create recurring buy orders that automatically swap a fixed amount of one token into another at regular intervals. Supports AVNU and Ekubo DCA providers.
24
+
25
+ ## Prerequisites
26
+
27
+ - Active session required.
28
+ - Sufficient balance of the sell token for the total DCA amount.
29
+ - Account must be deployed on-chain.
30
+
31
+ ## Rules
32
+
33
+ 1. BEFORE any DCA operation, you MUST run `npx starkfi@latest status` and `npx starkfi@latest balance` to verify connectivity and funds.
34
+ 2. ALWAYS run `dca-preview` before `dca-create` to verify the expected output per cycle.
35
+ 3. The `--per-cycle` flag is **required** for `dca-create`. It sets the amount sold each execution cycle.
36
+ 4. Frequency uses ISO 8601 duration format: `P1D` (daily), `PT12H` (12 hours), `P1W` (weekly).
37
+ 5. Suggest using `--simulate` first to verify the DCA order would succeed.
38
+ 6. AFTER a successful creation, verify with `npx starkfi@latest tx-status <hash>`.
39
+
40
+ ## Commands
41
+
42
+ ### Preview a Cycle
43
+
44
+ ```bash
45
+ npx starkfi@latest dca-preview <amount> <sell_token> <buy_token> [--provider <avnu|ekubo>] [--json]
46
+ ```
47
+
48
+ ### Create a DCA Order
49
+
50
+ ```bash
51
+ npx starkfi@latest dca-create <total_amount> <sell_token> <buy_token> \
52
+ --per-cycle <amount> \
53
+ [--frequency <duration>] \
54
+ [--provider <avnu|ekubo>] \
55
+ [--simulate] [--json]
56
+ ```
57
+
58
+ ### List DCA Orders
59
+
60
+ ```bash
61
+ npx starkfi@latest dca-list [--status <ACTIVE|CLOSED|INDEXING>] [--provider <avnu|ekubo>] [--page <n>] [--json]
62
+ ```
63
+
64
+ ### Cancel a DCA Order
65
+
66
+ ```bash
67
+ npx starkfi@latest dca-cancel <order_id> [--provider <avnu|ekubo>] [--json]
68
+ ```
69
+
70
+ ## Parameters
71
+
72
+ | Parameter | Type | Description | Required |
73
+ | ------------- | ------ | -------------------------------------------- | -------- |
74
+ | `amount` | string | Total sell amount (create) or per-cycle amount (preview) | **Yes** |
75
+ | `sell_token` | string | Token to sell (e.g. `STRK`, `ETH`) | **Yes** |
76
+ | `buy_token` | string | Token to buy (e.g. `USDC`, `ETH`) | **Yes** |
77
+ | `--per-cycle` | string | Amount to sell per cycle | **Yes** (create) |
78
+ | `--frequency` | string | ISO 8601 duration (default: `P1D`=daily) | No |
79
+ | `--provider` | string | DCA provider: `avnu` (default) or `ekubo` | No |
80
+ | `--status` | string | Filter orders: `ACTIVE`, `CLOSED`, `INDEXING` | No (list) |
81
+ | `--simulate` | flag | Estimate fees without broadcasting | No |
82
+ | `--json` | flag | Output as JSON | No |
83
+
84
+ ## Examples
85
+
86
+ **User:** "Buy 10 USDC worth of ETH every day for 100 days"
87
+
88
+ ```bash
89
+ npx starkfi@latest status
90
+ npx starkfi@latest balance
91
+ npx starkfi@latest dca-preview 10 USDC ETH
92
+ npx starkfi@latest dca-create 1000 USDC ETH --per-cycle 10 --frequency P1D --simulate
93
+ npx starkfi@latest dca-create 1000 USDC ETH --per-cycle 10 --frequency P1D
94
+ npx starkfi@latest tx-status <hash>
95
+ ```
96
+
97
+ **User:** "DCA into STRK weekly with 50 USDC per week, total 200 USDC"
98
+
99
+ ```bash
100
+ npx starkfi@latest status
101
+ npx starkfi@latest balance
102
+ npx starkfi@latest dca-preview 50 USDC STRK
103
+ npx starkfi@latest dca-create 200 USDC STRK --per-cycle 50 --frequency P1W
104
+ ```
105
+
106
+ **User:** "Show my active DCA orders"
107
+
108
+ ```bash
109
+ npx starkfi@latest dca-list --status ACTIVE --json
110
+ ```
111
+
112
+ **User:** "Cancel my DCA order"
113
+
114
+ ```bash
115
+ npx starkfi@latest dca-list --status ACTIVE
116
+ npx starkfi@latest dca-cancel <order_id>
117
+ npx starkfi@latest tx-status <hash>
118
+ ```
119
+
120
+ ## Error Handling
121
+
122
+ | Error | Action |
123
+ | ---------------------- | ---------------------------------------------------------- |
124
+ | `DCA_FAILED` | Check the error message for details (balance, provider). |
125
+ | `Insufficient balance` | Check `balance` for the sell token. |
126
+ | `Not authenticated` | Run `authenticate-wallet` skill first. |
127
+ | `Invalid frequency` | Use ISO 8601 format: `P1D`, `PT12H`, `P1W`, `P1M`. |
128
+
129
+ ## Related Skills
130
+
131
+ - Use `trade` for a one-time swap instead of recurring.
132
+ - Use `batch` to combine a DCA creation with other operations.
133
+ - Use `portfolio` to check your overall positions and balances.