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

feat(api): Add include_transactions parameter to the BlockAtHeightResource #1046

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

msbrogli
Copy link
Member

@msbrogli msbrogli commented Jun 3, 2024

Motivation

Some use cases can benefit from getting the list of transactions confirmed by a block, facilitating internal tasks and reducing the number of API calls.

Acceptance Criteria

  1. Add include_transactions: str | None to BlockAtHeightResource.render_GET.
  2. If include_transactions == "txid", the response will have a new key tx_ids: list[str] with a list of tx ids in hex format.
  3. If include_transactions == "full", the response will have a new key transactions: list[dict] with a list of tx details got from tx.to_json_extended().
  4. Refactor argument parser to use QueryParams.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@msbrogli msbrogli requested a review from jansegre as a code owner June 3, 2024 14:59
@msbrogli msbrogli self-assigned this Jun 3, 2024
@msbrogli msbrogli added the enhancement New feature or request label Jun 3, 2024
@msbrogli msbrogli force-pushed the feat/block_at_height-include-txs branch 2 times, most recently from 92dfc3a to e6eb0ec Compare June 3, 2024 15:22
jansegre
jansegre previously approved these changes Jun 3, 2024
@msbrogli msbrogli force-pushed the feat/block_at_height-include-txs branch from e6eb0ec to 057950d Compare June 3, 2024 15:30
@msbrogli msbrogli force-pushed the feat/block_at_height-include-txs branch from 057950d to 871b1f0 Compare June 3, 2024 15:47
@msbrogli msbrogli force-pushed the feat/block_at_height-include-txs branch from 871b1f0 to 8e9bfbc Compare June 3, 2024 16:20
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

Attention: Patch coverage is 97.14286% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 84.93%. Comparing base (398ccd7) to head (8e9bfbc).
Report is 4 commits behind head on master.

Files Patch % Lines
hathor/transaction/resources/block_at_height.py 96.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1046      +/-   ##
==========================================
- Coverage   84.97%   84.93%   -0.04%     
==========================================
  Files         297      297              
  Lines       22917    22927      +10     
  Branches     3466     3470       +4     
==========================================
  Hits        19473    19473              
- Misses       2763     2768       +5     
- Partials      681      686       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@msbrogli msbrogli merged commit 8e9bfbc into master Jun 3, 2024
12 checks passed
@msbrogli msbrogli deleted the feat/block_at_height-include-txs branch June 3, 2024 19:24
@jansegre jansegre mentioned this pull request Jun 3, 2024
2 tasks
@jansegre jansegre mentioned this pull request Jul 25, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants