BlockfrostProvider

scalus.cardano.node.BlockfrostProvider
See theBlockfrostProvider companion object
class BlockfrostProvider(apiKey: String, baseUrl: String, maxConcurrentRequests: Int, initialCardanoInfo: CardanoInfo)(using backend: Backend[Future], ec: ExecutionContext) extends BlockchainProvider

Blockfrost-based Provider for Cardano blockchain operations.

Use the async factory methods in the companion object to create instances: BlockfrostProvider.preview(apiKey), BlockfrostProvider.mainnet(apiKey), etc. These fetch protocol parameters during construction so that cardanoInfo is immediately available.

Value parameters

apiKey

Blockfrost API key

baseUrl

Blockfrost API base URL

initialCardanoInfo

CardanoInfo with protocol parameters (fetched during async construction)

maxConcurrentRequests

Maximum concurrent HTTP requests

Attributes

Companion
object
Graph
Supertypes
trait BlockchainProviderTF[Future]
trait BlockchainReaderTF[Future]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def cardanoInfo: CardanoInfo

Returns CardanoInfo for this reader.

Returns CardanoInfo for this reader.

This is always available synchronously after the reader is constructed. For emulators, this returns the current context. For remote providers like BlockfrostProvider, the CardanoInfo is fetched during async construction.

Attributes

Definition Classes
override def checkTransaction(txHash: TransactionHash): Future[TransactionStatus]

Check the status of a transaction on the blockchain.

Check the status of a transaction on the blockchain.

Default implementation checks for UTxOs from the transaction. For emulators without a mempool concept, this returns either Confirmed or NotFound.

Attributes

Definition Classes
def currentSlot: Future[SlotNo]

Returns the current slot number.

Returns the current slot number.

Attributes

override def executionContext: ExecutionContext

Returns the ExecutionContext captured by this reader.

Returns the ExecutionContext captured by this reader.

This is used internally by default method implementations. External code can use this when working with Futures returned by reader methods, or provide their own.

Attributes

Definition Classes
def fetchAccount(stakeAddress: String): Future[AccountInfo]

Fetch account info by stake address. GET /accounts/{stake_address}

Fetch account info by stake address. GET /accounts/{stake_address}

Attributes

def fetchAccountAddresses(stakeAddress: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AccountAddress]]

Fetch addresses associated with account. GET /accounts/{stake_address}/addresses

Fetch addresses associated with account. GET /accounts/{stake_address}/addresses

Attributes

def fetchAccountDelegations(stakeAddress: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AccountDelegation]]

Fetch account delegation history. GET /accounts/{stake_address}/delegations

Fetch account delegation history. GET /accounts/{stake_address}/delegations

Attributes

def fetchAccountRegistrations(stakeAddress: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AccountRegistration]]

Fetch account registration history. GET /accounts/{stake_address}/registrations

Fetch account registration history. GET /accounts/{stake_address}/registrations

Attributes

def fetchAccountRewards(stakeAddress: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AccountReward]]

Fetch account reward history. GET /accounts/{stake_address}/rewards

Fetch account reward history. GET /accounts/{stake_address}/rewards

Attributes

def fetchAccountUtxos(stakeAddress: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Either[UtxoQueryError, Utxos]]

Fetch UTxOs for a stake address. GET /accounts/{stake_address}/utxos

Fetch UTxOs for a stake address. GET /accounts/{stake_address}/utxos

Attributes

def fetchAddressInfo(address: String): Future[AddressInfo]

Fetch address info. GET /addresses/{address}

Fetch address info. GET /addresses/{address}

Attributes

def fetchAddressTransactions(address: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AddressTransaction]]

Fetch transactions for an address. GET /addresses/{address}/transactions

Fetch transactions for an address. GET /addresses/{address}/transactions

Attributes

def fetchAddressTxHashes(address: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[String]]

Fetch transaction hashes for an address. GET /addresses/{address}/txs

Fetch transaction hashes for an address. GET /addresses/{address}/txs

Attributes

def fetchApiRoot: Future[ApiRootInfo]

Fetch API root info. GET /

Fetch API root info. GET /

Attributes

def fetchAsset(asset: String): Future[AssetInfo]

Fetch asset info. GET /assets/{asset}

Fetch asset info. GET /assets/{asset}

Attributes

def fetchAssetAddresses(asset: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AssetAddress]]

Fetch addresses holding an asset. GET /assets/{asset}/addresses

Fetch addresses holding an asset. GET /assets/{asset}/addresses

