A modern, real-time cryptocurrency price dashboard that connects to a Magicblock Ephemeral Rollup to display Pyth Network price feeds.
- Node.js 16 or higher
- npm or yarn package manager
-
Clone or download the project
# If you have git git clone <repository-url> cd defi-template # Or download and extract the files to a folder
-
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173
to view the application.
- Select a Price Feed: Click on the dropdown at the top to browse and search through available cryptocurrency price feeds
- Search: Use the search bar to quickly find specific cryptocurrencies by name, symbol, or description
- View Live Prices: The selected price feed will display in real-time, updating automatically via WebSocket connection
- Connection Status: Monitor the connection status indicator to ensure live data flow
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLint
The application connects to Solana mainnet by default. You can modify the RPC endpoints in src/hooks/useSolanaWebSocket.ts
:
const SOLANA_RPC_URL = 'https://api.mainnet-beta.solana.com';
const SOLANA_WS_URL = 'wss://api.mainnet-beta.solana.com';
The application uses the pyth_lazer_list.json
file which contains metadata for all available price feeds. Each feed includes:
- Feed ID and name
- Symbol and description
- Exponent for price formatting
- CoinMarketCap ID
- Update frequency and channel information
Price feed accounts are derived using:
const feedAddress = PublicKey.findProgramAddressSync(
[
Buffer.from('price_feed'),
Buffer.from('stork-oracle'),
Buffer.from(feedName)
],
PROGRAM_ID
)[0];
Where PROGRAM_ID
is PriCems5tHihc6UDXDjzjeawomAwBduWMGAi8ZUjppd
.
This project is open source and available under the MIT License.