Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend returning info in the getValidators() API #161

Merged
merged 23 commits into from
Jun 26, 2024

Conversation

owl352
Copy link
Collaborator

@owl352 owl352 commented Jun 22, 2024

Issue

To finish validators page (#152), we need to add few metadata fields in the response of the getValidators() query with such data:

Total proposed blocks count
Last proposed block height ( + timestamp)

Things Done

Now in response to getValidators and getValidatorByProTxHash query we get data of this format:

{
  "proTxHash": "F60A6BF9EC0794BB0CFD1E0F2217933F4B33EDE6FE810692BC275CA18148AEF0",
  "blocksCount": 5,
  "lastProposedBlockHeader": {
    "height": 5,
    "timestamp": "2024-06-23T13:51:44.154Z",
    "hash": "7253F441FF6AEAC847F9E03672B9386E35FC8CBCFC4A7CC67557FCA10E342904",
    "l1LockedHeight": 1337,
    "appVersion": 1,
    "blockVersion": 13
  }
}

To get the new fields it was necessary to realize one more database access, but already in the blocks table, then process the data and after that produce a response.
Tests have also been adjusted to work with the new data
README.md was updated with information about getValidators and getValidatorByProTxHash

Copy link

vercel bot commented Jun 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
platform-explorer-zham ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 1:35pm

@owl352 owl352 closed this Jun 22, 2024
@owl352 owl352 reopened this Jun 22, 2024
@owl352 owl352 added the backend Related to backend (API) label Jun 22, 2024
@owl352 owl352 self-assigned this Jun 22, 2024
@owl352 owl352 linked an issue Jun 22, 2024 that may be closed by this pull request
packages/api/src/dao/ValidatorsDAO.js Outdated Show resolved Hide resolved
packages/api/src/dao/ValidatorsDAO.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/src/models/Validator.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/api/test/integration/validators.spec.js Outdated Show resolved Hide resolved
packages/frontend/src/app/api/content.md Show resolved Hide resolved
Copy link
Owner

@pshenmic pshenmic left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good to me

@pshenmic pshenmic merged commit 0ee8995 into master Jun 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend (API)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend returning info in the getValidators() API
2 participants