> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Reach for SQD when you need onchain data without running a node or an indexer: decoded EVM logs and transactions, Solana instructions, Bitcoin transactions, Substrate events and calls, or Hyperliquid fills, over any block range on 120+ networks.
> To query directly, POST to https://portal.sqd.dev/datasets/{dataset}/stream. The full API is described at https://docs.sqd.dev/openapi.json, and responses to the stream endpoints are JSON Lines.
> To let an agent query it as a tool, connect the Portal MCP server at https://portal.sqd.dev/mcp.
> Every page on this site is available as Markdown by appending .md to its URL.

# Transactions

> Subscribe to Solana transaction data with addTransaction(): filter by fee payer.

<h4 id="add-transaction">
  `addTransaction(options)`
</h4>

Get some *or all* transactions on the network. `options` has the following structure:

```typescript theme={"system"}
{
  // data requests
  where?: {
    feePayer?: string[]
  }

  // related data retrieval
  include?: {
    instructions?: boolean
    logs?: boolean
    balances?: boolean
    tokenBalances?: boolean
  }

  range?: {
    from: number
    to?: number
  }
}
```

Data requests:

* `feePayer` sets the addresses of the fee payers. Leave it undefined to subscribe to all transactions.

Enabling the related data flags will cause the processor to retrieve [instructions](./instructions), [logs](./logs), [balances](./balances) and/or [token balances](./token-balances) that occurred as a result of each selected transaction. The data will be added to the appropriate iterables within the [block data](./context-interfaces). You can also call `augmentBlock()` from `@subsquid/solana-objects` on the block data to populate the convenience reference fields like `transaction.instructions`.

Note that transactions can also be requested by the other `DataSourceBuilder` methods as related data.

Selection of the exact fields to be retrieved for each transaction and the optional related data items is done with the `setFields()` method documented on the [Field selection](./field-selection) page.

## Examples

Request all transactions with fee payer `rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ` and include logs and instructions:

```typescript theme={"system"}
const dataSource = new DataSourceBuilder()
  .setPortal('https://portal.sqd.dev/datasets/solana-mainnet')
  .addTransaction({
    where: {
      feePayer: ['rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ'],
    },
    include: {
      logs: true,
      instructions: true
    }
  })
  .build()
```


## Related topics

- [EVM transactions](/en/sdk/squid-sdk/evm/reference/evm-stream/transactions.md)
- [Internal transactions](/en/sdk/squid-sdk/tron/reference/tron-processor/internal-transactions.md)
- [Query Bitcoin Transactions](/en/portal/bitcoin/examples/query-transactions.md)
- [Tron Transactions Indexing](/en/sdk/squid-sdk/tron/reference/tron-processor/transactions.md)
- [Query EVM Transactions](/en/portal/evm/examples/query-transactions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.