Solana API Integration

Overview

Solana is supported by Pocket Network's enterprise-grade infrastructure with guaranteed uptime, global edge network, and developer-first tooling.

Network Information

Property Value
Network Name Solana
Native Token SOL
Pocket Service ID solana
Block Explorer Solscan

Supported APIs

API Documentation
Solana API view spec

Integration Examples

Quick Setup

// Using @solana/web3.js
import { Connection, PublicKey } from '@solana/web3.js';

const connection = new Connection('YOUR_ENDPOINT', 'confirmed');

// Get account balance
const publicKey = new PublicKey('11111111111111111111111111111112');
const balance = await connection.getBalance(publicKey);
console.log('Balance:', balance / 1e9, 'SOL');

// Get latest slot
const slot = await connection.getSlot();
console.log('Latest slot:', slot);

SPL Token Queries

// Get token accounts for an owner
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';

const ownerPublicKey = new PublicKey('OWNER_ADDRESS_HERE');
const tokenAccounts = await connection.getTokenAccountsByOwner(
  ownerPublicKey,
  { programId: TOKEN_PROGRAM_ID }
);

console.log('Token accounts:', tokenAccounts.value.length);

// Get specific token balance
const mintAddress = new PublicKey('TOKEN_MINT_ADDRESS');
const tokenAccountsByMint = await connection.getTokenAccountsByOwner(
  ownerPublicKey,
  { mint: mintAddress }
);

Transaction Monitoring

// Send and confirm transaction
const transaction = new Transaction().add(
  SystemProgram.transfer({
    fromPubkey: senderPublicKey,
    toPubkey: recipientPublicKey,
    lamports: 1000000, // 0.001 SOL
  })
);

const signature = await connection.sendTransaction(transaction, [senderKeypair]);
const confirmation = await connection.confirmTransaction(signature, 'confirmed');
console.log('Transaction confirmed:', confirmation);

Developer Resources

📚 Essential Links

🛠️ Tools & SDKs

💬 Community & Support

Public Endpoint

Free public RPC endpoint available with fair use limits. No API key required.

View Public Endpoint →