-
Notifications
You must be signed in to change notification settings - Fork 151
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 route /blocks/{blockId}/extrinsics/{extrinsicIndex} #400
Conversation
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.
LGTM modulo some nits mostly on just on naming/ docs.
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.
Makes sense to me. I think we should switch to use singular form (extrinsicIndex
etc), otherwise lgtm.
src/services/test-helpers/responses/blocks/block789629Extrinsic.json
Outdated
Show resolved
Hide resolved
I agree |
Co-authored-by: Zeke Mostov <[email protected]>
Co-authored-by: Zeke Mostov <[email protected]>
Co-authored-by: Zeke Mostov <[email protected]>
fix: typos, naming, add parseNumberOrThrow fix: revert to parseInt
fix: cleanup block extrinsics controller fix: omitFinalized -> true fix: add test to check parseNumberOrThrow will throw an error if a negative is passed in. Yarn fix
fix: update extrinsic index test to query extrinsic 2 fix: lint
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.
LGTM modulo a nit
…/substrate-api-sidecar into extrinsics-controller
Co-authored-by: Zeke Mostov <[email protected]>
…/substrate-api-sidecar into extrinsics-controller
@TarikGul Thank you very much! |
@gutenye Of course, thank you for bringing up the issue. |
Feat
Added the route
/blocks/{blockId}/extrinsics/{extrinsicsIndex}
Changelog
src/controllers/blocks/BlocksExtrinsicsController.ts
Added:
BlocksExtrinsicsController
. This controller uses theBlocksService
in order to fetch the block, then retrieve the extrinsic.src/services/blocks/BlocksService.ts
Added:
fetchExtrinsicsByIndex
. Fetch's the extrinsic that is requested in the params.src/services/blocks/BlocksService.spec.ts
Added a test 'describe' suite a called
fetchExrinsicsByIndex
.Additionals:
Added mock data in:
src/services/test-helpers/responses/blocks/blocks789629Extrinsic.json
Notes
Inside of the test suite, I had to reuse one line of code between 2 'it' statements. This is because jest was giving me issues with using async in a describe block. It treats it as a nested asynchronous function which will throw a unhandled promise, and abort the test or give inaccurate results.
closes #382