Skip to content

Commit 30b52bc

Browse files
committed
chore: integrate spectaql
1 parent 0cb8a5e commit 30b52bc

16 files changed

Lines changed: 8886 additions & 756 deletions

File tree

blockfrost-openapi.yaml

Lines changed: 150 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -91,155 +91,6 @@ info:
9191
* Non-pinned IPFS files are subject to regular garbage collection and will be removed unless pinned.
9292
* We allow maximum of 100 queued pins per IPFS user.
9393
94-
## Midnight Indexer API
95-
96-
The Midnight Indexer API exposes a GraphQL API that enables clients to query and subscribe to blockchain data—blocks, transactions, contracts, and wallet-related events—indexed from the Midnight blockchain.
97-
98-
The deployed version is **v3**. For the complete GraphQL schema specification, see the [Midnight Indexer GraphQL Schema](https://github.com/midnightntwrk/midnight-indexer/blob/release/3.0.0/indexer-api/graphql/schema-v3.graphql).
99-
100-
### Quick Start
101-
102-
Make your first API call:
103-
```bash
104-
curl -X POST https://midnight-{network}.blockfrost.io/api/v0 \
105-
-H "project_id: YOUR_PROJECT_ID" \
106-
-H "Content-Type: application/json" \
107-
-d '{"query": "{ block { hash height timestamp } }"}'
108-
```
109-
110-
### Endpoint
111-
112-
All GraphQL operations (queries, mutations, and subscriptions) use the same endpoint:
113-
* **HTTP:** `https://midnight-{network}.blockfrost.io/api/v0` (POST requests)
114-
* **WebSocket:** `wss://midnight-{network}.blockfrost.io/api/v0/ws` (for subscriptions)
115-
116-
Where `{network}` is either `mainnet` or `preview`.
117-
118-
### Request Format
119-
120-
Send a POST request with a JSON body containing:
121-
* `query` (required): The GraphQL query, mutation, or subscription string
122-
* `variables` (optional): Variables for the GraphQL operation
123-
124-
Example request:
125-
```json
126-
{
127-
"query": "query GetBlock($offset: BlockOffset) { block(offset: $offset) { hash height } }",
128-
"variables": { "offset": { "height": 100 } },
129-
"operationName": "GetBlock"
130-
}
131-
```
132-
133-
or without variables:
134-
```json
135-
{
136-
"query": "query { block(offset: { height: 100 }) { hash height } }",
137-
}
138-
```
139-
140-
### Response Format
141-
142-
Responses follow the standard GraphQL format:
143-
```json
144-
{
145-
"data": {
146-
"block": {
147-
"hash": "0x1234...",
148-
"height": 100
149-
}
150-
}
151-
}
152-
```
153-
154-
On error:
155-
```json
156-
{
157-
"data": null,
158-
"errors": [
159-
{
160-
"message": "Block not found",
161-
"locations": [{ "line": 1, "column": 1 }],
162-
"path": ["block"]
163-
}
164-
]
165-
}
166-
```
167-
168-
### Authentication
169-
170-
Include your project ID as the `project_id` HTTP header.
171-
172-
When using WebSocket in the browser (which doesn't support custom headers), include your project ID as a subprotocol by prefixing it with `project_id_`:
173-
```javascript
174-
new WebSocket("wss://midnight-preview.blockfrost.io/api/v0/ws", [
175-
"graphql-transport-ws",
176-
"project_id_YOUR_PROJECT_ID"
177-
]);
178-
```
179-
180-
### Scalar Types
181-
182-
The API uses custom scalar types:
183-
184-
| Scalar | Description | Example |
185-
|--------|-------------|---------|
186-
| `HexEncoded` | Hex-encoded bytes (hashes, addresses, session IDs) | `"0x1234abcd..."` |
187-
| `ViewingKey` | Wallet viewing key in Bech32m or hex format | `"mn_shield-esk1abc..."` |
188-
| `CardanoRewardAddress` | Bech32-encoded Cardano reward address | `"stake_test1..."` |
189-
| `UnshieldedAddress` | Bech32m-encoded Midnight unshielded address | `"midnight1..."` |
190-
| `DustAddress` | Bech32m-encoded DUST address | `"midnight1..."` |
191-
| `Unit` | Empty return type for mutations with no data | `null` |
192-
193-
### Query Limits
194-
195-
The server may apply limitations to queries:
196-
* `max-depth`: Maximum nesting depth
197-
* `max-fields`: Maximum number of fields
198-
* `timeout`: Query execution timeout
199-
* `complexity`: Query complexity cost
200-
201-
Requests exceeding limits return errors:
202-
```json
203-
{
204-
"data": null,
205-
"errors": [{ "message": "Query has too many fields: 20. Max fields: 10." }]
206-
}
207-
```
208-
209-
### Pagination with Offsets
210-
211-
Many queries support offsets for pagination:
212-
213-
**BlockOffset** (oneOf - provide exactly one):
214-
* `hash`: Hex-encoded block hash
215-
* `height`: Block height number
216-
217-
**TransactionOffset** (oneOf - provide exactly one):
218-
* `hash`: Hex-encoded transaction hash
219-
* `identifier`: Hex-encoded transaction identifier
220-
221-
**ContractActionOffset** (oneOf - provide exactly one):
222-
* `blockOffset`: A BlockOffset
223-
* `transactionOffset`: A TransactionOffset
224-
225-
Example - fetch block at height 100:
226-
```graphql
227-
query {
228-
block(offset: { height: 100 }) {
229-
hash
230-
height
231-
}
232-
}
233-
```
234-
235-
### Available Operations
236-
237-
* [**Queries**](#tag/Midnight-%C2%BB-Queries): Fetch blockchain data (blocks, transactions, contracts, DUST status, governance parameters)
238-
* [**Mutations**](#tag/Midnight-%C2%BB-Mutations): Wallet connection management (connect/disconnect)
239-
* [**Subscriptions**](#tag/Midnight-%C2%BB-Subscriptions): Real-time updates via WebSocket (blocks, contract actions, transactions, ledger events)
240-
241-
For more information, see the [Midnight Indexer API documentation](https://docs.midnight.network/develop/reference/midnight-api/midnight-indexer).
242-
24394
## Errors
24495
24596
### HTTP Status codes
@@ -382,6 +233,156 @@ info:
382233
</tr>
383234
</tbody>
384235
</table>
236+
237+
238+
## Midnight Indexer API
239+
240+
241+
The Midnight Indexer API exposes a GraphQL API that enables clients to query and subscribe to blockchain data—blocks, transactions, contracts, and wallet-related events—indexed from the Midnight blockchain.
242+
243+
The deployed version is **v3**.
244+
245+
[![Open Midnight GraphQL API Reference](https://img.shields.io/badge/Open_Midnight_GraphQL_API_Reference_→-0033AD?style=for-the-badge)](./midnight/)
246+
247+
For the raw GraphQL schema specification, see the [Midnight Indexer GraphQL Schema](https://github.com/midnightntwrk/midnight-indexer/blob/release/3.0.0/indexer-api/graphql/schema-v3.graphql).
248+
249+
### Quick Start
250+
251+
Make your first API call:
252+
```bash
253+
curl -X POST https://midnight-{network}.blockfrost.io/api/v0 \
254+
-H "project_id: YOUR_PROJECT_ID" \
255+
-H "Content-Type: application/json" \
256+
-d '{"query": "{ block { hash height timestamp } }"}'
257+
```
258+
259+
### Endpoint
260+
261+
All GraphQL operations (queries, mutations, and subscriptions) use the same endpoint:
262+
* **HTTP:** `https://midnight-{network}.blockfrost.io/api/v0` (POST requests)
263+
* **WebSocket:** `wss://midnight-{network}.blockfrost.io/api/v0/ws` (for subscriptions)
264+
265+
Where `{network}` is either `mainnet` or `preview`.
266+
267+
### Request Format
268+
269+
Send a POST request with a JSON body containing:
270+
* `query` (required): The GraphQL query, mutation, or subscription string
271+
* `variables` (optional): Variables for the GraphQL operation
272+
273+
Example request:
274+
```json
275+
{
276+
"query": "query GetBlock($offset: BlockOffset) { block(offset: $offset) { hash height } }",
277+
"variables": { "offset": { "height": 100 } }
278+
}
279+
```
280+
281+
or without variables:
282+
```json
283+
{
284+
"query": "query { block(offset: { height: 100 }) { hash height } }"
285+
}
286+
```
287+
288+
### Response Format
289+
290+
Responses follow the standard GraphQL format:
291+
```json
292+
{
293+
"data": {
294+
"block": {
295+
"hash": "0x1234...",
296+
"height": 100
297+
}
298+
}
299+
}
300+
```
301+
302+
On error:
303+
```json
304+
{
305+
"data": null,
306+
"errors": [
307+
{
308+
"message": "Block not found",
309+
"locations": [{ "line": 1, "column": 1 }],
310+
"path": ["block"]
311+
}
312+
]
313+
}
314+
```
315+
316+
### Authentication
317+
318+
Include your project ID as the `project_id` HTTP header.
319+
320+
When using WebSocket in the browser (which doesn't support custom headers), include your project ID as a subprotocol by prefixing it with `project_id_`:
321+
```javascript
322+
new WebSocket("wss://midnight-preview.blockfrost.io/api/v0/ws", [
323+
"graphql-transport-ws",
324+
"project_id_YOUR_PROJECT_ID"
325+
]);
326+
```
327+
328+
### Scalar Types
329+
330+
The API uses custom scalar types:
331+
332+
| Scalar | Description | Example |
333+
|--------|-------------|---------|
334+
| `HexEncoded` | Hex-encoded bytes (hashes, addresses, session IDs) | `"0x1234abcd..."` |
335+
| `ViewingKey` | Wallet viewing key in Bech32m or hex format | `"mn_shield-esk1abc..."` |
336+
| `CardanoRewardAddress` | Bech32-encoded Cardano reward address | `"stake_test1..."` |
337+
| `UnshieldedAddress` | Bech32m-encoded Midnight unshielded address | `"midnight1..."` |
338+
| `DustAddress` | Bech32m-encoded DUST address | `"midnight1..."` |
339+
| `Unit` | Empty return type for mutations with no data | `null` |
340+
341+
### Query Limits
342+
343+
The server may apply limitations to queries:
344+
* `max-depth`: Maximum nesting depth
345+
* `max-fields`: Maximum number of fields
346+
* `timeout`: Query execution timeout
347+
* `complexity`: Query complexity cost
348+
349+
Requests exceeding limits return errors:
350+
```json
351+
{
352+
"data": null,
353+
"errors": [{ "message": "Query has too many fields: 20. Max fields: 10." }]
354+
}
355+
```
356+
357+
### Pagination with Offsets
358+
359+
Many queries support offsets for pagination:
360+
361+
**BlockOffset** (oneOf - provide exactly one):
362+
* `hash`: Hex-encoded block hash
363+
* `height`: Block height number
364+
365+
**TransactionOffset** (oneOf - provide exactly one):
366+
* `hash`: Hex-encoded transaction hash
367+
* `identifier`: Hex-encoded transaction identifier
368+
369+
**ContractActionOffset** (oneOf - provide exactly one):
370+
* `blockOffset`: A BlockOffset
371+
* `transactionOffset`: A TransactionOffset
372+
373+
Example - fetch block at height 100:
374+
```graphql
375+
query {
376+
block(offset: { height: 100 }) {
377+
hash
378+
height
379+
}
380+
}
381+
```
382+
383+
For the full list of available queries, mutations, subscriptions and types, see
384+
385+
[![GraphQL API Reference →](https://img.shields.io/badge/Midnight_GraphQL_Reference_→-0033AD?style=for-the-badge)](./midnight/)
385386
servers:
386387
- url: https://cardano-mainnet.blockfrost.io/api/v0
387388
description: Cardano Mainnet network

0 commit comments

Comments
 (0)