Home / Input Output / cardano-js-sdk
Nov 02, 10-11 AM (0)
Nov 02, 11-12 PM (0)
Nov 02, 12-1 PM (0)
Nov 02, 1-2 PM (0)
Nov 02, 2-3 PM (0)
Nov 02, 3-4 PM (0)
Nov 02, 4-5 PM (0)
Nov 02, 5-6 PM (0)
Nov 02, 6-7 PM (0)
Nov 02, 7-8 PM (0)
Nov 02, 8-9 PM (0)
Nov 02, 9-10 PM (0)
Nov 02, 10-11 PM (0)
Nov 02, 11-12 AM (0)
Nov 03, 12-1 AM (0)
Nov 03, 1-2 AM (0)
Nov 03, 2-3 AM (0)
Nov 03, 3-4 AM (0)
Nov 03, 4-5 AM (0)
Nov 03, 5-6 AM (0)
Nov 03, 6-7 AM (0)
Nov 03, 7-8 AM (0)
Nov 03, 8-9 AM (0)
Nov 03, 9-10 AM (0)
Nov 03, 10-11 AM (0)
Nov 03, 11-12 PM (0)
Nov 03, 12-1 PM (0)
Nov 03, 1-2 PM (0)
Nov 03, 2-3 PM (0)
Nov 03, 3-4 PM (0)
Nov 03, 4-5 PM (0)
Nov 03, 5-6 PM (0)
Nov 03, 6-7 PM (0)
Nov 03, 7-8 PM (0)
Nov 03, 8-9 PM (0)
Nov 03, 9-10 PM (0)
Nov 03, 10-11 PM (0)
Nov 03, 11-12 AM (0)
Nov 04, 12-1 AM (0)
Nov 04, 1-2 AM (0)
Nov 04, 2-3 AM (0)
Nov 04, 3-4 AM (0)
Nov 04, 4-5 AM (0)
Nov 04, 5-6 AM (0)
Nov 04, 6-7 AM (0)
Nov 04, 7-8 AM (0)
Nov 04, 8-9 AM (0)
Nov 04, 9-10 AM (0)
Nov 04, 10-11 AM (0)
Nov 04, 11-12 PM (0)
Nov 04, 12-1 PM (0)
Nov 04, 1-2 PM (0)
Nov 04, 2-3 PM (1)
Nov 04, 3-4 PM (0)
Nov 04, 4-5 PM (0)
Nov 04, 5-6 PM (0)
Nov 04, 6-7 PM (0)
Nov 04, 7-8 PM (0)
Nov 04, 8-9 PM (0)
Nov 04, 9-10 PM (0)
Nov 04, 10-11 PM (0)
Nov 04, 11-12 AM (0)
Nov 05, 12-1 AM (0)
Nov 05, 1-2 AM (0)
Nov 05, 2-3 AM (0)
Nov 05, 3-4 AM (0)
Nov 05, 4-5 AM (0)
Nov 05, 5-6 AM (0)
Nov 05, 6-7 AM (0)
Nov 05, 7-8 AM (0)
Nov 05, 8-9 AM (4)
Nov 05, 9-10 AM (1)
Nov 05, 10-11 AM (1)
Nov 05, 11-12 PM (0)
Nov 05, 12-1 PM (1)
Nov 05, 1-2 PM (0)
Nov 05, 2-3 PM (0)
Nov 05, 3-4 PM (2)
Nov 05, 4-5 PM (0)
Nov 05, 5-6 PM (0)
Nov 05, 6-7 PM (0)
Nov 05, 7-8 PM (0)
Nov 05, 8-9 PM (0)
Nov 05, 9-10 PM (0)
Nov 05, 10-11 PM (0)
Nov 05, 11-12 AM (0)
Nov 06, 12-1 AM (0)
Nov 06, 1-2 AM (0)
Nov 06, 2-3 AM (0)
Nov 06, 3-4 AM (0)
Nov 06, 4-5 AM (0)
Nov 06, 5-6 AM (0)
Nov 06, 6-7 AM (0)
Nov 06, 7-8 AM (0)
Nov 06, 8-9 AM (0)
Nov 06, 9-10 AM (0)
Nov 06, 10-11 AM (0)
Nov 06, 11-12 PM (0)
Nov 06, 12-1 PM (0)
Nov 06, 1-2 PM (5)
Nov 06, 2-3 PM (2)
Nov 06, 3-4 PM (1)
Nov 06, 4-5 PM (0)
Nov 06, 5-6 PM (0)
Nov 06, 6-7 PM (0)
Nov 06, 7-8 PM (0)
Nov 06, 8-9 PM (0)
Nov 06, 9-10 PM (0)
Nov 06, 10-11 PM (0)
Nov 06, 11-12 AM (0)
Nov 07, 12-1 AM (0)
Nov 07, 1-2 AM (0)
Nov 07, 2-3 AM (0)
Nov 07, 3-4 AM (0)
Nov 07, 4-5 AM (0)
Nov 07, 5-6 AM (0)
Nov 07, 6-7 AM (0)
Nov 07, 7-8 AM (0)
Nov 07, 8-9 AM (0)
Nov 07, 9-10 AM (0)
Nov 07, 10-11 AM (0)
Nov 07, 11-12 PM (0)
Nov 07, 12-1 PM (0)
Nov 07, 1-2 PM (2)
Nov 07, 2-3 PM (0)
Nov 07, 3-4 PM (3)
Nov 07, 4-5 PM (0)
Nov 07, 5-6 PM (0)
Nov 07, 6-7 PM (0)
Nov 07, 7-8 PM (0)
Nov 07, 8-9 PM (0)
Nov 07, 9-10 PM (0)
Nov 07, 10-11 PM (0)
Nov 07, 11-12 AM (0)
Nov 08, 12-1 AM (0)
Nov 08, 1-2 AM (0)
Nov 08, 2-3 AM (0)
Nov 08, 3-4 AM (0)
Nov 08, 4-5 AM (0)
Nov 08, 5-6 AM (0)
Nov 08, 6-7 AM (0)
Nov 08, 7-8 AM (0)
Nov 08, 8-9 AM (0)
Nov 08, 9-10 AM (0)
Nov 08, 10-11 AM (0)
Nov 08, 11-12 PM (0)
Nov 08, 12-1 PM (0)
Nov 08, 1-2 PM (0)
Nov 08, 2-3 PM (0)
Nov 08, 3-4 PM (0)
Nov 08, 4-5 PM (0)
Nov 08, 5-6 PM (0)
Nov 08, 6-7 PM (0)
Nov 08, 7-8 PM (0)
Nov 08, 8-9 PM (0)
Nov 08, 9-10 PM (0)
Nov 08, 10-11 PM (0)
Nov 08, 11-12 AM (0)
Nov 09, 12-1 AM (0)
Nov 09, 1-2 AM (0)
Nov 09, 2-3 AM (0)
Nov 09, 3-4 AM (0)
Nov 09, 4-5 AM (0)
Nov 09, 5-6 AM (0)
Nov 09, 6-7 AM (0)
Nov 09, 7-8 AM (0)
Nov 09, 8-9 AM (0)
Nov 09, 9-10 AM (0)
Nov 09, 10-11 AM (0)
23 commits this week Nov 02, 2025 - Nov 09, 2025
refactor(cardano-services-client): remove redundant haveEnoughItems from 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.
fix(cardano-services-client): respect pagination limit in credential-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.
ci: publish packages [skip actions]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
 - @cardano-sdk/[email protected]
