1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Read-Only Wallet Lookup — Session Notes
**Date:** 2026-06-17
**Goal:** Add read-only Hyperliquid wallet lookup for `0xA12b193832d401A1B5f738170631fD6547aF3C3F` — no private key needed.
## What was done
### 1. Backend endpoint (`/home/darkbot/ai/vaultmind-ai/backend/main.py`)
- Added `GET /wallet/{address}` — uses `hl_client.info` (no key required)
- Returns: `account_value`, `margin_used`, `withdrawable`, `positions[]` (coin, size, entry_px, pnl, market)
- Hardcoded `mainnet1` for the read-only endpoint (was hitting testnet)
- Cache: `Cache-Control: public, max-age=5`
### 2. Nginx proxy
- Added `location /wallet/` → `http://127.0.0.1:8000/wallet/`
- **Bug:** The nginx config was corrupted — `/vmai/` block missing closing `}`, `/vmai-api/` nested inside it, 7 duplicate `/wallet/` blocks from repeated patch attempts. Rewrote the entire file cleanly.
- **Important:** `/etc/nginx/sites-enabled/webx11.duckdns.org` is a **regular file** (not a symlink to sites-available). Both files must be kept in sync.
### 3. AI tool (`module-aiassist.js` + `core-bundle.js`)
- Added `wallet_lookup` tool: schema + handler + system prompt
- Usage: `ai show wallet 0xA12b...3C3F`
- Tool calls `GET /wallet/{address}` via `web_fetch`
### 4. Stale `.pyc` fix
- `find /home/darkbot/ai/vaultmind-ai/ -name '*.pyc' -delete` after adding new route
- Without this, the running process doesn't see the new endpoint
## Files changed
- `backend/main.py` — new `/wallet/{address}` route
- `module-aiassist.js` — `wallet_lookup` tool def + handler + system prompt
- `core-bundle.js` — same changes in bundled copy
- `/etc/nginx/sites-enabled/webx11.duckdns.org` — added `/wallet/` proxy
- `/etc/nginx/sites-available/webx11.duckdns.org` — synced
## Verification
```bash
curl -s https://webx11.duckdns.org/wallet/0xA12b193832d401A1B5f738170631fD6547aF3C3F
```
Returns: $11.67 equity, 4 positions (BTC, NEAR, FIL, TAO)
## Key lessons
- Nginx sites-enabled is a regular file, not a symlink — edit both
- Stale `.pyc` hides new routes — always clear after adding endpoints
- Read-only Hyperliquid queries use `Info` class, no key needed
- The stored key (`0x0e80...055c`) controls a different wallet (`0x6cB4...1Aa2`, empty) — not the user's trading wallet
|