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

# Transactions

> Send signed Solana transactions through Raptor's Yellowstone Jet TPU endpoint and track confirmation status, latency, and parsed swap events.

## What This Does

* Sends transactions with low latency
* Tracks confirmation status in real time
* Automatically retries unconfirmed transactions
* Returns parsed transaction data and Raptor events
* Measures send → confirm latency

***

## Send a Transaction

Send a signed Solana transaction.

**Endpoint**

`POST /send-transaction`

**Request Body**

```json theme={null}
{
  "transaction": "base64-encoded-transaction"
}
```

**Response**

```json theme={null}
{
  "signature": "4vJ9JU1bJJE96FWSJKvHsmmFADCg4gpZQff4P3bkLKi",
  "signature_base64": "RXNzaWduYXR1cmU=",
  "success": true
}
```

**Notes**

* Returns immediately after accepting the transaction
* Sending and retrying happens in the background
* Transactions are retried for up to **30 seconds** or until confirmed

***

## Track a Transaction

Check the status of a transaction sent via `/send-transaction`.

**Endpoints**

* `GET /transaction/{signature}`

The signature can be **base58 or base64**.

**Response (example)**

```json theme={null}
{
  "signature": "4vJ9JU1bJJE96FWSJKvHsmmFADCg4gpZQff4P3bkLKi",
  "status": "confirmed",
  "slot": 250123456,
  "sent_at": 1703123456789,
  "confirmed_at": 1703123456795,
  "latency_ms": 6,
  "transaction": { ... },
  "events": [ ... ]
}
```

### Status Values

* `pending` – sent but not confirmed
* `confirmed` – accepted at the confirmed commitment level
* `failed` – transaction error
* `expired` – not confirmed before timeout

***

## Raptor Events

If the transaction interacts with the **Raptor program**, events are automatically parsed and returned.

**Supported Events**

* `SwapEvent`
* `SwapCompleteEvent`
* `PlaceOrderEvent`
* `FillOrderEvent`
* `CancelOrderEvent`
* `UpdateOrderEvent`

**Event Format**

```json theme={null}
{
  "name": "SwapEvent",
  "data": "base64-encoded-data",
  "parsed": {
    "dex": 1,
    "amountIn": 1000000,
    "amountOut": 999000
  }
}
```

***

## Examples

### Send a Transaction

```js theme={null}
const RAPTOR_URL = 'https://raptor-beta.solanatracker.io';

const response = await fetch(`${RAPTOR_URL}/send-transaction`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ transaction: signedTx })
});

const result = await response.json();
console.log(result.signature);
```

### Poll for Confirmation

```js theme={null}
async function waitForConfirmation(signature) {
  for (let i = 0; i < 30; i++) {
    const res = await fetch(`${RAPTOR_URL}/transaction/${signature}`);
    const tx = await res.json();

    if (tx.status === 'confirmed' || tx.status === 'failed') {
      return tx;
    }

    await new Promise(r => setTimeout(r, 1000));
  }

  throw new Error('Timeout');
}
```

### Read Swap Results

```js theme={null}
const RAPTOR_URL = 'https://raptor-beta.solanatracker.io';
const tx = await fetch(`${RAPTOR_URL}/transaction/${signature}`).then(r => r.json());

for (const event of tx.events ?? []) {
  if (event.name === 'SwapEvent') {
    console.log(event.parsed.amountIn, '→', event.parsed.amountOut);
  }
}
```

***

## Errors

| Code | Meaning                     |
| ---- | --------------------------- |
| 400  | Invalid transaction         |
| 404  | Transaction not tracked     |
| 503  | Sender or tracking disabled |

```json theme={null}
{
  "error": "Transaction not found",
  "code": 404
}
```