refactor(wallet): remove address chunking from UTXO and transaction queries
Remove address-based chunking logic from UtxoTracker and TransactionsTracker.

The chunking was originally implemented for db-sync-based providers which
are now obsolete. Modern Blockfrost providers implement a different query
strategy: they group queries by payment credential (which requires all
addresses to be provided upfront), then execute requests sequentially for
each individual credential or address. This makes the PAGE_SIZE-based
chunking unnecessary and redundant.

BREAKING CHANGE: Wallets with many addresses may exceed provider page size
limits. If using db-sync based providers, configure the server with a large
enough page size limit to accommodate all wallet addresses in a single request.
refactor: move UTXO sorting utilities from input-selection to core
Move sortTxIn and sortUtxoByTxIn from input-selection to core package
to make them available for other packages without creating circular
dependencies.

Changes:
- Add sortTxIn() and sortUtxoByTxIn() to core/src/util/utxo.ts
- Add unit tests for sorting utilities in core (11 test cases)
- Update input-selection to import and re-export from core
- Update BlockfrostUtxoProvider to use sortUtxoByTxIn from core

This allows cardano-services-client to use UTXO sorting without
depending on input-selection, which is a higher-level package.
feat(cardano-services-client): implement credential-based UTXO queries
Implement optimized UTXO fetching using payment credentials and reward
accounts instead of individual addresses, reducing API calls to Blockfrost.

Changes:
- Add fetchUtxosByPaymentCredential() to query by payment credential
- Add fetchUtxosByRewardAccount() with payment credential filtering
- Add mergeAndDeduplicateUtxos() for result consolidation
- Update utxoByAddresses() to support queryUtxosByCredentials flag
- Add comprehensive integration tests with feature flag ON
- Reuse credential extraction/minimization from transaction history

The implementation maintains backward compatibility with feature flag
defaulting to false. When enabled, reduces API calls significantly for
wallets with shared stake keys (e.g., 20 addresses → 1 query).
feat(cardano-services-client): add payment credential filtering utilities for UTXO queries
Implement createPaymentCredentialFilter utility to support filtering UTXOs
by payment credentials. This is needed for querying UTXOs by stake address
(reward account) where we need to ensure we only include UTXOs where we
control the payment credential.

The filter uses a two-tier approach for optimal performance:
- O(1) fast path for exact address matches using Set lookup
- O(1) credential lookup for cross-address-type matching

