feat(invoice-escrow): implement batch get_escrows read method - #258
Open
zinodict121 wants to merge 1 commit into
Open
feat(invoice-escrow): implement batch get_escrows read method#258zinodict121 wants to merge 1 commit into
zinodict121 wants to merge 1 commit into
Conversation
|
@zinodict121 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Hi @zinodict121, please rebase your branch on dev to resolve line conflicts in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 batch
get_escrowsread methodFixes #87
Description
This PR implements a paginated batch read method for retrieving escrows, addressing the missing iteration capabilities in the contract as requested in issue #87.
Changes:
types.rs: AddedStorageKey::EscrowCountandStorageKey::EscrowIdByIndex(u32)to maintain a global index of created escrows since Soroban cannot iterate persistent map keys natively.storage.rs: Added helper functions to manage and read the escrow index.lib.rs:create_escrowto append the newly generatedinvoice_idinto the global index.get_escrows(env, start, limit)function to fetch paginated escrow records.limit == 0(InvalidLimit) and rejects limits aboveMAX_PAGE_SIZEof 100 (LimitExceeded). Handlesstart >= total_countgracefully by returning an empty vector.errors.rs: AddedError::InvalidLimit(17) andError::LimitExceeded(18) following the existing enumeration format.test.rs: Added comprehensive test cases including empty state, populated page slicing, invalid limits, and pagination boundaries.Notes
get_escrow) do not emit events.