> ## 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.

# 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()
```
