Skip to main content
Monitor Orca Whirlpool swap instructions to build DEX analytics dashboards, analyze liquidity patterns, or create price feeds.

Use Case

DEX swap tracking enables you to:
  • Build DEX trading analytics and volume trackers
  • Monitor liquidity pool activity
  • Analyze trading patterns and arbitrage
  • Create real-time price feeds

Code Example

curl --compressed -X POST 'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "solana",
    "fromBlock": 280000000,
    "toBlock": 280000003,
    "fields": {
      "block": {
        "number": true,
        "timestamp": true
      },
      "instruction": {
        "programId": true,
        "accounts": true,
        "data": true,
        "transactionIndex": true
      }
    },
    "instructions": [{
      "programId": ["whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"],
      "d8": ["0xf8c69e91e17587c8"]
    }]
  }'
Try it yourself with the interactive query interface below:

Key Parameters

ParameterDescription
programIdDEX program address (e.g., Orca Whirlpool)
d88-byte instruction discriminator for swap instruction
accountsInstruction account addresses (includes pool, tokens, etc.)
dataInstruction data payload (contains swap amounts)
Different DEX protocols use different instruction discriminators. Check the program IDL to find the correct discriminator for your target DEX.

Expected Output

{
  "header": {
    "number": 259985000,
    "timestamp": 1697544779
  },
  "instructions": [
    {
      "programId": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc",
      "accounts": ["7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm", "..."],
      "data": "base58encodeddata...",
      "transactionIndex": 0
    }
  ]
}

Track Specific Pool

Monitor swaps for a specific trading pair:
curl --compressed -X POST 'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "solana",
    "fromBlock": 280000000,
    "toBlock": 280000003,
    "fields": {
      "instruction": {
        "programId": true,
        "accounts": true,
        "data": true
      }
    },
    "instructions": [{
      "programId": ["whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"],
      "d8": ["0xf8c69e91e17587c8"],
      "accounts": ["7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm"]
    }]
  }'

Decode Swap Amounts

Swap amounts are encoded in the data field. Here’s how to decode them for Orca Whirlpool:
Use the Solana typegen tool to generate TypeScript decoders from program IDLs. See the Solana SDK typegen documentation for details.

Performance Tips

  1. Filter by pool address: Query specific pools instead of all swaps
  2. Use slot ranges: Process data in 10k-50k slot batches
  3. Decode off-chain: Decode swap amounts in your application, not in the query
  4. Combine with token balances: Use token balances to track actual amounts transferred
Last modified on November 18, 2025