A streaming view of an scalus.cardano.node.EmulatorBase.
Every read delegates to the emulator, so the streaming and one-shot views cannot disagree — there is literally one ledger behind both. Submission additionally drives the subscription hub, so code that subscribes and reacts runs unchanged against a simulated chain.
The real chain. Subscribers see the emulator's own blocks, spec section 12.1: after each operation of this wrapper, the diff from the tip it last delivered to the emulator's tip goes to the hub, one RollForward per block and a RollBackward on a branch switch or a rollback, spec [SY-5]. The wrapper builds no blocks, spec [SY-7]. A transition made on the wrapped emulator directly reaches subscribers at the next operation of this wrapper.
Events only follow acceptance. A rejected transaction changes no tip, so it produces no events. A transaction in the mempool reads Pending, spec [SY-8].
Callbacks run under a lock. submit, pollForConfirmation, produceBlock, rollback and newEmptyBlock deliver the events while they hold this wrapper's lock, so a subscriber callback that runs inline on delivery runs under it too. Such a callback may call this wrapper again on its own thread, but it must not wait for another thread that calls this wrapper: that thread blocks on the lock, and the two deadlock.
Value parameters
- securityParam
-
the rollback horizon this stream advertises, spec [SY-6]:
noRollbacksubscribers wait this many blocks, none with the default0, as before the emulator had a chain. The hub still keepsmax(securityParam, k)blocks, so a rollback or a fork the emulator makes within its own k reaches subscribers asRolledBack, also when it is deeper than this value, and alsonoRollbacksubscribers.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait BlockchainStreamProvidertrait BlockchainProvidertrait BlockchainStreamReadertrait BlockchainReadertrait BlockchainStreamProviderTF[Future]trait BlockchainStreamReaderTF[Future]trait BlockchainProviderTF[Future]trait BlockchainReaderTF[Future]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
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
The same cell subscribeTransactionStatus reads, falling back to the emulator for transactions this provider never observed.
The same cell subscribeTransactionStatus reads, falling back to the emulator for transactions this provider never observed.
The duality between a one-shot read and its subscription is only worth anything if the two cannot disagree, and they can only be guaranteed not to by reading the same state. A transaction submitted here is Pending then Confirmed in the hub; one that predates this wrapper is answered by the ledger.
Attributes
- Definition Classes
Terminal: subscriptions end, and the provider serves no new ones and submits nothing further. A close that left the provider working would leak the very subscriptions it was called to release.
Terminal: subscriptions end, and the provider serves no new ones and submits nothing further. A close that left the provider working would leak the very subscriptions it was called to release.
Attributes
Returns the current slot number.
Returns the current slot number.
Attributes
The tip as the stream sees it: the emulator's tip as of the last operation of this wrapper, or ChainTip.origin before the first block it delivered.
The tip as the stream sees it: the emulator's tip as of the last operation of this wrapper, or ChainTip.origin before the first block it delivered.
Attributes
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
Fetches the latest protocol parameters from the network.
Fetches the latest protocol parameters from the network.
Attributes
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
Look up a datum by its hash. Returns None if unknown.
Look up a datum by its hash. Returns None if unknown.
Attributes
Advance the slot by one, then forge produceBlock() of the mempool, empty unless the emulator is in the Manual preset, spec [FG-8].
Advance the slot by one, then forge produceBlock() of the mempool, empty unless the emulator is in the Manual preset, spec [FG-8].
Attributes
Forge while the tx is pending, see EmulatorBase.pollForConfirmation, so subscribers get the blocks, spec [SF-3], [SY-5].
Forge while the tx is pending, see EmulatorBase.pollForConfirmation, so subscribers get the blocks, spec [SF-3], [SY-5].
Attributes
- Definition Classes
Forge a block from the mempool, see EmulatorBase.produceBlock().
Forge a block from the mempool, see EmulatorBase.produceBlock().
Attributes
Forge a block of txs on on, see EmulatorBase.produceBlock.
Forge a block of txs on on, see EmulatorBase.produceBlock.
Attributes
Forge a block of txs at slot on on, see EmulatorBase.produceBlock.
Forge a block of txs at slot on on, see EmulatorBase.produceBlock.
Attributes
Remove the last n blocks, see EmulatorBase.rollback.
Remove the last n blocks, see EmulatorBase.rollback.
Attributes
What this provider can do. The only thing an implementation declares; per-request support is derived from it by SubscriptionSupport.of.
What this provider can do. The only thing an implementation declares; per-request support is derived from it by SubscriptionSupport.of.
Attributes
Submits a transaction to the network.
Submits a transaction to the network.
Attributes
Latest-value stream of protocol parameters: the current value on subscribe, then changes.
Latest-value stream of protocol parameters: the current value on subscribe, then changes.
Attributes
Latest-value stream of chain-tip updates — newer wins, so a subscriber always sees the most recent tip when it pulls rather than a backlog of stale ones.
Latest-value stream of chain-tip updates — newer wins, so a subscriber always sees the most recent tip when it pulls rather than a backlog of stale ones.
Attributes
Latest-value stream of one transaction's status, following it through the mempool into a block — and back out again if a rollback orphans it.
Latest-value stream of one transaction's status, following it through the mempool into a block — and back out again if a rollback orphans it.
Attributes
Inherited methods
Find a single UTxO by its transaction input.
Find a single UTxO by its transaction input.
Attributes
- Returns
-
Right(utxo) if found, Left(NotFound) otherwise
- Inherited from:
- BlockchainReaderTF
Find all UTxOs at the given address.
Find UTxOs by a set of transaction inputs (fails with NotFound if not all are found).
Find UTxOs by a set of transaction inputs (fails with NotFound if not all are found).
Attributes
- Inherited from:
- BlockchainReaderTF
Map over the Future effect using this reader's captured ExecutionContext.
Map over the Future effect using this reader's captured ExecutionContext.
Attributes
- Definition Classes
- Inherited from:
- BlockchainReader
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 addressu.input.transactionId == txId— query by transactionu.output.value.hasAsset(policyId, assetName)— query/filter by assetu.output.value.coin >= amount— filter by minimum lovelaceu.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
Submit a transaction and poll until confirmed.
Submit a transaction and poll until confirmed.
Default implementation composes submit and pollForConfirmation.
Attributes
- Inherited from:
- BlockchainProvider
Subscribe with default options.
Subscribe with default options.
Subscribe with default options.