> ## Documentation Index
> Fetch the complete documentation index at: https://ti-mm-mycompc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Decode Solana Transactions into LLM-Friendly Summaries

> Turn raw Solana transaction signatures into categorized summaries using the Solana Pulse AI Agent Gateway decode endpoint for agent prompts.

Solana Pulse AI Agent Gateway turns raw transaction logs into structured, human-readable summaries. Instead of parsing RPC logMessages yourself, you send a signature and receive a category (Swap, MemeCoin, or Transfer), a one-line summary, and key details your agent can use in prompts or decision logic.

<Steps>
  <Step title="Obtain a transaction signature">
    Find the signature you want to decode. You can get one from:

    * A wallet history call to `/api/solana/transactions`
    * Solana Explorer or Solscan
    * Your own application logs

    A signature looks like this:

    ```text theme={null}
    5v1ZQZ9QpZ7XyZ... (Base58, 88 characters)
    ```
  </Step>

  <Step title="Call the decode endpoint">
    Send the signature to `/api/solana/decode-tx` with your API key. You can request `mainnet-beta` (default) or `devnet`.

    ```bash theme={null}
    curl -H "x-api-key: YOUR_API_KEY" \
      "https://solana-pulse-ai-agent-gateway.ai.studio/api/solana/decode-tx?signature=5v1ZQZ9QpZ7XyZ...&network=mainnet-beta"
    ```
  </Step>

  <Step title="Interpret the response">
    The gateway returns a structured breakdown you can feed directly into an LLM prompt.

    ```json theme={null}
    {
      "signature": "5v1ZQZ9QpZ7XyZ...",
      "network": "mainnet-beta",
      "summary": "Swap executed via Jupiter Aggregator.",
      "category": "Swap",
      "details": {
        "slot": 312456789,
        "fee": 5000,
        "timestamp": 1715424000,
        "status": "SUCCESS"
      },
      "raw_logs": [
        "Program Jupiter Aggregator invoke [1]",
        "Program log: Instruction: Swap",
        "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
        "Program log: Instruction: Transfer"
      ],
      "llm_context": "This transaction was a Swap. Swap executed via Jupiter Aggregator. The transaction succeeded.",
      "live_status": "SUCCESS"
    }
    ```

    Key fields for agents:

    <ResponseField name="category" type="string" required>
      One of `Swap`, `MemeCoin`, or `Transfer`. Use this to branch agent logic.
    </ResponseField>

    <ResponseField name="summary" type="string" required>
      A one-line human-readable description of what happened.
    </ResponseField>

    <ResponseField name="llm_context" type="string" required>
      A pre-formatted sentence combining category, summary, and status. Ideal for dropping into a prompt template.
    </ResponseField>

    <ResponseField name="details.status" type="string" required>
      `SUCCESS` or `FAILED`. Check this before acting on the transaction.
    </ResponseField>
  </Step>

  <Step title="Use in an agent prompt">
    Feed the decoded result into your agent context:

    ```typescript theme={null}
    const decodeRes = await fetch(
      `${GATEWAY}/api/solana/decode-tx?signature=${signature}&network=mainnet-beta`,
      { headers: { "x-api-key": API_KEY } }
    );
    const decoded = await decodeRes.json();

    const prompt = `
    Transaction ${decoded.signature} on ${decoded.network}:
    - Category: ${decoded.category}
    - Summary: ${decoded.summary}
    - Status: ${decoded.details.status}
    - Fee: ${decoded.details.fee} lamports

    ${decoded.llm_context}
    `;
    ```
  </Step>
</Steps>

## Category reference

The gateway detects categories from program logs:

<CardGroup cols={3}>
  <Card title="Swap" icon="arrow-right-arrow-left">
    Jupiter, Raydium, or other DEX aggregator interactions.
  </Card>

  <Card title="MemeCoin" icon="fire">
    Pump.fun mints or swaps. Flagged for higher risk review.
  </Card>

  <Card title="Transfer" icon="paper-plane">
    Native SOL or SPL token transfers between wallets.
  </Card>
</CardGroup>

## Error handling

| Status | Meaning               | What to do                                   |
| ------ | --------------------- | -------------------------------------------- |
| 400    | Missing signature     | Include `?signature=` in the query string    |
| 404    | Transaction not found | Wait for confirmation or check the signature |
| 500    | Server error          | Retry; `live_status` will be `"FAILED"`      |

## Result

You can now turn any Solana signature into a structured, LLM-ready summary in a single API call. Use `category` to route agent behavior, `summary` for user-facing explanations, and `llm_context` for prompt injection.

## Next steps

* [Claim an API Key](/guides/claim-api-key) if you need a key to call paid endpoints
* [MCP Integration](/guides/mcp-integration) to use `decode_tx` as an MCP tool in Claude Desktop or Cursor
