Solana Raydium CPMM Account Parsing
Example code for parsing Solana Raydium CPMM accounts using Yellowstone geyser gRPC.
Step-by-Step Breakdown
Streaming Accounts Using gRPC
Initializing the Client
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)
}Specifying what data to stream from gRPC
Decoding the received accounts
Important Links
Last updated