-
Notifications
You must be signed in to change notification settings - Fork 150
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
feat: add pallets/events endpoint #1204
Conversation
add unit tests add e2e test
fix conflicts
add unhappy path check to fetchEventItem unit tests
fix merge conflicts
src/services/test-helpers/responses/pallets/fetchProposedEventItem789629.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, really great job just a few nits
refactored events items assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, Great Job! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While connected to Kusama and testing the events
endpoint
http://127.0.0.1:8080/pallets/12/events
I get the following result
{
"code": 400,
"message": "\"12\" was not recognized as a queryable pallet.",
"stack": "BadRequestError: \"12\" was not recognized as a queryable pallet.\n at PalletsEventsService.findPalletMeta (/Users/tiny_imod/Documents/Parity/substrate-api-sidecar/build/src/services/AbstractPalletsService.js:91:19)\n at PalletsEventsService.fetchEvents (/Users/tiny_imod/Documents/Parity/substrate-api-sidecar/build/src/services/pallets/PalletsEventsService.js:48:50)\n at PalletsEventsController.getEvents (/Users/tiny_imod/Documents/Parity/substrate-api-sidecar/build/src/controllers/pallets/PalletsEventsController.js:43:75)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async /Users/tiny_imod/Documents/Parity/substrate-api-sidecar/build/src/controllers/AbstractController.js:226:9",
"level": "error"
}
and this means that pallet 12
(AuthorityDiscovery pallet) has no events to query right ?
Isn't the error message
"message": "\"12\" was not recognized as a queryable pallet."
a little bit misleading though ? From this error message I understand that there is no pallet with this index instead of saying that the are no events
in this pallet to query.
I believe this error message is triggered here so I was wondering if it is easy to check and add a more explanatory error message in the case of the info missing in the specific pallet. The same happens when I query the errors
endpoint also. Just an idea in case it is possible.
…ata has no items to query of a specific field type
Thats correct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I request the events
of the utility
pallet while connected to Kusama :
✅ I get the response with the events when I query by pallet index
❌ I get an error message when I query by pallet name
From what I have seen this only happens for the Utility pallet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and now it works like a charm! 💯 Awesome !
Summary: An endpoint that returns the events for a given pallet
/pallets/{palletId}/events
Query Params
at
: Which block to query, it will default to the latest finalized block. Accepts a hash or blocknumberonlyIds
: boolean to return only the Id of each event instead of the entirety of each eventSample response for /pallets/democracy/events?onlyIds=true
/pallets/{palletId}/events/{eventItemId}
Query Params
at
: Which block to query, it will default to the latest finalized block. Accepts a hash or blocknumbermetadata
: boolean to choose whether to include an events' metadata in the responseSample response for /pallets/democracy/events/ExternalTabled