Skip to content

feat(nc-history-order): Add order param to NCHistoryResource#1528

Merged
jansegre merged 3 commits intoHathorNetwork:masterfrom
jackal-thothid:feat/add-order-nc-history
Jan 21, 2026
Merged

feat(nc-history-order): Add order param to NCHistoryResource#1528
jansegre merged 3 commits intoHathorNetwork:masterfrom
jackal-thothid:feat/add-order-nc-history

Conversation

@jackal-thothid
Copy link
Contributor

Motivation

I currently maintain a database to store only the first Nano Contract history record, which requires manual data insertion. Since this information can be retrieved via the Hathor-Core API, the lack of result ordering in the /nano_contract/history endpoint forces full dataset iteration even when only the first entry is needed, causing unnecessary computational overhead.

Acceptance Criteria

  • Add an order parameter to the /nano_contract/history endpoint
  • Allow results to be ordered (e.g., oldest → newest or newest → oldest)
  • Enable fetching only the first relevant record without iterating through the full history
  • Maintain backward compatibility when the order parameter is not provided

@jansegre jansegre moved this from Todo to In Progress (Done) in Hathor Network Dec 23, 2025
@jansegre jansegre self-assigned this Dec 23, 2025
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Dec 30, 2025
@jansegre jansegre changed the title Feat(nc-history-order): Add order param to NCHistoryResource feat(nc-history-order): Add order param to NCHistoryResource Jan 6, 2026
Copy link
Member

@jansegre jansegre left a comment

Choose a reason for hiding this comment

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

Before it can be merged please make sure the linter/tests are passing and include a unittest to hathor_tests/resources/nanocontracts/test_history.py that covers the use of the new param. Other than that it looks good to me.

@jackal-thothid
Copy link
Contributor Author

Before it can be merged please make sure the linter/tests are passing and include a unittest to hathor_tests/resources/nanocontracts/test_history.py that covers the use of the new param. Other than that it looks good to me.

Ok, Done 👍🏻

@jansegre jansegre force-pushed the feat/add-order-nc-history branch from b442f73 to fccdc33 Compare January 19, 2026 16:33
@jansegre jansegre requested a review from glevco January 19, 2026 16:34
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 65.21739% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.30%. Comparing base (e8640de) to head (2b683a8).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hathor/nanocontracts/resources/history.py 61.90% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1528      +/-   ##
==========================================
- Coverage   86.34%   86.30%   -0.05%     
==========================================
  Files         437      437              
  Lines       33610    33620      +10     
  Branches     5248     5248              
==========================================
- Hits        29022    29017       -5     
- Misses       3586     3598      +12     
- Partials     1002     1005       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@glevco glevco moved this from In Review (WIP) to In Review (Done) in Hathor Network Jan 21, 2026
@jansegre jansegre force-pushed the feat/add-order-nc-history branch from fccdc33 to 3400c45 Compare January 21, 2026 16:32
@jansegre jansegre force-pushed the feat/add-order-nc-history branch from 3400c45 to 2b683a8 Compare January 21, 2026 17:06
@jansegre jansegre merged commit 630aa4e into HathorNetwork:master Jan 21, 2026
10 of 11 checks passed
@github-project-automation github-project-automation bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Jan 21, 2026
@jansegre jansegre mentioned this pull request Jan 21, 2026
2 tasks
@jansegre jansegre moved this from Waiting to be deployed to Done in Hathor Network Jan 21, 2026
@jansegre jansegre mentioned this pull request Jan 21, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants