fibx 0.2.6 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -195
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/auth/login.js +2 -21
- 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 +11 -44
- package/dist/commands/auth/verify.js.map +1 -1
- package/dist/commands/defi/aave.js +1 -3
- package/dist/commands/defi/aave.js.map +1 -1
- package/dist/commands/trade/swap.d.ts.map +1 -1
- package/dist/commands/trade/swap.js +19 -7
- package/dist/commands/trade/swap.js.map +1 -1
- package/dist/commands/wallet/list.d.ts +1 -1
- package/dist/commands/wallet/list.d.ts.map +1 -1
- package/dist/commands/wallet/list.js +18 -26
- package/dist/commands/wallet/list.js.map +1 -1
- package/dist/commands/wallet/send.d.ts.map +1 -1
- package/dist/commands/wallet/send.js +1 -3
- package/dist/commands/wallet/send.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +3 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/services/api/client.d.ts +34 -0
- package/dist/services/api/client.d.ts.map +1 -0
- package/dist/services/api/client.js +68 -0
- package/dist/services/api/client.js.map +1 -0
- package/dist/services/chain/client.d.ts +1 -2
- package/dist/services/chain/client.d.ts.map +1 -1
- package/dist/services/chain/client.js +6 -6
- package/dist/services/chain/client.js.map +1 -1
- package/dist/services/defi/aave.d.ts +3 -0
- package/dist/services/defi/aave.d.ts.map +1 -1
- package/dist/services/defi/aave.js +170 -50
- package/dist/services/defi/aave.js.map +1 -1
- package/dist/services/defi/abi/aave.d.ts +60 -0
- package/dist/services/defi/abi/aave.d.ts.map +1 -1
- package/dist/services/defi/abi/aave.js +41 -0
- package/dist/services/defi/abi/aave.js.map +1 -1
- package/dist/services/defi/constants.d.ts +1 -0
- package/dist/services/defi/constants.d.ts.map +1 -1
- package/dist/services/defi/constants.js +2 -0
- package/dist/services/defi/constants.js.map +1 -1
- package/dist/services/privy/account.d.ts +5 -2
- package/dist/services/privy/account.d.ts.map +1 -1
- package/dist/services/privy/account.js +19 -21
- package/dist/services/privy/account.js.map +1 -1
- package/dist/services/privy/client.d.ts +1 -14
- package/dist/services/privy/client.d.ts.map +1 -1
- package/dist/services/privy/client.js +6 -62
- package/dist/services/privy/client.js.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,101 +1,41 @@
|
|
|
1
1
|
# fibx
|
|
2
2
|
|
|
3
|
-
A command-line tool for
|
|
3
|
+
A command-line tool for DeFi operations on **Base, Citrea, HyperEVM, and Monad**, powered by [Fibrous](https://fibrous.finance) aggregation and [Privy](https://privy.io) Server Wallets.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/fibx)
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **Automated Simulation**: All transactions (send, swap, Aave) are simulated on-chain before execution to prevent failures.
|
|
18
|
-
- **JSON Output**: All commands support `--json` for easy integration into scripts and pipelines.
|
|
9
|
+
- **Multi-Chain Support**: Base, Citrea, HyperEVM, and Monad
|
|
10
|
+
- **Token Swaps**: Optimal routing via Fibrous aggregation with auto-slippage
|
|
11
|
+
- **Transfers**: Send ETH or any ERC-20 token
|
|
12
|
+
- **Aave V3**: Supply, borrow, repay, and withdraw on Base
|
|
13
|
+
- **Privy Server Wallets**: Secure server-side signing
|
|
14
|
+
- **Private Key Import**: Use an existing wallet for local execution
|
|
15
|
+
- **Simulation**: All transactions are simulated before execution
|
|
16
|
+
- **JSON Output**: `--json` flag for scripting and pipelines
|
|
19
17
|
|
|
20
18
|
## Requirements
|
|
21
19
|
|
|
22
|
-
- Node.js
|
|
23
|
-
-
|
|
24
|
-
- Privy App ID and Secret (from [dashboard.privy.io](https://dashboard.privy.io))
|
|
20
|
+
- Node.js >= 18
|
|
21
|
+
- A running [fibx-server](https://github.com/ahmetenesdur/fibx-server) instance
|
|
25
22
|
|
|
26
23
|
## Quick Start
|
|
27
24
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
You can use `fibx` without installation via `npx`, or install it globally.
|
|
31
|
-
|
|
32
|
-
**Option A: No Installation (Recommended for Agents)**
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npx fibx <command>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Option B: Global Install**
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install -g fibx
|
|
42
|
-
fibx <command>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Set your Privy credentials as environment variables:
|
|
25
|
+
### Authentication
|
|
46
26
|
|
|
47
27
|
```bash
|
|
48
|
-
|
|
49
|
-
export PRIVY_APP_SECRET="your_app_secret"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. Authenticate & Provision Wallet
|
|
53
|
-
|
|
54
|
-
This two-step process links your email to a server-side wallet.
|
|
55
|
-
|
|
56
|
-
**Step 1: Request OTP**
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npx fibx auth login <email>
|
|
60
|
-
# Example:
|
|
28
|
+
# Email OTP
|
|
61
29
|
npx fibx auth login user@example.com
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Step 2: Verify & Create Session**
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npx fibx auth verify <email> <code>
|
|
68
|
-
# Example:
|
|
69
30
|
npx fibx auth verify user@example.com 123456
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
_Successfully verifying will create a local session file and provision a Server Wallet if one doesn't exist._
|
|
73
|
-
|
|
74
|
-
### 3. Alternative: Import Private Key
|
|
75
31
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```bash
|
|
32
|
+
# Or import a private key
|
|
79
33
|
npx fibx auth import
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
_This will securely prompt for your private key and store it locally in `session.json` for signing transactions._
|
|
83
|
-
|
|
84
|
-
> **Security Note:** Your private key is stored locally on your machine. Ensure your environment is secure.
|
|
85
|
-
|
|
86
|
-
### 4. Logout
|
|
87
|
-
|
|
88
|
-
If you want to clear your local session:
|
|
89
34
|
|
|
90
|
-
|
|
35
|
+
# Logout
|
|
91
36
|
npx fibx auth logout
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### 5. Check Status
|
|
95
37
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```bash
|
|
38
|
+
# Check status
|
|
99
39
|
npx fibx status
|
|
100
40
|
```
|
|
101
41
|
|
|
@@ -103,157 +43,60 @@ npx fibx status
|
|
|
103
43
|
|
|
104
44
|
### Global Options
|
|
105
45
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
**Supported Chains:** `base` (default), `citrea`, `hyperevm`, `monad`
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
npx fibx status --chain monad
|
|
112
|
-
```
|
|
46
|
+
Use `-c` or `--chain` to specify the target chain. Default is `base`.
|
|
113
47
|
|
|
114
|
-
|
|
48
|
+
Supported: `base`, `citrea`, `hyperevm`, `monad`
|
|
115
49
|
|
|
116
|
-
|
|
50
|
+
### Balance
|
|
117
51
|
|
|
118
52
|
```bash
|
|
119
53
|
npx fibx balance
|
|
120
54
|
npx fibx balance --chain citrea
|
|
121
55
|
```
|
|
122
56
|
|
|
123
|
-
### Send
|
|
124
|
-
|
|
125
|
-
Transfer ETH or ERC-20 tokens to another address.
|
|
126
|
-
|
|
127
|
-
**Send ETH (Default):**
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npx fibx send 0.001 0xRecipientAddress
|
|
131
|
-
npx fibx send 1 0xRecipientAddress --chain monad
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Send ERC-20 (e.g., USDC):**
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
npx fibx send 10 0xRecipientAddress USDC
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Swap Tokens
|
|
141
|
-
|
|
142
|
-
Swap tokens using Fibrous Finance's aggregator.
|
|
57
|
+
### Send
|
|
143
58
|
|
|
144
59
|
```bash
|
|
145
|
-
npx fibx
|
|
60
|
+
npx fibx send 0.001 0xRecipient # Send ETH
|
|
61
|
+
npx fibx send 10 0xRecipient USDC # Send ERC-20
|
|
62
|
+
npx fibx send 1 0xRecipient --chain monad # Send on Monad
|
|
146
63
|
```
|
|
147
64
|
|
|
148
|
-
|
|
65
|
+
### Swap
|
|
149
66
|
|
|
150
67
|
```bash
|
|
151
|
-
|
|
68
|
+
npx fibx trade <amount> <from> <to>
|
|
152
69
|
npx fibx trade 0.0001 ETH USDC
|
|
153
|
-
|
|
154
|
-
# Swap 20 USDC to DAI on Base
|
|
155
70
|
npx fibx trade 20 USDC DAI
|
|
156
|
-
|
|
157
|
-
# Swap on Monad (native token handled automatically)
|
|
158
71
|
npx fibx trade 1 MON USDC --chain monad
|
|
159
72
|
```
|
|
160
73
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- `--slippage <number>`: Set slippage tolerance (default: 0.5%)
|
|
164
|
-
- `--approve-max`: Approve maximum amount (infinite approval) instead of exact amount (default: false)
|
|
165
|
-
- `--json`: Output result as JSON
|
|
166
|
-
|
|
167
|
-
### Check Transaction Status
|
|
74
|
+
Options: `--slippage <n>` (default: 0.5%), `--approve-max`, `--json`
|
|
168
75
|
|
|
169
|
-
|
|
76
|
+
### Transaction Status
|
|
170
77
|
|
|
171
78
|
```bash
|
|
172
79
|
npx fibx tx-status <hash>
|
|
173
|
-
|
|
174
|
-
npx fibx tx-status 0x123...abc
|
|
175
|
-
npx fibx tx-status 0x456...def --chain monad
|
|
80
|
+
npx fibx tx-status 0x123...abc --chain monad
|
|
176
81
|
```
|
|
177
82
|
|
|
178
|
-
###
|
|
179
|
-
|
|
180
|
-
Print your connected wallet address (Privy or Local):
|
|
83
|
+
### Wallet Info
|
|
181
84
|
|
|
182
85
|
```bash
|
|
183
|
-
npx fibx address
|
|
86
|
+
npx fibx address # Print wallet address
|
|
87
|
+
npx fibx wallets <email> # List active wallet
|
|
184
88
|
```
|
|
185
89
|
|
|
186
|
-
###
|
|
187
|
-
|
|
188
|
-
List all wallets linked to a Privy user email:
|
|
90
|
+
### Aave V3 (Base)
|
|
189
91
|
|
|
190
92
|
```bash
|
|
191
|
-
npx fibx
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Interact with the Aave V3 lending protocol on the Base network.
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
npx fibx aave <action> [amount] [token]
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Actions:**
|
|
203
|
-
|
|
204
|
-
- `status`: Check account health (Health Factor, LTV, Net Worth)
|
|
205
|
-
- `supply`: Deposit assets to earn yield
|
|
206
|
-
- `borrow`: Borrow assets (requires collateral)
|
|
207
|
-
- `repay`: Repay debt (use `max` as amount to repay all)
|
|
208
|
-
- `withdraw`: Withdraw assets (use `max` as amount to withdraw all)
|
|
209
|
-
|
|
210
|
-
**Examples:**
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
npx fibx aave status
|
|
214
|
-
npx fibx aave supply 100 USDC
|
|
215
|
-
npx fibx aave repay max USDC
|
|
216
|
-
npx fibx aave withdraw max USDC
|
|
93
|
+
npx fibx aave status # Account health
|
|
94
|
+
npx fibx aave supply 100 USDC # Deposit
|
|
95
|
+
npx fibx aave borrow 50 USDC # Borrow
|
|
96
|
+
npx fibx aave repay max USDC # Repay all
|
|
97
|
+
npx fibx aave withdraw max USDC # Withdraw all
|
|
217
98
|
```
|
|
218
99
|
|
|
219
100
|
## Agent Skills
|
|
220
101
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
Check out the [fibx-skills](./fibx-skills) directory for:
|
|
224
|
-
|
|
225
|
-
- **authenticate-wallet** — Email OTP login and private key import
|
|
226
|
-
- **balance** — Check wallet balances on any supported chain
|
|
227
|
-
- **send** — Send ETH or ERC-20 tokens
|
|
228
|
-
- **trade** — Swap tokens via Fibrous aggregation
|
|
229
|
-
- **aave** — Manage Aave V3 positions (Supply, Borrow, Repay, Withdraw)
|
|
230
|
-
- **tx-status** — Verify transaction status and get explorer links
|
|
231
|
-
|
|
232
|
-
## Development
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
git clone https://github.com/ahmetenesdur/fibx.git
|
|
236
|
-
cd fibx
|
|
237
|
-
pnpm install
|
|
238
|
-
cp .env.example .env # Add your PRIVY_APP_ID and PRIVY_APP_SECRET
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
**Available Scripts:**
|
|
242
|
-
|
|
243
|
-
| Script | Description |
|
|
244
|
-
| ---------------- | ---------------------------------- |
|
|
245
|
-
| `pnpm dev <cmd>` | Run a command in development mode |
|
|
246
|
-
| `pnpm build` | Compile TypeScript to `dist/` |
|
|
247
|
-
| `pnpm typecheck` | Run type checking without emitting |
|
|
248
|
-
| `pnpm lint` | Lint source files with ESLint |
|
|
249
|
-
| `pnpm format` | Format code with Prettier |
|
|
250
|
-
|
|
251
|
-
## Architecture
|
|
252
|
-
|
|
253
|
-
This CLI uses a **Hybrid Wallet** architecture:
|
|
254
|
-
|
|
255
|
-
1. **Authentication**:
|
|
256
|
-
- **Privy**: Uses "Agentic" server-side wallets (ownerless) for automated signing.
|
|
257
|
-
- **Local Key**: Direct private key import for standard execution without external dependencies.
|
|
258
|
-
2. **Viem**: Handles all blockchain interactions (RPC calls, transaction signing) using a unified `WalletClient` interface, abstracting away the underlying signer (Privy vs. Local).
|
|
259
|
-
3. **Fibrous**: Provides the routing and calldata for optimal token swaps on all supported chains, encapsulated in the `services/fibrous` module.
|
|
102
|
+
For AI agent integration, see the [fibx-skills](./fibx-skills) directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjG,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjG,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxF"}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { apiLogin } from "../../services/api/client.js";
|
|
2
2
|
import { outputResult, outputError, withSpinner } from "../../lib/format.js";
|
|
3
3
|
export async function authLoginCommand(email, opts) {
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
await withSpinner("Sending OTP...", async () => {
|
|
7
|
-
const appId = process.env.PRIVY_APP_ID;
|
|
8
|
-
const appSecret = process.env.PRIVY_APP_SECRET;
|
|
9
|
-
const credentials = Buffer.from(`${appId}:${appSecret}`).toString("base64");
|
|
10
|
-
const res = await fetch("https://auth.privy.io/api/v1/passwordless/init", {
|
|
11
|
-
method: "POST",
|
|
12
|
-
headers: {
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
Authorization: `Basic ${credentials}`,
|
|
15
|
-
"privy-app-id": appId,
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({ email }),
|
|
18
|
-
});
|
|
19
|
-
if (!res.ok) {
|
|
20
|
-
const body = await res.text().catch(() => "");
|
|
21
|
-
throw new Error(`OTP init failed (${res.status}): ${body}`);
|
|
22
|
-
}
|
|
23
|
-
return res.json();
|
|
24
|
-
}, opts);
|
|
5
|
+
await withSpinner("Sending OTP...", async () => apiLogin(email), opts);
|
|
25
6
|
outputResult({
|
|
26
7
|
email,
|
|
27
8
|
message: `OTP sent to ${email}. Run: fibx auth verify ${email} <code>`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAsB,MAAM,qBAAqB,CAAC;AAEjG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAa,EAAE,IAAmB;IACxE,IAAI,CAAC;QACJ,MAAM,WAAW,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAEvE,YAAY,CACX;YACC,KAAK;YACL,OAAO,EAAE,eAAe,KAAK,2BAA2B,KAAK,SAAS;SACtE,EACD,IAAI,CACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/verify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/verify.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjG,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCf"}
|
|
@@ -1,56 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { apiVerify } from "../../services/api/client.js";
|
|
2
2
|
import { saveSession } from "../../services/auth/session.js";
|
|
3
3
|
import { outputResult, outputError, withSpinner } from "../../lib/format.js";
|
|
4
4
|
export async function authVerifyCommand(email, code, opts) {
|
|
5
5
|
try {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const appSecret = process.env.PRIVY_APP_SECRET;
|
|
10
|
-
const credentials = Buffer.from(`${appId}:${appSecret}`).toString("base64");
|
|
11
|
-
const res = await fetch("https://auth.privy.io/api/v1/passwordless/authenticate", {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
"Content-Type": "application/json",
|
|
15
|
-
Authorization: `Basic ${credentials}`,
|
|
16
|
-
"privy-app-id": appId,
|
|
17
|
-
},
|
|
18
|
-
body: JSON.stringify({ email, code }),
|
|
19
|
-
});
|
|
20
|
-
if (!res.ok) {
|
|
21
|
-
const body = await res.text().catch(() => "");
|
|
22
|
-
throw new Error(`OTP verify failed (${res.status}): ${body}`);
|
|
23
|
-
}
|
|
24
|
-
const data = (await res.json());
|
|
25
|
-
return { userId: data.user.id, userToken: data.privy_access_token };
|
|
26
|
-
}, opts);
|
|
27
|
-
// Check for existing wallet
|
|
28
|
-
const existingWallet = await withSpinner("Checking for existing wallet...", async () => findExistingWallet(privy, email), opts);
|
|
29
|
-
let wallet;
|
|
30
|
-
let isExisting;
|
|
31
|
-
if (existingWallet) {
|
|
32
|
-
wallet = existingWallet;
|
|
33
|
-
isExisting = true;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// Create new server wallet
|
|
37
|
-
wallet = await withSpinner("Creating server wallet...", async () => createAgentWallet(privy), opts);
|
|
38
|
-
// Link wallet to user
|
|
39
|
-
await withSpinner("Linking wallet to user...", async () => saveWalletIdToUser(privy, userId, wallet.id), opts);
|
|
40
|
-
isExisting = false;
|
|
41
|
-
}
|
|
6
|
+
// 1. Verify OTP + provision wallet via backend
|
|
7
|
+
const result = await withSpinner("Verifying OTP...", async () => apiVerify(email, code), opts);
|
|
8
|
+
// 2. Save session locally (store backend JWT instead of Privy token)
|
|
42
9
|
await saveSession({
|
|
43
|
-
userId,
|
|
44
|
-
walletId:
|
|
45
|
-
walletAddress:
|
|
46
|
-
userJwt:
|
|
10
|
+
userId: result.userId,
|
|
11
|
+
walletId: result.walletId,
|
|
12
|
+
walletAddress: result.walletAddress,
|
|
13
|
+
userJwt: result.token,
|
|
47
14
|
createdAt: new Date().toISOString(),
|
|
48
15
|
type: "privy",
|
|
49
16
|
});
|
|
50
17
|
outputResult({
|
|
51
|
-
walletAddress:
|
|
52
|
-
walletId:
|
|
53
|
-
message: isExisting
|
|
18
|
+
walletAddress: result.walletAddress,
|
|
19
|
+
walletId: result.walletId,
|
|
20
|
+
message: result.isExisting
|
|
54
21
|
? "Existing wallet found and connected. You're ready to go!"
|
|
55
22
|
: "New wallet created and session saved. You're ready to go!",
|
|
56
23
|
}, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/commands/auth/verify.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/commands/auth/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAsB,MAAM,qBAAqB,CAAC;AAEjG,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACtC,KAAa,EACb,IAAY,EACZ,IAAmB;IAEnB,IAAI,CAAC;QACJ,+CAA+C;QAC/C,MAAM,MAAM,GAAG,MAAM,WAAW,CAC/B,kBAAkB,EAClB,KAAK,IAAI,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,EAClC,IAAI,CACJ,CAAC;QAEF,qEAAqE;QACrE,MAAM,WAAW,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,aAAa,EAAE,MAAM,CAAC,aAA8B;YACpD,OAAO,EAAE,MAAM,CAAC,KAAK;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,IAAI,EAAE,OAAO;SACb,CAAC,CAAC;QAEH,YAAY,CACX;YACC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,UAAU;gBACzB,CAAC,CAAC,0DAA0D;gBAC5D,CAAC,CAAC,2DAA2D;SAC9D,EACD,IAAI,CACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
|
@@ -89,12 +89,10 @@ function isValidAction(action) {
|
|
|
89
89
|
async function attemptSessionLogin(aave, chainConfig) {
|
|
90
90
|
try {
|
|
91
91
|
const { loadSession } = await import("../../services/auth/session.js");
|
|
92
|
-
const { getPrivyClient } = await import("../../services/privy/client.js");
|
|
93
92
|
const { getWalletClient } = await import("../../services/chain/client.js");
|
|
94
93
|
const session = loadSession();
|
|
95
94
|
if (session) {
|
|
96
|
-
const
|
|
97
|
-
const walletClient = getWalletClient(privy, session, chainConfig);
|
|
95
|
+
const walletClient = getWalletClient(session, chainConfig);
|
|
98
96
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
97
|
aave.setWalletClient(walletClient);
|
|
100
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
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CAAC,IAAI,CAAC,IAAI,EAAE,CACrB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAC5B,IAAiB,EACjB,KAAY,EACZ,MAAc,EACd,OAAY,EACZ,IAAmB,EACnB,cAAuB,KAAK;IAE5B,OAAO,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC5C,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAkB,EAAE,MAAM,CAAC,CAAC;IAEjE,IAAI,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,GAAG,2BAA2B,CAAC;QAC3C,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC/C,CAAC;IAED,YAAY,CACX;QACC,MAAM,EAAE,UAAU;QAClB,MAAM;QACN,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;QACrD,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,MAAM;KACb,EACD,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CACrB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../src/commands/trade/swap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../src/commands/trade/swap.ts"],"names":[],"mappings":"AAUA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjG,UAAU,YAAa,SAAQ,aAAa;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,YAAY,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,YAAY,GAChB,OAAO,CAAC,IAAI,CAAC,CA0If"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { requireSession } from "../../services/auth/session.js";
|
|
2
|
-
import { getPrivyClient } from "../../services/privy/client.js";
|
|
3
2
|
import { getWalletClient, getPublicClient } from "../../services/chain/client.js";
|
|
4
3
|
import { getChainConfig } from "../../services/chain/constants.js";
|
|
5
4
|
import { getAllowance, encodeApprove } from "../../services/chain/erc20.js";
|
|
@@ -16,8 +15,7 @@ export async function tradeCommand(amount, from, to, opts) {
|
|
|
16
15
|
const chainName = globalOpts.chain || "base";
|
|
17
16
|
const chain = getChainConfig(chainName);
|
|
18
17
|
const session = requireSession();
|
|
19
|
-
const
|
|
20
|
-
const walletClient = getWalletClient(privy, session, chain);
|
|
18
|
+
const walletClient = getWalletClient(session, chain);
|
|
21
19
|
const publicClient = getPublicClient(chain);
|
|
22
20
|
const wallet = session.walletAddress;
|
|
23
21
|
const [tokenIn, tokenOut] = await withSpinner(`Resolving tokens on ${chain.name}...`, async () => Promise.all([resolveToken(from, chain), resolveToken(to, chain)]), opts);
|
|
@@ -38,22 +36,36 @@ export async function tradeCommand(amount, from, to, opts) {
|
|
|
38
36
|
if (currentAllowance < amountBaseUnits) {
|
|
39
37
|
await withSpinner("Approving token spend...", async () => {
|
|
40
38
|
const amountToApprove = opts.approveMax
|
|
41
|
-
? 115792089237316195423570985008687907853269984665640564039457584007913129639935n
|
|
39
|
+
? 115792089237316195423570985008687907853269984665640564039457584007913129639935n
|
|
42
40
|
: amountBaseUnits;
|
|
43
41
|
const approveData = encodeApprove(routerAddress, amountToApprove);
|
|
44
|
-
|
|
42
|
+
const approveTxHash = await walletClient.sendTransaction({
|
|
45
43
|
to: tokenIn.address,
|
|
46
44
|
data: approveData,
|
|
47
45
|
value: 0n,
|
|
48
46
|
});
|
|
47
|
+
await publicClient.waitForTransactionReceipt({
|
|
48
|
+
hash: approveTxHash,
|
|
49
|
+
confirmations: 1,
|
|
50
|
+
});
|
|
51
|
+
// Wait for allowance to be updated on-chain (handle RPC lag)
|
|
52
|
+
let retries = 0;
|
|
53
|
+
const maxRetries = 15; // 30 seconds max
|
|
54
|
+
while (retries < maxRetries) {
|
|
55
|
+
const newAllowance = await getAllowance(publicClient, tokenIn.address, wallet, routerAddress);
|
|
56
|
+
if (newAllowance >= amountToApprove) {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
60
|
+
retries++;
|
|
61
|
+
}
|
|
62
|
+
return approveTxHash;
|
|
49
63
|
}, opts);
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
const hash = await withSpinner(`Swapping ${amount} ${tokenIn.symbol} → ${tokenOut.symbol}...`, async () => {
|
|
53
67
|
const swapData = encodeSwapCalldata(routeData.calldata, chain);
|
|
54
68
|
const value = isNativeInput ? amountBaseUnits : 0n;
|
|
55
|
-
// Simulate Swap (using estimateGas as we have raw calldata)
|
|
56
|
-
// We use call/estimateGas to ensure it doesn't revert
|
|
57
69
|
try {
|
|
58
70
|
await publicClient.estimateGas({
|
|
59
71
|
account: wallet,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../../src/commands/trade/swap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../../src/commands/trade/swap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,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CAAC;YACH,CAAC;YAED,OAAO,YAAY,CAAC,eAAe,CAAC;gBACnC,EAAE,EAAE,aAAa;gBACjB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK;aACZ,CAAC,CAAC;QACJ,CAAC,EACD,IAAI,CACJ,CAAC;QAEF,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE3F,YAAY,CACX;YACC,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE,OAAO,CAAC,MAAM;YACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,KAAK,CAAC,IAAI;SACjB,EACD,IAAI,CACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type OutputOptions } from "../../lib/format.js";
|
|
2
|
-
export declare function walletsCommand(
|
|
2
|
+
export declare function walletsCommand(_email: string, opts: OutputOptions): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/wallet/list.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/wallet/list.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpF,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvF"}
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { outputResult, outputError
|
|
3
|
-
export async function walletsCommand(
|
|
1
|
+
import { loadSession } from "../../services/auth/session.js";
|
|
2
|
+
import { outputResult, outputError } from "../../lib/format.js";
|
|
3
|
+
export async function walletsCommand(_email, opts) {
|
|
4
4
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (wallets.length === 0) {
|
|
9
|
-
outputResult({ message: "No wallets found for this user." }, opts);
|
|
5
|
+
const session = loadSession();
|
|
6
|
+
if (!session) {
|
|
7
|
+
outputResult({ message: "No active session. Run `fibx auth login <email>` first." }, opts);
|
|
10
8
|
return;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
firstVerifiedAt: w.first_verified_at
|
|
19
|
-
? new Date(w.first_verified_at * 1000).toISOString()
|
|
20
|
-
: "N/A",
|
|
21
|
-
}));
|
|
10
|
+
const walletInfo = {
|
|
11
|
+
address: session.walletAddress,
|
|
12
|
+
id: session.walletId ?? "N/A",
|
|
13
|
+
type: session.type,
|
|
14
|
+
createdAt: session.createdAt,
|
|
15
|
+
};
|
|
22
16
|
if (opts.json) {
|
|
23
|
-
console.log(JSON.stringify(
|
|
17
|
+
console.log(JSON.stringify([walletInfo], null, 2));
|
|
24
18
|
}
|
|
25
19
|
else {
|
|
26
|
-
console.log(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
console.log(`Type: ${w.connectorType} (${w.chainType})`);
|
|
32
|
-
});
|
|
20
|
+
console.log("Active wallet:");
|
|
21
|
+
console.log(`\nAddress: ${walletInfo.address}`);
|
|
22
|
+
console.log(`ID: ${walletInfo.id}`);
|
|
23
|
+
console.log(`Type: ${walletInfo.type}`);
|
|
24
|
+
console.log(`Created: ${walletInfo.createdAt}`);
|
|
33
25
|
}
|
|
34
26
|
}
|
|
35
27
|
catch (error) {
|