scalus.cardano.node
Members list
Packages
Type members
Classlikes
A record of a transaction applied to the emulated ledger.
A record of a transaction applied to the emulated ledger.
Captures the parts of chain history that the live UTxO set no longer holds after application: the full transaction, the slot it was applied at, and the resolved inputs it consumed (which are removed from the UTxO set once the transaction is applied).
Value parameters
- slot
-
the emulator slot at the time of application
- spent
-
the UTxOs consumed by
tx, resolved against the pre-application UTxO set - tx
-
the applied transaction
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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 BlockchainReadertrait BlockchainProviderTF[Future]trait BlockchainReaderTF[Future]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait BlockchainStreamProviderclass StreamingEmulatorclass BlockfrostProvidertrait EmulatorBaseclass Emulator
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
- Known subtypes
-
trait BlockchainStreamProviderTF[F]trait BlockchainStreamProviderclass StreamingEmulatortrait BlockchainProviderclass BlockfrostProvidertrait EmulatorBaseclass EmulatorShow all
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
- Known subtypes
-
trait BlockchainStreamReadertrait BlockchainStreamProviderclass StreamingEmulatortrait BlockchainProviderclass BlockfrostProvidertrait EmulatorBaseclass EmulatorShow all
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 Objecttrait Matchableclass Any
- Known subtypes
-
trait BlockchainStreamReaderTF[F]trait BlockchainStreamProviderTF[F]trait BlockchainStreamProviderclass StreamingEmulatortrait BlockchainStreamReadertrait BlockchainProviderTF[F]trait BlockchainProviderclass BlockfrostProvidertrait EmulatorBaseclass Emulatortrait BlockchainReaderShow all
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 BlockchainProvidertrait BlockchainReadertrait BlockchainProviderTF[Future]trait BlockchainReaderTF[Future]class Objecttrait Matchableclass AnyShow all
Companion object for BlockfrostProvider with factory methods and utilities.
Companion object for BlockfrostProvider with factory methods and utilities.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
BlockfrostProvider.type
JVM-specific platform support for BlockfrostProvider.
JVM-specific platform support for BlockfrostProvider.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
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 Objecttrait Matchableclass Any
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
The rules themselves live in EmulatorBase, shared with the JavaScript emulator; all this class adds is the state cell and the compare-and-set retry that makes concurrent submission safe.
Attributes
- See also
-
scalus.cardano.ledger.rules for the ledger rules
- Companion
- object
- Supertypes
-
trait InteropApitrait EmulatorBasetrait BlockchainProvidertrait BlockchainReadertrait BlockchainProviderTF[Future]trait BlockchainReaderTF[Future]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
EmulatorBase.type
Base trait for Emulator implementations containing the whole emulator state machine.
Base trait for Emulator implementations containing the whole emulator state machine.
Everything an emulator does to its state lives here, expressed against a single abstract cell holding one EmulatorState. The platform implementations supply only that cell: the JVM one an AtomicReference with a compare-and-set retry, the JavaScript one a plain var, since JavaScript is single-threaded. Neither carries a copy of the rules, so the two platforms cannot drift apart.
Attributes
- Companion
- object
- Supertypes
-
trait BlockchainProvidertrait BlockchainReadertrait BlockchainProviderTF[Future]trait BlockchainReaderTF[Future]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class Emulator
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
EmulatorInitialState.type
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The entire mutable state of an EmulatorBase, as one immutable value.
The entire mutable state of an EmulatorBase, as one immutable value.
Aggregating it is what lets one state machine serve both platforms, and it is also what makes a transaction land atomically: the ledger state and the bookkeeping that describes it are swapped together, so no reader — and on the JVM no other submitting thread — can observe a UTxO set that has moved on while the applied-transaction log has not caught up.
appliedTxIndex and appliedTxs are derived from appliedTxLog, kept for O(1) lookup. Nothing outside this class writes them: the constructor is private, so EmulatorState.initial and the transitions below are the only way to build one, and no caller can hand back a state whose log and caches disagree (EmulatorStateInvariantTest pins it).
The log records one entry per application, while the two derived views are keyed by hash, so they are not always the same size. Applying one transaction twice needs the direct ledger edits (EmulatorBase.addUtxo) to put its inputs back — the ledger rules reject the second submission otherwise — but it is reachable, and then the log holds both applications while the index holds the later one and appliedTxs holds the hash once. Every hash in the log is in both derived views and vice versa; only the multiplicity differs.
Value parameters
- appliedTxIndex
-
derived:
appliedTxLogkeyed by transaction hash, holding the latest application of each - appliedTxLog
-
applied transactions in application order, oldest first — one entry per application
- appliedTxs
-
derived: the distinct hashes in
appliedTxLog - context
-
the validation context, carrying the current slot, protocol parameters and evaluator mode
- datums
-
every datum this emulator has seen, by hash
- ledger
-
the ledger state proper — the UTxO set and the certificate state
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
EmulatorState.type
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
NetworkSubmitError.type
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
- Known subtypes
-
class AuthenticationErrorclass Bannedclass ConnectionErrorclass InternalErrorclass MempoolFullclass RateLimitedShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
NodeSubmitError.type
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
- Known subtypes
-
class ScriptFailureclass TransactionExpiredclass UtxoNotAvailableclass ValidationErrorclass ValueNotConserved
One row of EmulatorBase.stakeDistribution.
One row of EmulatorBase.stakeDistribution.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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 Objecttrait Matchableclass Any
- Known subtypes
-
trait NetworkSubmitErrorclass AuthenticationErrorclass Bannedclass ConnectionErrorclass InternalErrorclass MempoolFullclass RateLimitedtrait NodeSubmitErrorclass ScriptFailureclass TransactionExpiredclass UtxoNotAvailableclass ValidationErrorclass ValueNotConservedShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SubmitError.type
Outcome of a transaction submission, usable from Java.
Outcome of a transaction submission, usable from Java.
A null-based view over Either[SubmitError, TransactionHash] so non-Scala callers can inspect results without pattern matching — and tests that expect a rejection can assert on getErrorOrNull without try/catch. Scala code should keep using the Either-returning submit/submitSync (or toEither).
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
SubmitResult.type
Status of a transaction on the blockchain.
Status of a transaction on the blockchain.
Used by BlockchainReaderTF.checkTransaction and BlockchainProviderTF.pollForConfirmation.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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 Objecttrait Matchableclass Any
- Known subtypes
-
class Andclass AtInputsclass HasAssetclass HasDatumclass HasDatumHashclass MinLovelaceclass Notclass OrShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
UtxoFilter.type
A query for UTxOs. Can be a simple query with source/filter/pagination, or a combination of queries using Or.
Errors that can occur when executing a UTxO query
Errors that can occur when executing a UTxO query
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow 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 Objecttrait Matchableclass Any
- Self type
-
UtxoQueryMacros.type
A query builder that combines a BlockchainReaderTF with a UtxoQuery. Effect-polymorphic — .execute() returns the reader's own F[Either[UtxoQueryError, Utxos]].
A query builder that combines a BlockchainReaderTF with a UtxoQuery. Effect-polymorphic — .execute() returns the reader's own F[Either[UtxoQueryError, Utxos]].
Value parameters
- query
-
The query to execute
- reader
-
The reader to execute the query against
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
UtxoSource.type
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 Objecttrait Matchableclass Any
- Known subtypes
-
class Andclass FromAddressclass FromAssetclass FromInputsclass FromPaymentCredentialclass FromTransactionclass OrShow all