Skip to content

Commit 2e58f6c

Browse files
committed
Update the docs
1 parent 8853a09 commit 2e58f6c

File tree

5 files changed

+707
-11
lines changed

5 files changed

+707
-11
lines changed

docs-v2/dist/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-v2/guides/USE_RC_BLOCK_SPEC.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ The `useRcBlock` parameter is a boolean parameter that works in conjunction with
2424

2525
**Block Finalization Note**: The `useRcBlock` parameter does not make any assumptions about whether the block you pass is finalized or a best block. It is recommended to ensure the block you are passing is finalized if block finalization is important for your use case.
2626

27+
### useRcBlockFormat Parameter
28+
The `useRcBlockFormat` parameter controls the response format when using `useRcBlock=true`. This parameter is only valid when `useRcBlock=true` is specified.
29+
30+
**Values:**
31+
- `array` (default): Returns the standard array format with enhanced metadata
32+
- `object`: Wraps the response in an object containing relay chain block info and the parachain data array
33+
34+
**Validation**: Using `useRcBlockFormat` without `useRcBlock=true` will return a `400 Bad Request` error.
35+
2736
## Implementation: useRcBlock Query Parameter
2837

2938
### Core Functionality
@@ -40,6 +49,10 @@ GET /pallets/staking/progress?at=1000000&useRcBlock=true
4049
GET /accounts/{accountId}/balance-info?at=0x123abc&useRcBlock=true
4150
GET /blocks/head?useRcBlock=true
4251
GET /blocks/12345?at=12345&useRcBlock=true
52+
53+
# With useRcBlockFormat=object for wrapped response format
54+
GET /pallets/staking/progress?at=1000000&useRcBlock=true&useRcBlockFormat=object
55+
GET /accounts/{accountId}/balance-info?at=0x123abc&useRcBlock=true&useRcBlockFormat=object
4356
```
4457

4558
### Response Format Changes
@@ -52,7 +65,7 @@ Returns single response object (unchanged):
5265
}
5366
```
5467

55-
**With useRcBlock=true:**
68+
**With useRcBlock=true (default array format):**
5669
Returns array format with additional metadata:
5770
```json
5871
[{
@@ -65,6 +78,38 @@ Returns array format with additional metadata:
6578

6679
Or empty array `[]` if no corresponding Asset Hub block exists.
6780

81+
**With useRcBlock=true&useRcBlockFormat=object:**
82+
Returns object format wrapping the data with relay chain block info:
83+
```json
84+
{
85+
"rcBlock": {
86+
"hash": "0x1234567890abcdef...",
87+
"parentHash": "0xabcdef1234567890...",
88+
"number": "1000000"
89+
},
90+
"parachainDataPerBlock": [
91+
{
92+
// ... existing endpoint response data
93+
"rcBlockHash": "0x1234567890abcdef...",
94+
"rcBlockNumber": "1000000",
95+
"ahTimestamp": "1642694400"
96+
}
97+
]
98+
}
99+
```
100+
101+
Or with empty `parachainDataPerBlock` array if no corresponding Asset Hub block exists:
102+
```json
103+
{
104+
"rcBlock": {
105+
"hash": "0x1234567890abcdef...",
106+
"parentHash": "0xabcdef1234567890...",
107+
"number": "1000000"
108+
},
109+
"parachainDataPerBlock": []
110+
}
111+
```
112+
68113
## Supported Endpoints
69114

70115
### Block Endpoints Supporting useRcBlock:
@@ -90,7 +135,8 @@ When `useRcBlock=true` is used, responses include additional context fields:
90135
- `rcBlockHash`: The relay chain block hash
91136
- `rcBlockNumber`: The relay chain block number
92137
- `ahTimestamp`: The Asset Hub block timestamp
93-
- Array format prepares for future elastic scaling scenarios
138+
- Array format (default) prepares for future elastic scaling scenarios
139+
- Object format (`useRcBlockFormat=object`) provides relay chain block metadata wrapper with `rcBlock` info (hash, parentHash, number) and `parachainDataPerBlock` array
94140

95141
### Backward Compatibility
96142
- Defaults to `false`, maintaining existing functionality when not specified
@@ -104,9 +150,11 @@ When `useRcBlock=true` is used, responses include additional context fields:
104150

105151
### Validation Logic
106152
The `validateUseRcBlock` middleware ensures:
107-
1. **Boolean validation**: Must be "true" or "false" string
153+
1. **Boolean validation**: `useRcBlock` must be "true" or "false" string
108154
2. **Asset Hub requirement**: Only works when connected to Asset Hub
109155
3. **Relay chain availability**: Requires relay chain API configuration via `SAS_SUBSTRATE_MULTI_CHAIN_URL`
156+
4. **useRcBlockFormat dependency**: `useRcBlockFormat` requires `useRcBlock=true` to be specified
157+
5. **useRcBlockFormat values**: Must be either "array" or "object" string
110158

111159
## Multi-Block and Elastic Scaling Scenarios
112160

0 commit comments

Comments
 (0)