[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-93304":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":22,"readmeContent":23,"aiSummary":24,"trendingCount":15,"starSnapshotCount":15,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},93304,"solana-defi-positions-api","vybenetwork\u002Fsolana-defi-positions-api","vybenetwork","Solana DeFi Positions API","https:\u002F\u002Fdocs.vybenetwork.com",null,"JavaScript",218,84,94,0,15,51.79,false,"main",true,[],"2026-07-22 04:02:08","# Solana DeFi Positions API\n\n\u003Cp align=\"center\">\n\n[![Demo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDemo-Solana%20DeFi%20Positions%20API%20live%20app-c2410c?style=for-the-badge&logo=googlechrome&logoColor=white)](https:\u002F\u002Fsolana-defi-positions-api.vybenetwork.com)\n[![GitHub](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGitHub-Repository-5b21b6?style=for-the-badge&logo=github&logoColor=white)](https:\u002F\u002Fgithub.com\u002Fvybenetwork\u002Fsolana-defi-positions-api)\n[![DeFi positions guide](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGuides-Lend%20%26%20LP%20positions-3b82f6?style=for-the-badge&logo=gitbook&logoColor=white)](https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Fpositions-yields-staking)\n[![DeFi positions API](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FEndpoint-DeFi%20positions-6366f1?style=for-the-badge&logo=swagger&logoColor=white)](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_defi_accounts_v4_proxy)\n[![Wallet token balance API](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FEndpoint-Wallet%20token%20balance-8b5cf6?style=for-the-badge&logo=swagger&logoColor=white)](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_wallet_tokens_v4)\n[![X](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FX-Vybe__Network-000000?style=for-the-badge&logo=x)](https:\u002F\u002Fx.com\u002FVybe_Network)\n\u003C\u002Fp>\n\n**Solana DeFi Positions API:** Solana DeFi positions API for LPs, lending, staking & yield farming across 50+ protocols. SonarWatch alternative wallet tracker powered by the Vybe API. Use this project as a reference implementation or starter kit for portfolio trackers, DeFi dashboards, and protocol exposure UIs.\n\nIt includes a production-ready Node.js backend and a modern frontend that integrate Vybe’s DeFi positions and wallet token-balance endpoints—explore platform cards, position tables, APY badges, USD magnitude indicators, and symbol enrichment for LP \u002F lending \u002F staking rows.\n\nTry the live demo: https:\u002F\u002Fsolana-defi-positions-api.vybenetwork.com\n\n![Solana DeFi Positions API app](screenshots\u002Fsolana-defi-positions-api-app-demo.jpg)\n\n---\n\n- **[Try the LIVE demo →](https:\u002F\u002Fsolana-defi-positions-api.vybenetwork.com)**\n- **[Get your free Vybe API key →](https:\u002F\u002Fvybe.fyi\u002Fapi-pricing)**\n- **[Positions (lending & LPs) guide →](https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Fpositions-yields-staking)**\n- **[Realtime wallet balances guide →](https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Ftoken-balances)**\n- **[DeFi positions endpoint →](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_defi_accounts_v4_proxy)**\n- **[Wallet token balance endpoint →](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_wallet_tokens_v4)**\n- **[GitHub repo →](https:\u002F\u002Fgithub.com\u002Fvybenetwork\u002Fsolana-defi-positions-api)**\n- **[Telegram →](https:\u002F\u002Ft.me\u002FVybeNetwork_Official)**\n- **[X →](https:\u002F\u002Fx.com\u002FVybe_Network)**\n\n---\n\n## Prerequisites\n\n- **Node.js** ≥ 20 (LTS recommended)\n- **npm** ≥ 10 (or equivalent)\n\n## Quick Start\n\nGet from clone to running app in a few commands:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvybenetwork\u002Fsolana-defi-positions-api.git\ncd solana-defi-positions-api\nnpm install\ncp .env.example .env\n# Edit .env: set VYBE_DATA_API_KEY (required)\nnpm start\n```\n\nThen open **http:\u002F\u002Flocalhost:3001**, paste a Solana wallet address, and load DeFi positions. The UI groups LP, lending, staking, and yield positions by protocol with USD totals and optional wallet-balance context.\n\n## Environment Variables\n\n| Variable | Required | Description | Example |\n|----------|----------|-------------|---------|\n| `VYBE_DATA_API_KEY` | Yes | Key for wallets\u002Ftokens\u002FDeFi (`VYBE_DATA_API_BASE`) | `your_api_key_here` |\n| `VYBE_DATA_API_BASE` | No | Vybe data API base | `https:\u002F\u002Fapi.vybenetwork.xyz` |\n| `HELIUS_API_KEY` | No | Helius RPC key (used when `SOLANA_RPC_URL` unset) | `your_helius_key` |\n| `SOLANA_RPC_URL` | No | Full RPC URL override (wins over `HELIUS_API_KEY`) | `https:\u002F\u002Fapi.mainnet-beta.solana.com` |\n| `PORT` | No | HTTP server port (default `3001`) | `3001` |\n| `PROXY_HOST` + `PROXY_AUTH` | No | HTTP proxy for Jupiter \u002F pump.fun enrichment | `geo.iproyal.com:12321` |\n| `PUMPFUN_AUTH_TOKEN` | No | Optional pump.fun JWT | `your_jwt` |\n| `HTTP_PROXY_POOL_SIZE` | No | Rotating proxy slot count | `10` |\n| `HTTP_PROXY_WARMUP` | No | Warm Jupiter\u002Fpump.fun at startup | `true` |\n\nGet your API keys at `https:\u002F\u002Fvybe.fyi\u002Fapi-pricing`.\n\n---\n\n## What This Repo Provides\n\n- **DeFi positions + wallet balances proxy**\n  - Express server that proxies \u002F enriches Vybe:\n    - `GET \u002Fv4\u002Fwallets\u002F{ownerAddress}\u002Fdefi-positions` (LP, lending, staking, yield across protocols)\n    - `GET \u002Fv4\u002Fwallets\u002F{ownerAddress}\u002Ftoken-balance` (wallet holdings alongside DeFi exposure)\n    - `GET \u002Fv4\u002Ftokens\u002F{mintAddress}` (token metadata + price fields for symbol enrichment)\n- **Symbol enrichment**\n  - Hydrates missing pool\u002Fasset symbols from disk cache + sequential Vybe\u002FJupiter\u002Fpump.fun enrichment.\n- **DeFi positions web UI**\n  - Single-page GUI (no frameworks) in `public\u002F` — category cards, platform sections, position tables, APY badges, USD magnitude bars, and related-demo links.\n\n---\n\n### Solana API docs for these endpoints\n\n- **Positions \u002F lending & LPs (guides)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Fpositions-yields-staking](https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Fpositions-yields-staking)\n- **Realtime wallet balances (guides)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Ftoken-balances](https:\u002F\u002Fdocs.vybenetwork.com\u002Fdocs\u002Ftoken-balances)\n- **DeFi positions (`GET \u002Fv4\u002Fwallets\u002F{ownerAddress}\u002Fdefi-positions`)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_defi_accounts_v4_proxy](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_defi_accounts_v4_proxy)\n- **Wallet token balance (`GET \u002Fv4\u002Fwallets\u002F{ownerAddress}\u002Ftoken-balance`)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_wallet_tokens_v4](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_wallet_tokens_v4)\n- **Token details (`GET \u002Fv4\u002Ftokens\u002F{mintAddress}`)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_token_details_v4](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_token_details_v4)\n- **Token trade history (`GET \u002Fv4\u002Ftrades`)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_trade_data_program_v4](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_trade_data_program_v4)\n- **Labeled programs (`GET \u002Fv4\u002Fprograms\u002Flabeled-program-accounts`)**:\n  - [https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_known_program_accounts_v4](https:\u002F\u002Fdocs.vybenetwork.com\u002Freference\u002Fget_known_program_accounts_v4)\n\n---\n\n## Why DeFi Position APIs Matter\n\nDeFi position APIs are critical for:\n\n- **Portfolio trackers**: show LP, lending, and staking exposure beyond liquid wallet balances.\n- **Protocol risk views**: group positions by platform and category with USD totals.\n- **Yield surfaces**: surface APY when available and call out missing \u002F zero APY clearly.\n- **Enrichment**: resolve pool asset symbols and logos for readable tables.\n\nThis repo shows how to build a **practical DeFi positions explorer** on top of Vybe’s wallet DeFi and token endpoints.\n\n---\n\n## Server Proxy Routes\n\nThe Express server in `src\u002Fserver.ts` exposes:\n\n- **`GET \u002Fapi\u002Fwallets\u002F:ownerAddress\u002Fdefi-positions`**\n  - LP \u002F lending \u002F staking \u002F yield positions with optional symbol enrichment.\n- **`GET \u002Fapi\u002Fwallets\u002F:ownerAddress\u002Ftoken-balances`**\n  - Query: `limit`, `stream`, `enrich`, `enrichLimit` — wallet SPL holdings.\n- **`GET \u002Fapi\u002Ftoken\u002F:mint`**\n  - Resolve token metadata and USD price for a single mint.\n- **`GET \u002Fhealth`**\n  - Service status and configured backends.\n- **`GET \u002Fcached\u002Ftoken-icons\u002F*`**\n  - Cached token icon assets.\n\nAll Vybe requests use a shared client (`src\u002Fapi\u002Fclient.ts`) with timeouts, retries, and human-readable errors (`toHumanReadableError`).\n\n---\n\n## npm Scripts\n\n| Script | Description |\n|--------|-------------|\n| `npm start` \u002F `npm run dev` | Run Express server (`tsx src\u002Fserver.ts`) |\n| `npm run build` | Compile TypeScript → `dist\u002F` |\n| `npm run typecheck` | Typecheck without emit |\n| `npm run dump:vybe-wallet` | Dump raw Vybe wallet token-balance for a wallet |\n| `npm run deploy:vm` \u002F `npm run redeploy:vm` | Production VM deploy helpers |\n\n---\n\n## How to Run\n\n### 1. Clone the repository\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvybenetwork\u002Fsolana-defi-positions-api.git\ncd solana-defi-positions-api\n```\n\n### 2. Install dependencies\n\n```bash\nnpm install\n```\n\n### 3. Set your API key\n\n```bash\ncp .env.example .env\n# Set VYBE_DATA_API_KEY\n```\n\n### 4. Run the server + web app\n\n```bash\nnpm start\n```\n\nThen open **http:\u002F\u002Flocalhost:3001**. Paste a wallet address and load DeFi positions to inspect protocol cards, position rows, and USD totals.\n\n---\n\n## Project Structure\n\n```text\nsolana-defi-positions-api\u002F\n├── .env.example           # Copy to .env — VYBE_DATA_API_KEY, optional HELIUS \u002F RPC \u002F proxy\n├── package.json\n├── README.md\n├── screenshots\u002F           # Screenshots referenced in this README\n├── public\u002F                # Web GUI (HTML, CSS, JS)\n│   ├── index.html\n│   ├── app.css\n│   ├── app.js\n│   ├── defi-positions.js\n│   ├── solana-defi-positions-api.jpg\n│   └── …\n├── tools\u002F                 # Dump \u002F benchmark helpers\n└── src\u002F\n    ├── server.ts          # Express server; proxies Vybe API and serves public\u002F\n    ├── config.ts\n    ├── token-icon-cache.ts\n    ├── types\u002F\n    └── api\u002F\n        ├── client.ts\n        ├── wallet-defi-positions.ts\n        ├── wallet-balance.ts\n        ├── enrich-defi-symbols.ts\n        ├── hydrate-defi-symbols.ts\n        ├── tokens.ts\n        ├── resolve-token-meta.ts\n        └── …\n```\n\n---\n\n## Direct API Usage Example\n\n```typescript\nconst base = 'http:\u002F\u002Flocalhost:3001';\nconst owner = 'YOUR_WALLET_PUBKEY';\n\nconst res = await fetch(`${base}\u002Fapi\u002Fwallets\u002F${owner}\u002Fdefi-positions`);\nconst positions = await res.json();\nconsole.log(positions);\n```\n\nOr call Vybe directly:\n\n```typescript\nimport axios from 'axios';\n\nconst API = 'https:\u002F\u002Fapi.vybenetwork.xyz';\nconst headers = { 'X-API-KEY': process.env.VYBE_DATA_API_KEY!, Accept: 'application\u002Fjson' };\n\nasync function fetchDefiPositions(ownerAddress: string) {\n  const { data } = await axios.get(`${API}\u002Fv4\u002Fwallets\u002F${ownerAddress}\u002Fdefi-positions`, {\n    headers,\n  });\n  return data;\n}\n```\n\n---\n\n## Troubleshooting\n\n| Issue | What to do |\n|-------|------------|\n| **403 Forbidden** | Verify `VYBE_DATA_API_KEY` in `.env` is correct and has wallet\u002FDeFi access. |\n| **Empty positions** | Confirm the wallet has LP\u002Flending\u002Fstaking exposure; the DeFi route is beta and coverage varies by protocol. |\n| **Missing symbols \u002F logos** | Allow enrichment to finish; check proxy env if Jupiter\u002Fpump.fun outbound calls are blocked. |\n| **Slow responses \u002F timeouts** | Retry later or load wallet balances separately with a lower `limit`. |\n| **Missing env vars** | Ensure you copied `.env.example` to `.env` and set `VYBE_DATA_API_KEY`. |\n\n---\n\n## Support\n\n- **Telegram:** [VybeNetwork Official](https:\u002F\u002Ft.me\u002FVybeNetwork_Official)\n- **X:** [@Vybe_Network](https:\u002F\u002Fx.com\u002FVybe_Network)\n- **GitHub:** [solana-defi-positions-api](https:\u002F\u002Fgithub.com\u002Fvybenetwork\u002Fsolana-defi-positions-api)\n- **Support ticket:** [Submit a ticket via vybenetwork.com](https:\u002F\u002Fvybenetwork.com)\n","这是一个面向Solana生态的DeFi资产组合追踪API服务，用于聚合用户在50+协议中的流动性挖矿、借贷、质押及收益农耕头寸。核心功能包括统一查询钱包DeFi头寸、实时代币余额、APY计算、USD价值估算及资产符号标准化；技术上基于Node.js实现，提供生产就绪的后端与可视化前端参考模板。适用于构建DeFi仪表盘、投资组合分析工具、协议风险暴露监控等场景。",2,"2026-07-16 02:30:02","CREATED_QUERY"]