Streaming and Parsing Pump Swap AMM Accounts

Real-Time Monitoring and Decoding of Pump AMM Account Data via Solana gRPC

For any Solana dApp, trading bots, or real-time analytics platform, efficient account data access is important. Solana gRPC streaming, powered by technologies like the Geyser plugin and Yellowstone, provides a fast, low-latency way to get data, far better than older RPC calls or WebSockets. In this document, we will explore how we can stream and parse Pump Swap account data using Solana Yellowstone gRPCs

Step-by-Step Breakdown

This project consists of two key components:

  1. Streaming Pump Swap Accounts via Yellowstone gRPC

  2. 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
);

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": ["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"] // This field indicates 
    }
  },
  "transactions": {},
  "blocks": {},
  "blocksMeta": {},
  "accountsDataSlice": [],
  "commitment": CommitmentLevel.PROCESSED, // Subscribe to processed blocks for the fastest updates
  "entry": {},
  "transactionsStatus": {}
}

For example, to stream Pump.fun transaction accounts, you can set the owner field to the Pump Swap program ID. This ensures that only accounts associated with the Pump Swap program are streamed in real-time—ideal for use cases like crypto trading bots, on-chain analytics, or DeFi dashboards requiring program-specific data.

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

As soon as the accounts are updated on chain, the updated account data is sent over the stream. The next step involves decoding the data. For JS/TS, we use BorshAccountCoder from @coral-xyz/anchor to parse the account data in the following manner.

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('./Idl/pump_amm_0.1.0.json', 'utf8'));
const accountCoder = new BorshAccountsCoder(program_idl);

 const decodedData = accountCoder.decodeAny(data.account.account.data);
  • 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?