This guide will help you make your first API calls to the Solana Tracker Data API. You’ll learn how to authenticate, make requests, and handle responses.
After creating your account, retrieve your API key from the dashboard. This key is used to authenticate your requests by passing it in the x-api-key header.
In addition to the Data API, Solana Tracker provides high-performance RPC nodes for direct blockchain interactions. Note that the RPC endpoint URL and authentication method (passing the API key in the URL path) are different from the Data API.
Copy
Ask AI
import { Connection, PublicKey } from '@solana/web3.js';const connection = new Connection( 'https://rpc-mainnet.solanatracker.io?api_key=YOUR_API_KEY', { commitment: 'confirmed', wsEndpoint: 'wss://rpc-mainnet.solanatracker.io?api_key=YOUR_API_KEY' });// Get account balanceconst publicKey = new PublicKey('YOUR_WALLET_ADDRESS');const balance = await connection.getBalance(publicKey);console.log(`Balance: ${balance / 1e9} SOL`);// Subscribe to account changesconnection.onAccountChange( publicKey, (accountInfo) => { console.log('Account updated:', accountInfo); });