Attributes

def fetchAssetTransactions(asset: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[AssetTransaction]]

Fetch transactions involving an asset. GET /assets/{asset}/transactions

Fetch transactions involving an asset. GET /assets/{asset}/transactions

Attributes

def fetchBlock(hashOrNumber: String): Future[BlockInfo]

Fetch a block by hash or number. GET /blocks/{hash_or_number}

Fetch a block by hash or number. GET /blocks/{hash_or_number}

Attributes

def fetchBlockAddresses(hashOrNumber: String, page: Option[Int] = ..., count: Int = ...): Future[Seq[BlockAddress]]

Fetch addresses affected in a block. GET /blocks/{hash_or_number}/addresses

Fetch addresses affected in a block. GET /blocks/{hash_or_number}/addresses

Attributes

def fetchBlockBySlot(slot: Long): Future[BlockInfo]

Fetch a block by slot number. GET /blocks/slot/{slot_number}

Fetch a block by slot number. GET /blocks/slot/{slot_number}

Attributes

def fetchBlockNext(hashOrNumber: String, page: Option[Int] = ..., count: Int = ...): Future[Seq[BlockInfo]]

Fetch subsequent blocks. GET /blocks/{hash_or_number}/next

Fetch subsequent blocks. GET /blocks/{hash_or_number}/next

Attributes

def fetchBlockPrevious(hashOrNumber: String, page: Option[Int] = ..., count: Int = ...): Future[Seq[BlockInfo]]

Fetch preceding blocks. GET /blocks/{hash_or_number}/previous

Fetch preceding blocks. GET /blocks/{hash_or_number}/previous

Attributes

def fetchBlockTxs(hashOrNumber: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[String]]

Fetch transaction hashes in a block. GET /blocks/{hash_or_number}/txs

Fetch transaction hashes in a block. GET /blocks/{hash_or_number}/txs

Attributes

def fetchDatum(datumHash: String): Future[Data]

Fetch and parse datum by hash, returning a Data value.

Fetch and parse datum by hash, returning a Data value.

Attributes

def fetchDatumCbor(datumHash: String): Future[ByteString]

Fetch datum CBOR by datum hash. GET /scripts/datum/{hash}/cbor

Fetch datum CBOR by datum hash. GET /scripts/datum/{hash}/cbor

Attributes

def fetchDatumJson(datumHash: String): Future[Value]

Fetch datum as JSON by datum hash. GET /scripts/datum/{hash}

Fetch datum as JSON by datum hash. GET /scripts/datum/{hash}

Attributes

def fetchDrep(drepId: String): Future[DrepInfo]

Fetch DRep info by ID. GET /governance/dreps/{drep_id}

Fetch DRep info by ID. GET /governance/dreps/{drep_id}

Attributes

def fetchEpochBlocks(epoch: Long, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[String]]

Fetch block hashes in an epoch. GET /epochs/{number}/blocks

Fetch block hashes in an epoch. GET /epochs/{number}/blocks

Attributes

def fetchGenesis: Future[GenesisInfo]

Fetch blockchain genesis parameters. GET /genesis

Fetch blockchain genesis parameters. GET /genesis

Attributes

def fetchHealth: Future[HealthStatus]

Fetch API health status. GET /health

Fetch API health status. GET /health

Attributes

Fetch API server clock. GET /health/clock

Fetch API server clock. GET /health/clock

Attributes

Fetch the latest block. GET /blocks/latest

Fetch the latest block. GET /blocks/latest

Attributes

def fetchLatestBlockTxs(page: Option[Int] = ..., count: Int = ...): Future[Seq[String]]

Fetch transaction hashes in the latest block. GET /blocks/latest/txs

Fetch transaction hashes in the latest block. GET /blocks/latest/txs

Attributes

Fetches the latest protocol parameters from the network.

Fetches the latest protocol parameters from the network.

Attributes

def fetchMetadataByLabel(label: Long, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[TxMetadataJson]]

Fetch transaction metadata by label as JSON. GET /metadata/txs/labels/{label}

Fetch transaction metadata by label as JSON. GET /metadata/txs/labels/{label}

Attributes

def fetchMetadataByLabelCbor(label: Long, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[TxMetadataCbor]]

Fetch transaction metadata by label as CBOR. GET /metadata/txs/labels/{label}/cbor

Fetch transaction metadata by label as CBOR. GET /metadata/txs/labels/{label}/cbor

Attributes

def fetchNetwork: Future[NetworkInfo]

