Skip to content

Conversation

@TarikGul
Copy link
Member

Summary

Adds useRcBlockFormat query parameter to control response format when using useRcBlock=true.

  • array (default): Returns existing array format
  • object: Wraps response with rcBlock info and parachainDataPerBlock array

Example

GET /accounts/{accountId}/balance-info?at=1000000&useRcBlock=true&useRcBlockFormat=object

Returns:

{
  "rcBlock": {
    "hash": "0x...",
    "parentHash": "0x...",
    "number": "1000000"
  },
  "parachainDataPerBlock": [...]
}

@TarikGul TarikGul requested a review from a team as a code owner January 10, 2026 15:41
@TarikGul
Copy link
Member Author

closes: #1821

Copy link
Collaborator

@andrew-ifrita andrew-ifrita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, so I will approve.

It may be a cleaner and cut down on all the duplication if we just have a responseFormatter middleware. It will also cut down on human error as endpoints are added and changed if someone forgets to add this formatting. It also give a single place to look for output formatting, which we could later document and would probably be nice to know as a developer coming in with little context.

Naming-wise, I would consider a better name, but I am not sure what to suggest. Something like format=rc might work and might be more intuitive and flexible but I am uncertain on the naming side.

@TarikGul
Copy link
Member Author

responseFormatter middleware

I totally agree, i think this would be a good ethos to bring to polkadot-rest-api. I'll merge for now and create a follow up issue.

@TarikGul TarikGul merged commit 59b88c9 into master Jan 21, 2026
14 checks passed
@TarikGul TarikGul deleted the tg-use-rc-block-format branch January 21, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants