BlockchainReaderTF

scalus.cardano.node.BlockchainReaderTF
trait BlockchainReaderTF[F[_]]

Read-only blockchain operations with generic effect type. (TF is for "tagless final" style, often term used in FP literature).

This trait provides read-only access to blockchain state. Use BlockchainProviderTF when you also need to submit transactions.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

Returns CardanoInfo for this provider.

Returns CardanoInfo for this provider.

Attributes

Check the status of a transaction on the blockchain.

Check the status of a transaction on the blockchain.

Value parameters

txHash

the transaction hash to check

Attributes

Returns

the current status of the transaction

Returns the current slot number.

Returns the current slot number.

Attributes

Fetches the latest protocol parameters from the network.

Fetches the latest protocol parameters from the network.

Attributes

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

Find UTxOs using a type-safe query.

Find UTxOs using a type-safe query.

Attributes

def getDatum(datumHash: DataHash): F[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

Concrete methods

inline def queryUtxos(inline f: Utxo => Boolean): UtxoQueryWithReaderTF[F]

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