Fetch network info (supply, stake). GET /network

Fetch network info (supply, stake). GET /network

Attributes

def fetchNetworkEras: Future[Seq[EraInfo]]

Fetch network era summaries. GET /network/eras

Fetch network era summaries. GET /network/eras

Attributes

def fetchParamsOfEpoch(epoch: Long): Future[ProtocolParams]
def fetchPoolDelegators(poolId: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[PoolDelegator]]

Fetch pool delegators. GET /pools/{pool_id}/delegators

Fetch pool delegators. GET /pools/{pool_id}/delegators

Attributes

def fetchPoolHistory(poolId: String, page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[PoolHistoryEntry]]

Fetch pool history. GET /pools/{pool_id}/history

Fetch pool history. GET /pools/{pool_id}/history

Attributes

def fetchPoolsExtended(page: Option[Int] = ..., count: Int = ..., order: String = ...): Future[Seq[PoolExtended]]

Fetch extended pool list. GET /pools/extended

Fetch extended pool list. GET /pools/extended

Attributes

def fetchScriptCbor(scriptHash: String): Future[ByteString]

Fetch script CBOR by hash. GET /scripts/{hash}/cbor

Fetch script CBOR by hash. GET /scripts/{hash}/cbor

Attributes

def fetchScriptInfo(scriptHash: String): Future[ScriptInfo]

Fetch script info by hash. GET /scripts/{hash}

Fetch script info by hash. GET /scripts/{hash}

Attributes

def fetchScriptJson(scriptHash: String): Future[Value]

Fetch script as JSON (for native/timelock scripts). GET /scripts/{hash}/json

Fetch script as JSON (for native/timelock scripts). GET /scripts/{hash}/json

Attributes

def fetchTransactionCbor(txHash: String): Future[ByteString]

Fetch transaction CBOR. GET /txs/{hash}/cbor

Fetch transaction CBOR. GET /txs/{hash}/cbor

Attributes

def fetchTransactionDelegations(txHash: String): Future[Seq[TransactionDelegation]]

Fetch transaction delegation certificates. GET /txs/{hash}/delegations

Fetch transaction delegation certificates. GET /txs/{hash}/delegations

Returns empty sequence if the transaction has no delegations (404).

Attributes

def fetchTransactionInfo(txHash: String): Future[TransactionInfo]

Fetch transaction details. GET /txs/{hash}

Fetch transaction details. GET /txs/{hash}

Attributes

def fetchTransactionMetadata(txHash: String): Future[Seq[TransactionMetadataEntry]]

Fetch transaction metadata as JSON. GET /txs/{hash}/metadata

Fetch transaction metadata as JSON. GET /txs/{hash}/metadata

Returns empty sequence if the transaction has no metadata (404).

Attributes

Fetch transaction metadata as CBOR. GET /txs/{hash}/metadata/cbor

Fetch transaction metadata as CBOR. GET /txs/{hash}/metadata/cbor

Returns empty sequence if the transaction has no metadata (404).

Attributes

def fetchTransactionMirs(txHash: String): Future[Seq[TransactionMir]]

Fetch transaction MIR certificates. GET /txs/{hash}/mirs

Fetch transaction MIR certificates. GET /txs/{hash}/mirs

Returns empty sequence if the transaction has no MIRs (404).

Attributes

def fetchTransactionPoolRetires(txHash: String): Future[Seq[TransactionPoolRetire]]

Fetch transaction pool retirement certificates. GET /txs/{hash}/pool_retires

Fetch transaction pool retirement certificates. GET /txs/{hash}/pool_retires

Returns empty sequence if the transaction has no pool retirements (404).

Attributes

def fetchTransactionPoolUpdates(txHash: String): Future[Seq[TransactionPoolUpdate]]

Fetch transaction pool update certificates. GET /txs/{hash}/pool_updates

Fetch transaction pool update certificates. GET /txs/{hash}/pool_updates

Returns empty sequence if the transaction has no pool updates (404).

Attributes

def fetchTransactionRedeemers(txHash: String): Future[Seq[TransactionRedeemer]]

Fetch transaction redeemers. GET /txs/{hash}/redeemers

Fetch transaction redeemers. GET /txs/{hash}/redeemers

Returns empty sequence if the transaction has no redeemers (404).

Attributes

def fetchTransactionStakes(txHash: String): Future[Seq[TransactionStake]]

Fetch transaction stake address certificates. GET /txs/{hash}/stakes

