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

# Transacciones

> Envía transacciones firmadas de Solana vía endpoint Yellowstone Jet TPU de Raptor y sigue confirmación, latencia y eventos de swap parseados en tiempo real.

## Qué hace

* Envía transacciones con baja latencia
* Sigue el estado de confirmación en tiempo real
* Reintenta automáticamente transacciones no confirmadas
* Devuelve datos parseados de la transacción y eventos Raptor
* Mide la latencia de envío → confirmación

***

## Enviar una transacción

Envía una transacción de Solana firmada.

**Endpoint**

`POST /send-transaction`

**Cuerpo de la solicitud**

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

**Respuesta**

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

**Notas**

* Devuelve inmediatamente tras aceptar la transacción
* El envío y los reintentos ocurren en segundo plano
* Las transacciones se reintentan hasta **30 segundos** o hasta confirmarse

***

## Seguir una transacción

Comprueba el estado de una transacción enviada vía `/send-transaction`.

**Endpoints**

* `GET /transaction/{signature}`

La firma puede ser **base58 o base64**.

**Respuesta (ejemplo)**

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

### Valores de status

* `pending` – enviada pero no confirmada
* `confirmed` – aceptada con nivel de commitment confirmed
* `failed` – error de transacción
* `expired` – no confirmada antes del timeout

***

## Eventos Raptor

Si la transacción interactúa con el **programa Raptor**, los eventos se parsean y devuelven automáticamente.

**Eventos soportados**

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

**Formato del evento**

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

***

## Ejemplos

### Enviar una transacción

```js theme={null}
const RAPTOR_URL = 'https://raptor.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);
```

### Polling para confirmación

```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');
}
```

### Leer resultados de swap

```js theme={null}
const RAPTOR_URL = 'https://raptor.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);
  }
}
```

***

## Errores

| Código | Significado |
| - | - |
| 400 | Transacción inválida |
| 404 | Transacción no rastreada |
| 503 | Sender o tracking deshabilitados |

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


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