feat: Implement Paginated get_transaction_history Function in Budget Contract #45 #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Implement Paginated
get_transaction_historyin Budget Contract✅ Overview
This PR introduces the
get_transaction_historyfunction in theBudgetcontract to enable paginated retrieval of transactions. The goal is to enhance transparency and ensure scalable access to financial history with optimized gas usage.closes #45
🛠️ Changes Made
get_transaction_history(page: u64, page_size: u64)to theBudgetcontract.page > 0→ returnsERROR_INVALID_PAGEif invalid.1 <= page_size <= 100→ returnsERROR_INVALID_PAGE_SIZEotherwise.ERROR_INVALID_PAGEif the page exceeds the transaction count.Result<Array<Transaction>, felt252>with the selected page of transactions.IBudgetinterface with full NatSpec documentation.🧪 Unit Tests
page == 0→ERROR_INVALID_PAGEpage_size == 0or> 100→ERROR_INVALID_PAGE_SIZEERROR_INVALID_PAGE⛽ Gas & Performance
📘 Documentation
IBudgetusing NatSpec.✅ Acceptance Criteria
Array<Transaction>correctly.This PR enables efficient and scalable access to transaction history while aligning with the Budget contract’s core mission of transparency and financial accountability.
Looking forward to your review! 🙌