Solana Raydium Launchlab Account Parsing
Real-Time Raydium Launchlab Account Streaming via Solana's Yellowstone gRPC (geyser)
Beyond just tracking transactions, understanding the live, evolving state of Raydium Launchpad accounts is crucial for monitoring new project initiations. These accounts hold vital, real-time details pertaining to the bonding curve's progress, current fundraising status, and the eventual transition of tokens to a new liquidity pool. This document will guide you through streaming and parsing real-time account data for Raydium Launchpad, providing immediate insights into the entire lifecycle from token launch to pool establishment.
The complete source code for this project is available on GitHub.
Please feel free to clone the repository and try it out. Additionally, you will find other relevant and useful code examples related to gRPC and streaming here.
Step-by-Step Breakdown
This project consists of two key components:
Streaming Raydium Launchpad Accounts via Yellowstone gRPC
Decoding those accounts using the program's IDL
Streaming Accounts Using gRPC
The first step involves initializing the Solana Yellowstone Client. You can get Solana Yellowstone gRPC access from the Shyft Dashboard. Please check out our gRPC Authentication Docs for more details.
Initializing the Client
Once you have the authentication details, you can initialize the client in the following manner,
import Client from "@triton-one/yellowstone-grpc";
const client = new Client(
"YOUR-GRPC-ENDPOINT", //yellowstone grpc url
"GRPC-ACCESS-TOKEN", //authentication token
undefined
);use yellowstone_grpc_client::{GeyserGrpcClient, Interceptor}
async fn connect(&self) -> anyhow::Result<GeyserGrpcClient<impl Interceptor>> {
GeyserGrpcClient::build_from_shared(self.endpoint.clone())? //grpc url
.x_token(Some(self.x_token.clone()))? //grpc auth token
.connect_timeout(Duration::from_secs(10))
.timeout(Duration::from_secs(10))
.tls_config(ClientTlsConfig::new().with_native_roots())?
.max_decoding_message_size(1024 * 1024 * 1024)
.connect()
.await
.map_err(Into::into)
}You can use any Yellowstone gRPC endpoint with this client. An access token is optional, as some gRPC services don't require authentication.
The Rust client supports several additional options, as demonstrated in the example above. Most of these options are also available for the TS client, where they are passed as the third argument to the Client constructor.
Specifying what data to stream from gRPC
To specify what on-chain data, we send a SubscribeRequest over the existing Solana Yellowstone gRPC client. These Request allows you to filter for specific accounts, transactions, slots, or other Solana on-chain events, giving you full control over the data you receive.
SubscribeRequests use filters to determine what type of on-chain data to stream. When streaming account-level data, the account filter plays a crucial role. Specifically, the owner field within the filter allows you to stream data for accounts owned by a particular Solana program.
const req: SubscribeRequest = {
"slots": {},
"accounts": {
"pumpfun": {
"account": [],
"filters": [],
"owner": ["LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"] // This field indicates
}
},
"transactions": {},
"blocks": {},
"blocksMeta": {},
"accountsDataSlice": [],
"commitment": CommitmentLevel.PROCESSED, // Subscribe to processed blocks for the fastest updates
"entry": {},
"transactionsStatus": {}
}let mut accounts: AccountFilterMap = HashMap::new();
accounts.insert(
"accountData".to_owned(),
SubscribeRequestFilterAccounts {
account: vec![],
owner: vec!["LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj"],
nonempty_txn_signature: None,
filters: vec![]
},
);
Ok(SubscribeRequest {
accounts,
slots: HashMap::default(),
transactions: HashMap::default(),
transactions_status: HashMap::default(),
blocks: HashMap::default(),
blocks_meta: HashMap::default(),
entry: HashMap::default(),
commitment: Some(CommitmentLevel::Processed as i32),
accounts_data_slice: Vec::default(),
ping: None,
from_slot: None,
})Once established, the stream will begin sending data directly to your application. You have the flexibility to modify your subscription on the fly, allowing you to change the data specifications you receive without stopping your stream. For more details on reconnecting and re-starting the stream from a specific slot, or closing your gRPC connection, you can find additional information in our documentation.
Decoding the received accounts
When account data updates on-chain, it's immediately sent over the stream. To make sense of this raw information, we need to decode it. In JavaScript/TypeScript, we typically use BorshAccountCoder from @coral-xyz/anchor to parse the account data like this.
On Rust however, we can use the Solores generated IDL like in our transaction parsing example.
import { BorshAccountsCoder } from "@coral-xyz/anchor";
const program_idl = JSON.parse(fs.readFileSync('./idls/raydium_launchpad.json', "utf8"));
const coder = new BorshAccountsCoder(program_idl); //initializing BorshCoder with IDL
export async function decodeRaydiumLaunchpadTxnData(data) {
if (!data || !data.account || !data.account.account) return;
const dataTx = data.account.account;
let parsedAccount;
try {
parsedAccount = coder.decodeAny(dataTx?.data); //decoding account
} catch (error) {
console.error("Failed to decode pool state:", error);
}
}use raydium_launchpad_interface::{accounts::{
GLOBAL_CONFIG_ACCOUNT_DISCM,
GlobalConfig,
GlobalConfigAccount,
PLATFORM_CONFIG_ACCOUNT_DISCM,
PlatformConfig,
PlatformConfigAccount,
POOL_STATE_ACCOUNT_DISCM,
PoolState,
PoolStateAccount,
VESTING_RECORD_ACCOUNT_DISCM,
VestingRecord,
VestingRecordAccount
}};
pub fn decode_account_data(buf: &[u8]) -> Result<DecodedAccount, AccountDecodeError> {
if buf.len() < 8 {
return Err(AccountDecodeError {
message: "Buffer too short to contain a valid discriminator.".to_string(),
});
}
let discriminator: [u8; 8] = buf[..8].try_into().expect("Failed to extract first 8 bytes");
match discriminator {
GLOBAL_CONFIG_ACCOUNT_DISCM => {
let data = GlobalConfigAccount::deserialize(buf)
.map_err(|e| AccountDecodeError {
message: format!("Failed to deserialize GlobalConfig: {}", e),
})?;
Ok(DecodedAccount::GlobalConfig(data.0))
}
PLATFORM_CONFIG_ACCOUNT_DISCM => {
let data = PlatformConfigAccount::deserialize(buf)
.map_err(|e| AccountDecodeError {
message: format!("Failed to deserialize PlatformConfig: {}", e),
})?;
Ok(DecodedAccount::PlatformConfig(data.0))
}
POOL_STATE_ACCOUNT_DISCM => {
let data = PoolStateAccount::deserialize(buf)
.map_err(|e| AccountDecodeError {
message: format!("Failed to deserialize PoolState: {}", e),
})?;
Ok(DecodedAccount::PoolState(data.0))
}
VESTING_RECORD_ACCOUNT_DISCM => {
let data = VestingRecordAccount::deserialize(buf)
.map_err(|e| AccountDecodeError {
message: format!("Failed to deserialize VestingRecord: {}", e),
})?;
Ok(DecodedAccount::VestingRecord(data.0))
}
_ => Err(AccountDecodeError {
message: "Account discriminator not found.".to_string(),
}),
}
}Important Links
Solana gRPC Documentation – In-depth technical docs for implementing real-time streaming with Yellowstone gRPC and Geyser plugin on Solana.
Blogs on Solana gRPC Streaming – Guides, use cases, and performance benchmarks for building low-latency Solana applications using gRPC-based infrastructure.
Solana DeFi Code Snippets & Examples – Ready-to-use code snippets and integrations for common DeFi protocols, transaction parsers, and real-time Solana data streaming use cases.
Last updated
Was this helpful?