npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pioneer-platform/solana-network

v8.11.10

Published

Pioneer Platform Solana Network module

Downloads

1,189

Readme

@pioneer-platform/solana-network

Solana blockchain network integration module for the Pioneer Platform.

Features

  • ✅ SOL balance queries
  • ✅ SPL token balance queries
  • ✅ Transfer transaction building
  • ✅ Fee estimation
  • ✅ Transaction broadcasting
  • ✅ Transaction status tracking
  • ✅ Account information queries

Installation

bun install @pioneer-platform/solana-network

Network Information

  • Network ID: solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
  • Chain Symbol: SOL
  • SLIP44: 501
  • Decimals: 9 (lamports)
  • Default RPC: https://api.mainnet-beta.solana.com

Usage

Initialize Module

const solanaNetwork = require('@pioneer-platform/solana-network')

// Initialize with default RPC
await solanaNetwork.init()

// Or with custom RPC
await solanaNetwork.init('https://your-custom-rpc.com')

// Or with environment variable
// Set SOLANA_RPC_URL in .env
await solanaNetwork.init()

Get SOL Balance

const balance = await solanaNetwork.getBalance('9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM')
console.log('Balance:', balance, 'SOL')

Get SPL Token Balances

const tokens = await solanaNetwork.getTokenBalances('9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM')

tokens.forEach(token => {
    console.log(`Token: ${token.mint}`)
    console.log(`Balance: ${token.balance}`)
    console.log(`Decimals: ${token.decimals}`)
})

Build Transfer Transaction

const tx = await solanaNetwork.buildTransfer(
    '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM', // from
    'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK', // to
    0.001 // amount in SOL
)

console.log('Transaction:', {
    from: tx.from,
    to: tx.to,
    amount: tx.amount,
    lamports: tx.lamports,
    blockhash: tx.blockhash,
    serialized: tx.serialized // base64 encoded, ready for signing
})

Estimate Transfer Fee

const fee = await solanaNetwork.estimateFee()
console.log('Fee:', fee, 'SOL') // typically ~0.000005 SOL

Broadcast Signed Transaction

// After signing the transaction
const result = await solanaNetwork.broadcast(signedTransactionBase64)

if (result.success) {
    console.log('Transaction ID:', result.txid)
} else {
    console.error('Broadcast failed:', result.error)
}

Get Transaction Details

const txDetails = await solanaNetwork.getTransaction('signature...')
console.log('Transaction:', txDetails)

Get Recent Blockhash

const { blockhash, lastValidBlockHeight } = await solanaNetwork.getRecentBlockhash()
console.log('Blockhash:', blockhash)
console.log('Valid until block:', lastValidBlockHeight)

API Reference

Module Exports

init(url?, settings?): Promise<boolean>

Initialize the Solana network module.

  • url: Optional RPC URL (defaults to env var or mainnet)
  • settings: Optional configuration object
  • Returns: true if successful

isOnline(): boolean

Check if module is initialized and connected.

getBalance(address): Promise<number>

Get SOL balance for an address.

  • address: Solana public key (base58 encoded)
  • Returns: Balance in SOL

getTokenBalances(address): Promise<Array>

Get all SPL token balances for an address.

  • address: Solana public key (base58 encoded)
  • Returns: Array of token accounts with balances

buildTransfer(from, to, amount): Promise<Object>

Build an unsigned SOL transfer transaction.

  • from: Sender's public key (base58)
  • to: Recipient's public key (base58)
  • amount: Amount in SOL
  • Returns: Transaction object with serialized data

estimateFee(): Promise<number>

Estimate transfer fee.

  • Returns: Fee in SOL (typically ~0.000005 SOL)

broadcast(tx): Promise<Object>

Broadcast a signed transaction.

  • tx: Base64 encoded signed transaction
  • Returns: { success: boolean, txid?: string, error?: string }

getTransaction(signature): Promise<Object>

Get transaction details by signature.

  • signature: Transaction signature
  • Returns: Transaction details or null

getRecentBlockhash(): Promise<Object>

Get recent blockhash for transaction building.

  • Returns: { blockhash: string, lastValidBlockHeight: number }

getAccount(address): Promise<Object>

Get account information.

  • address: Solana public key (base58 encoded)
  • Returns: Account info or null

Constants

  • NETWORK_ID: Solana network identifier
  • CHAIN_SYMBOL: 'SOL'
  • DECIMALS: 9

Testing

# Run basic tests
bun run test

# Run transfer tests
cd __tests__
node test-transfer.js

Environment Variables

# Optional: Custom RPC URL
SOLANA_RPC_URL=https://your-custom-rpc.com

Integration with Pioneer Platform

This module integrates with the Pioneer Platform's multi-chain architecture:

  1. Balance Queries: Used by pioneer-balance for portfolio calculations
  2. Transaction Building: Used by transaction routers for SOL transfers
  3. Token Support: SPL token discovery and balance tracking
  4. Network State: Health checks and network status monitoring

RPC Endpoints

Mainnet

  • https://api.mainnet-beta.solana.com (default)
  • https://solana-api.projectserum.com

Performance Tips

  • Use private RPC endpoints for production (QuickNode, Alchemy, etc.)
  • Default public RPCs have rate limits
  • Consider connection pooling for high-frequency queries

Transaction Signing

This module builds unsigned transactions. To sign and broadcast:

// 1. Build transaction
const tx = await solanaNetwork.buildTransfer(from, to, amount)

// 2. Sign with your wallet/keypair (using @solana/web3.js)
const { Keypair } = require('@solana/web3.js')
const keypair = Keypair.fromSecretKey(secretKey)
tx.transaction.sign(keypair)

// 3. Serialize signed transaction
const signedTx = tx.transaction.serialize().toString('base64')

// 4. Broadcast
const result = await solanaNetwork.broadcast(signedTx)

License

Pioneer Platform License