Includes comprehensive test coverage (21 tests) for all Cardano address
types (Base, Enterprise, Pointer) and credential types (KeyHash, ScriptHash),
plus edge cases (Byron addresses, empty input, duplicates, testnet).
refactor(wallet): remove address chunking from UTXO and transaction queries
Remove address-based chunking logic from UtxoTracker and TransactionsTracker.

The chunking was originally implemented for db-sync-based providers which
are now obsolete. Modern Blockfrost providers implement a different query
strategy: they group queries by payment credential (which requires all
addresses to be provided upfront), then execute requests sequentially for
each individual credential or address. This makes the PAGE_SIZE-based
chunking unnecessary and redundant.

BREAKING CHANGE: Wallets with many addresses may exceed provider page size
limits. If using db-sync based providers, configure the server with a large
enough page size limit to accommodate all wallet addresses in a single request.
refactor: move UTXO sorting utilities from input-selection to core
Move sortTxIn and sortUtxoByTxIn from input-selection to core package
to make them available for other packages without creating circular
dependencies.

Changes:
- Add sortTxIn() and sortUtxoByTxIn() to core/src/util/utxo.ts
- Add unit tests for sorting utilities in core (11 test cases)
- Update input-selection to import and re-export from core
- Update BlockfrostUtxoProvider to use sortUtxoByTxIn from core

This allows cardano-services-client to use UTXO sorting without
depending on input-selection, which is a higher-level package.
feat(cardano-services-client): implement credential-based UTXO queries
Implement optimized UTXO fetching using payment credentials and reward
accounts instead of individual addresses, reducing API calls to Blockfrost.

Changes:
- Add fetchUtxosByPaymentCredential() to query by payment credential
- Add fetchUtxosByRewardAccount() with payment credential filtering
- Add mergeAndDeduplicateUtxos() for result consolidation
- Update utxoByAddresses() to support queryUtxosByCredentials flag
- Add comprehensive integration tests with feature flag ON
- Reuse credential extraction/minimization from transaction history

The implementation maintains backward compatibility with feature flag
defaulting to false. When enabled, reduces API calls significantly for
wallets with shared stake keys (e.g., 20 addresses → 1 query).
feat(cardano-services-client): add payment credential filtering utilities for UTXO queries
Implement createPaymentCredentialFilter utility to support filtering UTXOs
by payment credentials. This is needed for querying UTXOs by stake address
(reward account) where we need to ensure we only include UTXOs where we
control the payment credential.

The filter uses a two-tier approach for optimal performance:
- O(1) fast path for exact address matches using Set lookup
- O(1) credential lookup for cross-address-type matching

Includes comprehensive test coverage (21 tests) for all Cardano address
types (Base, Enterprise, Pointer) and credential types (KeyHash, ScriptHash),
plus edge cases (Byron addresses, empty input, duplicates, testnet).
feat(cardano-services-client): add queryTxsByCredentials feature flag
Add constructor overloads to BlockfrostChainHistoryProvider supporting
opt-in credential-based transaction querying. Feature flag defaults to
false for backward compatibility.

- Add BlockfrostChainHistoryProviderOptions interface
- Implement dual constructor signatures (old + new with options)
- Add constructor overload tests
- Refactor existing tests into "default behavior" suite
feat(cardano-services-client): add credential extraction and minimization utilities
Implements reusable utilities at package root for querying by credentials across providers:

extractCredentials(): Extracts payment credentials and reward accounts from addresses
- Converts payment credentials to CIP-5 bech32 (addr_vkh/script) - network-agnostic
- Converts stake keys to RewardAccount bech32 (stake/stake_test) - includes network ID
- Handles BaseAddress (payment + stake), EnterpriseAddress (payment only)
- Collects Byron and Pointer addresses for fallback

minimizeCredentialSet(): Finds minimal set using greedy algorithm
- Reduces API calls from N addresses to M credentials/accounts
- Prefers payment credentials over reward accounts when coverage is equal

Note: RewardAccount is used for stake keys as it's a stake address (credential + network ID),
which is what we need for API queries - a superset of a pure credential.

Enables optimization in BlockfrostChainHistoryProvider and BlockfrostUtxoProvider.

Ref: LW-13806
feat(core): add PaymentCredential type for CIP-5 bech32 encoding
Introduces PaymentCredential opaque type to represent payment credentials
as bech32-encoded strings following CIP-5 specification. This type supports
both key hash credentials (addr_vkh prefix) and script hash credentials
(script prefix).

This is foundational work for optimizing BlockfrostChainHistoryProvider's
transactionsByAddresses() method. The optimization will group addresses by
their underlying credentials and query Blockfrost's credential-based
endpoints (/addresses/:addr_vkh/transactions and /accounts/:stake_cred/transactions)
instead of querying each address individually. This can reduce API calls
by up to 95% for wallets with many addresses sharing the same stake key.

The PaymentCredential type provides:
- Validation for bech32-encoded payment credentials
- Conversion from Credential objects to bech32 format via fromCredential()
- Type safety through OpaqueString pattern