87 lines
1.4 KiB
Plaintext
87 lines
1.4 KiB
Plaintext
import {
|
|
DocBlock,
|
|
DocSideBySide,
|
|
CodeParams,
|
|
Parameter,
|
|
Field,
|
|
Values,
|
|
CodeSnippets,
|
|
} from "../../../components/CodeDocBlock";
|
|
|
|
<DocBlock>
|
|
|
|
## getBlocks
|
|
|
|
Returns a list of confirmed blocks between two slots
|
|
|
|
<DocSideBySide>
|
|
|
|
<CodeParams>
|
|
|
|
### Parameters:
|
|
|
|
<Parameter type={"u64"} required={true}>
|
|
start_slot, as <code>u64</code> integer
|
|
</Parameter>
|
|
|
|
<Parameter type={"u64"} optional={true}>
|
|
end_slot, as <code>u64</code> integer (must be no more than 500,000 blocks
|
|
higher than the `start_slot`)
|
|
</Parameter>
|
|
|
|
<Parameter type={"object"} optional={true}>
|
|
|
|
Configuration object containing the following fields:
|
|
|
|
<Field
|
|
name="commitment"
|
|
type="string"
|
|
optional={true}
|
|
defaultValue={"finalized"}
|
|
href="/api/http#configuring-state-commitment"
|
|
>
|
|
|
|
- "processed" is not supported
|
|
|
|
</Field>
|
|
|
|
</Parameter>
|
|
|
|
### Result:
|
|
|
|
The result field will be an array of u64 integers listing confirmed blocks
|
|
between `start_slot` and either `end_slot` - if provided, or latest confirmed block,
|
|
inclusive. Max range allowed is 500,000 slots.
|
|
|
|
</CodeParams>
|
|
|
|
<CodeSnippets>
|
|
|
|
### Code sample:
|
|
|
|
```bash
|
|
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
|
|
{
|
|
"jsonrpc": "2.0", "id": 1,
|
|
"method": "getBlocks",
|
|
"params": [
|
|
5, 10
|
|
]
|
|
}
|
|
'
|
|
```
|
|
|
|
### Response:
|
|
|
|
```json
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"result": [5, 6, 7, 8, 9, 10],
|
|
"id": 1
|
|
}
|
|
```
|
|
|
|
</CodeSnippets>
|
|
</DocSideBySide>
|
|
</DocBlock>
|