Skip to content

fix: respect pagination limit in credential queries#1671

Merged
mkazlauskas merged 2 commits into
masterfrom
fix/by-credential-limit
Nov 7, 2025
Merged

fix: respect pagination limit in credential queries#1671
mkazlauskas merged 2 commits into
masterfrom
fix/by-credential-limit

Conversation

@mkazlauskas

Copy link
Copy Markdown
Member

Context

See commit messages

…based transaction queries

When queryTxsByCredentials is enabled, fetchTransactionsByPaymentCredential
and fetchTransactionsByRewardAccount were fetching ALL pages from Blockfrost
instead of stopping once enough transactions were retrieved. This caused
unnecessary API calls and performance issues.

Changes:
- Add FetchTransactionsOptions interface to document and deduplicate options
- Implement proper haveEnoughItems logic (was: () => false, now: checks limit)
- Extract common pagination logic into fetchTransactionsWithPagination
- Pass limit parameter through the call chain
- Cap page size at 100 (Blockfrost's max) to enable proper pagination

The fix ensures credential-based queries behave identically to address-based
queries, fetching only the necessary pages to satisfy the requested limit.
…rom UTXO queries

The haveEnoughItems parameter with value () => false is redundant in
fetchUtxosByPaymentCredential and fetchUtxosByRewardAccount. When not
specified, fetchSequentially defaults to fetching all pages, which is
the correct behavior for UTXO queries (they should return all UTXOs).

This aligns credential-based UTXO queries with the by-address reference
implementation which also omits haveEnoughItems.
@mkazlauskas mkazlauskas requested a review from ljagiela November 7, 2025 14:28
@mkazlauskas mkazlauskas merged commit a562685 into master Nov 7, 2025
7 of 9 checks passed
@mkazlauskas mkazlauskas deleted the fix/by-credential-limit branch November 7, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants