This document explains how to configure the data source used by the Backpack extension for fetching Solana token balances and pricing.
The extension supports two modes for Solana token data:
-
Official Backpack GraphQL API (default - NEW in PR #2)
- URL:
https://backpack-api.xnfts.dev/v2/graphql - Provides official Backpack token data with real-time pricing
- Solana: Gets pricing from Backpack API
- X1: Still uses X1 JSON Server
- URL:
-
X1 JSON Server (old behavior - PRE PR #2)
- URL:
http://162.250.126.66:4000 - Uses your local/custom server for ALL data
- Solana: Gets pricing from X1 JSON Server
- X1: Gets pricing from X1 JSON Server
- URL:
Before PR #2:
- Solana queries → X1 JSON Server (your server)
- X1 queries → X1 JSON Server (your server)
After PR #2 (current default):
- Solana queries → Backpack GraphQL API (official API)
- X1 queries → X1 JSON Server (your server)
This toggle restores the old behavior if needed.
Configuration is in: packages/common/src/constants.ts
To switch between X1 JSON Server and Backpack GraphQL API for Solana:
-
Open
packages/common/src/constants.ts -
Find the
USE_X1_JSON_SERVER_FOR_SOLANAconstant (around line 451):
// Toggle: Set to true to use X1 JSON Server for Solana queries (old behavior, pre-PR #2)
// Set to false to use official Backpack GraphQL API for Solana queries (new behavior, PR #2)
export const USE_X1_JSON_SERVER_FOR_SOLANA = false;- Change the value:
false= Use Backpack GraphQL API for Solana (NEW behavior, PR #2)true= Use X1 JSON Server for Solana (OLD behavior, pre-PR #2)
The extension automatically routes queries based on network and configuration:
X1 Networks (X1, X1-testnet, X1-mainnet):
- ALWAYS → X1 JSON Server (
http://162.250.126.66:4000) - This behavior never changes regardless of toggle
Solana Networks (SOLANA):
USE_X1_JSON_SERVER_FOR_SOLANA = false→ Backpack GraphQL API (NEW behavior)USE_X1_JSON_SERVER_FOR_SOLANA = true→ X1 JSON Server (OLD behavior)
Token Balance Request
↓
Check providerId
↓
┌───────────────┴──────────────┐
│ │
X1 Network Solana Network
│ │
↓ ↓
X1 JSON Server Check USE_X1_JSON_SERVER_FOR_SOLANA
(ALWAYS) │
┌────────┴────────┐
│ │
false true
(NEW) (OLD)
│ │
↓ ↓
Backpack GraphQL X1 JSON Server
API
// In constants.ts
export const USE_X1_JSON_SERVER_FOR_SOLANA = false;Result:
- Solana queries →
https://backpack-api.xnfts.dev/v2/graphql - X1 queries →
http://162.250.126.66:4000
// In constants.ts
export const USE_X1_JSON_SERVER_FOR_SOLANA = true;Result:
- Solana queries →
http://162.250.126.66:4000 - X1 queries →
http://162.250.126.66:4000
This restores the pre-PR #2 behavior where everything went to your server.
To test the new Backpack GraphQL API with real Solana pricing:
export const USE_X1_JSON_SERVER_FOR_SOLANA = false;Then rebuild the extension:
source ~/.nvm/nvm.sh && nvm use 20.10.0
./build-clean.shAfter changing the configuration:
-
Rebuild the extension:
./build-clean.sh
-
Reload the extension in Chrome:
- Open
chrome://extensions/ - Click the reload icon for Backpack
- Open
-
Check the console for GraphQL URL:
- Open extension popup
- Right-click → Inspect
- Console will show:
🌐 GraphQL URL: <url>
If using X1 JSON Server for Solana queries (old behavior), your server must support the wallet balance endpoint:
Endpoint Format:
GET http://162.250.126.66:4000/wallet/{address}?providerId={SOLANA|X1|X1-testnet|X1-mainnet}
Expected JSON Response:
{
"balance": 1.5,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"balance": 1.5,
"decimals": 9,
"name": "Wrapped SOL",
"symbol": "SOL",
"logo": "https://...",
"price": 150.5,
"valueUSD": 225.75
}
]
}The interceptor will transform this JSON response into GraphQL format automatically.
Solution: Make sure to rebuild the extension after changing configuration:
./build-clean.shCheck:
- Custom GraphQL server is running
- Server implements the correct schema
- Server accepts CORS requests from extension
- Check browser console for detailed error messages
Solution:
- Remove the extension completely from Chrome
- Rebuild:
./build-clean.sh - Reload unpacked extension
packages/common/src/constants.ts- Configuration constantspackages/common/src/apollo/index.ts- Apollo Client setuppackages/data-components/src/components/Balances/index.tsx- Token balance queries
- BUILD_INSTRUCTIONS.md - How to build the extension
- PR #2 - Solana GraphQL integration
Last Updated: November 10, 2025