Docs

Get market state

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

Dynamic state lookup for a single market. :market-id is the stable Midnight market id and is unique across supported chains, so no chain id is required.

Returns the market state inside a data envelope. Use GET /v0/midnight/markets/{market-id} for immutable market configuration. 404s when the id is unknown.

Path Parameters

market-id*string

Midnight market id.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v0/midnight/markets/0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738/state"
{  "data": {    "chain_id": 8453,    "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",    "market_family_id": "0x9a6ece688006fb810141501154acfd1aa29ae7ac3753452f4931a092f2653f1f",    "total_units": "1481439992020013",    "tick_granularity": 4,    "settlement_fee_schedule": [      {        "time_to_maturity_days": 0,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 1,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 7,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 30,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 90,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 180,        "fee_cbp": "0"      },      {        "time_to_maturity_days": 360,        "fee_cbp": "0"      }    ],    "current_settlement_fee_wad": "0",    "current_settlement_fee_cbp": "0",    "continuous_fee_rate": "0",    "last_indexed_block": "48408699"  }}
{  "error": {    "code": "VALIDATION_FAILED",    "message": "Validation failed",    "details": [      {        "code": "invalid_string",        "message": "Invalid input",        "path": [          "market-id"        ]      }    ],    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}
{  "error": {    "code": "MARKET_NOT_FOUND",    "message": "Market 0x0000000000000000000000000000000000000000000000000000000000000000 not found",    "details": null,    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}
{  "error": {    "code": "INTERNAL_ERROR",    "message": "Internal server error",    "details": null,    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}