scalus.cardano.node

Members list

Type members

Classlikes

Provider for Cardano blockchain operations.

Provider for Cardano blockchain operations.

Provider is the cross-platform interface for interacting with Cardano nodes. All methods return Future values and work on both JVM and JavaScript platforms.

Extends BlockchainReader with transaction submission capability.

Implementations capture their ExecutionContext at construction time, so callers don't need to provide it for each method call.

Use scalus.utils.await extension for blocking operations on JVM when needed.

Attributes

Supertypes
trait BlockchainProviderTF[Future]
trait BlockchainReaderTF[Future]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait BlockchainProviderTF[F[_]] extends BlockchainReaderTF[F]

Trait for blockchain providers with generic effect type. (TF is for "tagless final" style, often term used in FP literature).

Trait for blockchain providers with generic effect type. (TF is for "tagless final" style, often term used in FP literature).

Extends BlockchainReaderTF with transaction submission capability.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BlockchainReader extends BlockchainReaderTF[Future]

Read-only provider for Cardano blockchain operations.

Read-only provider for Cardano blockchain operations.

BlockchainReader provides read-only access to blockchain state without the ability to submit transactions. This is useful for:

  • Snapshot-based testing where state should not be modified
  • Transaction building that only needs to query UTxOs
  • APIs that should not have submit capability

Use BlockchainProvider when you also need to submit transactions.

Implementations capture their ExecutionContext at construction time, so callers don't need to provide it for each method call.

Attributes

Supertypes
trait BlockchainReaderTF[Future]
class Object
trait Matchable
class Any
Known subtypes
trait BlockchainReaderTF[F[_]]

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

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

Supertypes
class Object
trait Matchable
class Any
Known subtypes
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.

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
Supertypes
trait BlockchainProviderTF[Future]
trait BlockchainReaderTF[Future]
class Object
trait Matchable
class Any
Show all

Companion object for BlockfrostProvider with factory methods and utilities.

Companion object for BlockfrostProvider with factory methods and utilities.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

JVM-specific platform support for BlockfrostProvider.

JVM-specific platform support for BlockfrostProvider.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
class ConcurrencyLimiter(maxConcurrent: Int)(using ec: ExecutionContext)

Limits the number of concurrent futures that can be executing. Cross-platform (JVM/JS) and non-blocking.

Limits the number of concurrent futures that can be executing. Cross-platform (JVM/JS) and non-blocking.

Value parameters

maxConcurrent

Maximum number of futures that can execute concurrently

Attributes

Supertypes
class Object
trait Matchable
class Any
class Emulator(initialUtxos: Utxos = ..., initialContext: Context = ..., val validators: Iterable[Validator] = ..., val mutators: Iterable[Mutator] = ...) extends EmulatorBase

An in-memory bare-bones node implementation (JVM version with thread-safe state).

An in-memory bare-bones node implementation (JVM version with thread-safe state).

Allows submitting transaction and querying UTxO state. Runs validators and mutators against all submitted transactions. The default validator and mutator lists reflect the Cardano Node UTxO related ledger rules.

Attributes

See also

scalus.cardano.ledger.rules for the ledger rules

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

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Emulator.type

Base trait for Emulator implementations containing shared logic.

Base trait for Emulator implementations containing shared logic.

Platform-specific implementations (JVM/JS) extend this trait and provide thread-safe or single-threaded state management as appropriate.

Attributes

Companion
object
Supertypes
trait BlockchainProviderTF[Future]
trait BlockchainReaderTF[Future]
class Object
trait Matchable
class Any
Show all
Known subtypes
class Emulator
object EmulatorBase

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait NetworkSubmitError extends SubmitError

Network-level errors that occur during communication with the node/provider.

Network-level errors that occur during communication with the node/provider.

These errors are typically transient and may be worth retrying.

Attributes

Companion
object
Supertypes
trait SubmitError
class Object
trait Matchable
class Any
Known subtypes
class Banned
class MempoolFull
class RateLimited
Show all

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait NodeSubmitError extends SubmitError

Node validation errors that occur when the transaction is rejected by the ledger.

Node validation errors that occur when the transaction is rejected by the ledger.

These errors indicate the transaction is invalid and needs to be modified before resubmission.

Attributes

Companion
object
Supertypes
trait SubmitError
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait SubmitError

Error returned when submitting a transaction fails.

Error returned when submitting a transaction fails.

Errors are organized into two categories:

  • NetworkSubmitError: Communication/operational errors (connection, auth, rate limits)
  • NodeSubmitError: Transaction validation errors (invalid inputs, expired, script failures)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object SubmitError

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait UtxoFilter

Filter specifies optional refinements to apply after fetching from source.

Filter specifies optional refinements to apply after fetching from source.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class And
class AtInputs
class HasAsset
class HasDatum
class HasDatumHash
class MinLovelace
class Not
class Or
Show all
object UtxoFilter

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
UtxoFilter.type
sealed trait UtxoQuery

A query for UTxOs. Can be a simple query with source/filter/pagination, or a combination of queries using Or.

A query for UTxOs. Can be a simple query with source/filter/pagination, or a combination of queries using Or.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Or
class Simple
object UtxoQuery

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
UtxoQuery.type

Errors that can occur when executing a UTxO query

Errors that can occur when executing a UTxO query

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Macro utilities for building UtxoQuery from lambda expressions at compile time.

Macro utilities for building UtxoQuery from lambda expressions at compile time.

This provides a HOAS (Higher-Order Abstract Syntax) embedding that translates lambda expressions to the UtxoQuery ADT.

Example:

import scalus.cardano.node.UtxoQueryMacros.buildQuery

val query = buildQuery { u =>
 u.output.address == myAddress && u.output.value.hasAsset(policyId, assetName)
}
// Compiles to: UtxoQuery(FromAddress(myAddress)) && HasAsset(policyId, assetName)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class UtxoQueryWithReader(reader: BlockchainReader, query: UtxoQuery)

A query builder that combines a BlockchainReader with a UtxoQuery.

A query builder that combines a BlockchainReader with a UtxoQuery.

Allows chaining configuration methods before executing the query.

Value parameters

query

The query to execute

reader

The reader to execute the query against

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait UtxoSource

Source specifies WHERE to look for UTxOs. This is required - a query must start from a source.

Source specifies WHERE to look for UTxOs. This is required - a query must start from a source.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class And
class FromAddress
class FromAsset
class FromInputs
class Or
Show all
object UtxoSource

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
UtxoSource.type

Deprecated types

Attributes

Deprecated
[Since version 0.14.2] Use BlockchainProvider instead

Attributes

Deprecated
[Since version 0.14.2] Use UtxoQueryWithReader instead

Use UtxoQueryWithReader instead

Value members

Deprecated fields

val UtxoQueryWithProvider: UtxoQueryWithReader.type

Attributes

Deprecated
[Since version 0.14.2] Use UtxoQueryWithReader instead

Use UtxoQueryWithReader instead