# 2. Soroban TXs

#### 2.1 GET `/txs/by-ledger`

**Query params**

* `from` (i32, optional) – default 0
* `to` (i32, optional) – default i32::MAX
* `limit` (i64, optional) – default 100, max 1000
* `offset` (i64, optional) – default 0
* `cursor` (hex string, optional) – tx field of last row from previous page; when set, offset is ignored

**Example**

```bash
curl -X GET \
  "$BASE/txs/by-ledger?from=500000&to=500500&limit=100&offset=0" \
  -H "Authorization: $AUTH"
```

***

#### 2.2 GET `/txs/by-contract/{contract_id}`

Two behaviors.

**2.2.a just contract**

```bash
curl -X GET \
  "$BASE/txs/by-contract/CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA?limit=100&offset=0" \
  -H "Authorization: $AUTH"
```

**2.2.b contract + ledger**

```bash
curl -X GET \
  "$BASE/txs/by-contract/CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA?from=500000&to=500500&limit=100&cursor=af01bc..."" \
  -H "Authorization: $AUTH"
```

Precedence:

1. if `from` or `to` → ledger branch
2. else → base

***

#### 2.3 GET `/txs/by-contracts`

**Query params**

* `contracts=ID1,ID2,...` (required) – comma-separated contract IDs
* `limit` (i64, optional) – default 100, max 1000
* `offset` (i64, optional) – default 0
* `cursor` (hex string, optional) – tx field of last row from previous page; when set, offset is ignored

**Example**

```bash
curl -X GET \
  "$BASE/txs/by-contracts?contracts=CONTRACT1,CONTRACT2&limit=100&offset=0" \
  -H "Authorization: $AUTH"
```

***

#### 2.4 GET `/txs/by-ledger/contracts`

Multiple contracts + ledger filter

**Query params**

* `contracts=ID1,ID2,...` (required) – comma-separated contract IDs
* `from` (i32, optional) – default 0
* `to` (i32, optional) – default i32::MAX
* `limit` (i64, optional) – default 100, max 1000
* `offset` (i64, optional) – default 0
* `cursor` (hex string, optional) – tx field of last row from previous page; when set, offset is ignored

**Example**

```bash
curl -X GET \
  "$BASE/txs/by-ledger/contracts?contracts=CONTRACT1,CONTRACT2&from=500000&to=500500&limit=100&offset=0" \
  -H "Authorization: $AUTH"
```

***

#### 2.5 GET `/txs/by-hash/{tx_hex}`

```bash
curl -X GET \
  "$BASE/txs/by-hash/af01bc..." \
  -H "Authorization: $AUTH"
```