Fetch transaction stake address certificates. GET /txs/{hash}/stakes

Returns empty sequence if the transaction has no stake certificates (404).

Attributes

def fetchTransactionWithdrawals(txHash: String): Future[Seq[TransactionWithdrawal]]

Fetch transaction withdrawals. GET /txs/{hash}/withdrawals

Fetch transaction withdrawals. GET /txs/{hash}/withdrawals

Returns empty sequence if the transaction has no withdrawals (404).

Attributes

override def findUtxos(query: UtxoQuery): Future[Either[UtxoQueryError, Utxos]]

Find UTxOs using a type-safe query.

Find UTxOs using a type-safe query.

Value parameters

query

The query specifying source, filters, and pagination

Attributes

Returns

Either a UtxoQueryError or the matching UTxOs

Definition Classes
override def getDatum(datumHash: DataHash): Future[Option[Data]]

Look up a datum by its hash. Returns None if unknown.

Look up a datum by its hash. Returns None if unknown.

Attributes

Definition Classes
override def pollForConfirmation(txHash: TransactionHash, maxAttempts: Int = ..., delayMs: Long = ...): Future[TransactionStatus]

Poll for transaction confirmation.

Poll for transaction confirmation.

Default implementation for emulators: a single check is sufficient since confirmation is instant.

Attributes

Definition Classes

Force refresh of cached CardanoInfo from the network.

Force refresh of cached CardanoInfo from the network.

Fetches latest protocol parameters and updates the internal cache. Use this for long-running applications that need to stay current with network changes.

Attributes

override def submit(tx: Transaction): Future[Either[SubmitError, TransactionHash]]

Submits a transaction to the network.

Submits a transaction to the network.

Attributes

Definition Classes

Inherited methods

def findUtxo(input: TransactionInput): Future[Either[UtxoQueryError, Utxo]]

Find a single UTxO by its transaction input.

Find a single UTxO by its transaction input.

Value parameters

input

the transaction input to look up

Attributes

Returns

Either a UtxoQueryError or the found Utxo

Inherited from:
BlockchainReader
def findUtxos(address: Address): Future[Either[UtxoQueryError, Utxos]]

Find all UTxOs at the given address.

Find all UTxOs at the given address.

Value parameters

address

the address to query

Attributes

Returns

Either a UtxoQueryError or the found UTxOs

Inherited from:
BlockchainReader
def findUtxos(inputs: Set[TransactionInput]): Future[Either[UtxoQueryError, Utxos]]

Find UTxOs by a set of transaction inputs.

Find UTxOs by a set of transaction inputs.

Value parameters

inputs

the transaction inputs to look up

Attributes

Returns

Either a UtxoQueryError or the found UTxOs (fails if not all inputs are found)

Inherited from:
BlockchainReader
inline def queryUtxos(inline f: Utxo => Boolean): UtxoQueryWithReaderTF[Future]

Query UTxOs using a lambda DSL.

Query UTxOs using a lambda DSL.

Translates the lambda to a UtxoQuery at compile time and returns a builder that can be further configured before execution. Effect-polymorphic — the resulting .execute() returns the reader's own F[Either[UtxoQueryError, Utxos]], so the same call shape works on Future-typed providers (Blockfrost, JS) and direct-style providers (ox Id).

Example:

// Simple query — execute immediately
reader.queryUtxos { u =>
 u.output.address == myAddress
}.execute()

// With pagination and minimum total
reader.queryUtxos { u =>
 u.output.address == myAddress && u.output.value.hasAsset(policyId, assetName)
}.minTotal(Coin.ada(100)).limit(10).execute()

Supported expressions:

  • u.output.address == addr — query by address
  • u.input.transactionId == txId — query by transaction
  • u.output.value.hasAsset(policyId, assetName) — query/filter by asset
  • u.output.value.coin >= amount — filter by minimum lovelace
  • u.output.hasDatumHash(hash) — filter by datum hash
  • && — AND combination
  • || — OR combination

Value parameters

f

Lambda expression from Utxo to Boolean

Attributes

Returns

A UtxoQueryWithReaderTF builder over this reader's effect type

Inherited from:
BlockchainReaderTF
def submitAndPoll(transaction: Transaction, maxAttempts: Int = ..., delayMs: Long = ...): Future[Either[SubmitError, TransactionHash]]

Submit a transaction and poll until confirmed.

Submit a transaction and poll until confirmed.

Default implementation composes submit and pollForConfirmation.

Attributes

Inherited from:
BlockchainProvider