Docs

List market transactions

GET
/v0/midnight/markets/{market-id}/transactions

Cursor-paginated feed of Midnight economic transactions for one market.

Scope. Includes borrow, lend, exit_lend_primary, exit_lend_secondary, exit_borrow_primary, exit_borrow_secondary, partial_liquidation, full_liquidation, withdraw_collateral, and supply_collateral. Admin, authorization, fee, flashloan, accounting-only, and market creation activity is excluded from v0.

Trade actions. A single trade can affect both the lender and borrower side. Market-level queries can therefore return multiple API items for the same transaction, while account queries return only the items affecting that account. For trade items, data.assets is the loan-token amount attributed to the item; buyer_assets, seller_assets, take_units, and total_units_delta describe the full trade.

Filters. :market-id constrains the market and is globally unique across chains. chain_ids is optional and can further narrow the query.

Pagination. Response follows the list envelope: { cursor, data }. Pass back cursor verbatim on the next call. A null cursor means the last page. Ordering is fixed to created_at with deterministic tie-breakers.

Cache. public, max-age=2, stale-while-revalidate=1.

Path Parameters

market-id*string

Midnight market id.

Query Parameters

chain_ids?array<>

Filter by chain ids. Supported chains: Ethereum (1) and Base (8453).

Itemsitems <= 100
event_types?array<>

Filter by transaction event type.

Itemsitems <= 100
loan_assets?array<string>

Filter by market loan token addresses. Combine with chain_ids.

Itemsitems <= 100
collateral_assets?array<string>

Filter by collateral token addresses. Combine with chain_ids.

Itemsitems <= 100
created_at_gte?|

Filter for transaction timestamps greater than or equal to this unix timestamp.

created_at_lte?|

Filter for transaction timestamps less than or equal to this unix timestamp.

tx_hash?string

Filter by tx hash.

sort_direction?string

Sort direction for cursor pagination. Ordering is by created_at with deterministic tie-breakers.

Default"desc"

Value in

  • "asc"
  • "desc"
limit?integer

Maximum number of transactions to return.

Range1 <= value <= 1000
Default100
cursor?string

Opaque cursor from a previous page response.

Length1 <= length <= 4096

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v0/midnight/markets/0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738/transactions"
{  "cursor": "eyJkIjoiZGVzYyIsInQiOiIxNzgzNjA2NjQ3IiwiYyI6ODQ1MywiYiI6IjQ4NDA4NjUwIiwieCI6MTgyLCJsIjo0NTcsImEiOjEsImgiOiIweDMzN2JiYWNhYTJkMDE0ODc0ZjBhMjRlOGIwODdlNTY2MmRjZmExN2Y2ZmNmYjFhNTNhZTE0ODcyMTg3MjYxNjciLCJlIjoic3VwcGx5X2NvbGxhdGVyYWwifQ",  "data": [    {      "id": "0048408650-fe33f-000460:4",      "chain_id": 8453,      "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",      "event_type": "borrow",      "tx_hash": "0x337bbacaa2d014874f0a24e8b087e5662dcfa17f6fcfb1a53ae1487218726167",      "data": {        "account": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "caller": "0x3f60566413487406F80572A4Eb91163aC097E415",        "maker": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "taker": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "buyer": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "seller": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "buyer_assets": "80000000000000",        "seller_assets": "80000000000000",        "assets": "80000000000000",        "units": "80001344022580",        "take_units": "80001344022580",        "buyer_pending_fee_increase": "0",        "seller_pending_fee_decrease": "0",        "total_units_delta": "80001344022580",        "payer": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "receiver": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "group": "0xe6ceb8a150e3da1ade87bc6308a293149b1f6d10a204bb7883dd6e328b9bf674",        "consumed": "80000000000000"      },      "created_at": 1783606647    },    {      "id": "0048408650-fe33f-000460:2",      "chain_id": 8453,      "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",      "event_type": "lend",      "tx_hash": "0x337bbacaa2d014874f0a24e8b087e5662dcfa17f6fcfb1a53ae1487218726167",      "data": {        "account": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "caller": "0x3f60566413487406F80572A4Eb91163aC097E415",        "maker": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "taker": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "buyer": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "seller": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "buyer_assets": "80000000000000",        "seller_assets": "80000000000000",        "assets": "80000000000000",        "units": "80001344022580",        "take_units": "80001344022580",        "buyer_pending_fee_increase": "0",        "seller_pending_fee_decrease": "0",        "total_units_delta": "80001344022580",        "payer": "0x958eB498a4172EA513c79b09E7f064070C5b1917",        "receiver": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "group": "0xe6ceb8a150e3da1ade87bc6308a293149b1f6d10a204bb7883dd6e328b9bf674",        "consumed": "80000000000000"      },      "created_at": 1783606647    },    {      "id": "0048408650-fe33f-000457:1",      "chain_id": 8453,      "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",      "event_type": "supply_collateral",      "tx_hash": "0x337bbacaa2d014874f0a24e8b087e5662dcfa17f6fcfb1a53ae1487218726167",      "data": {        "account": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "caller": "0x3f60566413487406F80572A4Eb91163aC097E415",        "on_behalf": "0x535690CB1330232dd4f2ac5B724040751bdF4C91",        "collateral": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",        "assets": "1000000"      },      "created_at": 1783606647    }  ]}

{  "error": {    "code": "VALIDATION_FAILED",    "message": "Validation failed",    "details": [      {        "code": "invalid_type",        "message": "Expected number, received string",        "path": [          "chain_ids",          0        ]      }    ],    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}

{  "error": {    "code": "INTERNAL_ERROR",    "message": "Internal server error",    "details": null,    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}