What You’ll Build
A CLI wallet tracker that:- Fetches all token holdings across every chain (EVM + Solana)
- Shows current USD value and 24h PnL per token
- Displays total portfolio value and overall PnL
Prerequisites
- Node.js 18+
- A Mobula API key (free at docs.mobula.io)
Step 1: Install the SDK
Step 2: Fetch the Portfolio
Step 3: Display the Results
Step 4: Run It
What the API Returns
The/api/2/wallet/portfolio endpoint gives you:
total_wallet_balance— total USD value across all chainstotal_realized_pnl— realized PnL since first tracked transactionassets[]— array of token holdings, each with:asset.symbol,asset.name,asset.logotoken_balance— raw token amountestimated_balance— USD valuerealized_pnl,unrealized_pnlasset.blockchains— which chains the token exists on
Add Historical Balance
Want to show a balance chart over time? One more call:Deploy as an API
Wrap it in a simple Express server:Next Steps
- Add DeFi positions —
/api/2/wallet/defi-positionsfor LP, lending, and staking - Track new wallets in real-time — subscribe via WebSocket for live balance updates
- Label wallets —
/api/2/wallet/labelsreturns exchange labels, whale tags, and insider flags