scalus.cardano.txbuilder
Members list
Type members
Classlikes
Utilities for handling change outputs in transaction balancing.
Utilities for handling change outputs in transaction balancing.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Change.type
Datums in UTxOs can be stored in two forms: inline datums or datum hashes. When there's a hash, we need to provide a datum corresponding to this hash, which can be done by either providing the value literally, or using a reference input where it is stored inline. The latter is not supported, since we haven't seen it in the wild - you can work with the datum of a reference/other input directly. Please open an issue if you need it.
Datums in UTxOs can be stored in two forms: inline datums or datum hashes. When there's a hash, we need to provide a datum corresponding to this hash, which can be done by either providing the value literally, or using a reference input where it is stored inline. The latter is not supported, since we haven't seen it in the wild - you can work with the datum of a reference/other input directly. Please open an issue if you need it.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object DatumInlinedclass DatumValue
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Redeemer that was detached from a transaction. Contains just enough info for it to be re-attached again, if a transaction needs a redeemer for some action.
Redeemer that was detached from a transaction. Contains just enough info for it to be re-attached again, if a transaction needs a redeemer for some action.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A transaction with redeemers detached.
A transaction with redeemers detached.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
An scalus.cardano.ledger.AddrKeyHash that is expected to sign some scalus.cardano.ledger.Transaction.
An scalus.cardano.ledger.AddrKeyHash that is expected to sign some scalus.cardano.ledger.Transaction.
The purpose for signing is not presently tracked. For a sketch, see commit https://github.com/cardano-hydrozoa/hydrozoa/commit/1a8c9c73fbfb33e79456a0a8b9f08688ef39b749
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Witnesses for native scripts. Can appear several times, but with the same additionalSigners.
Witnesses for native scripts. Can appear several times, but with the same additionalSigners.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait SpendWitnesstrait Witnessclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
NetworkExtensions.type
Use this value to indicate there will be a signature. The corresponding verification key hash will be tracked automatically in the context.
Use this value to indicate there will be a signature. The corresponding verification key hash will be tracked automatically in the context.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait SpendWitnesstrait Witnessclass Objecttrait Matchableclass AnyShow all
- Self type
-
PubKeyWitness.type
Internal error indicating a redeemer could not be attached to any transaction component.
Internal error indicating a redeemer could not be attached to any transaction component.
This error occurs when a detached redeemer's purpose does not match any input, mint, withdrawal, certificate, vote, or proposal in the transaction. This typically indicates an internal inconsistency in the transaction builder - a redeemer was tracked but its corresponding transaction component was removed or never added.
Value parameters
- detachedRedeemer
-
the redeemer that could not be attached, containing its data and purpose
- steps
-
the sequence of transaction builder steps that were processed
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RedeemerManagement.type
Contains a value that a redeemer corresponds to. Allows finding a redeemer index, given a transaction contains the value.
Contains a value that a redeemer corresponds to. Allows finding a redeemer index, given a transaction contains the value.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RedeemerPurpose.type
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
RedeemersContext.type
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Specifies how the transaction should find the source code for the script.
Specifies how the transaction should find the source code for the script.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object NativeScriptAttachedclass NativeScriptValueobject PlutusScriptAttachedclass PlutusScriptValue
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ScriptSource.type
These are the sum type for any errors that may occur during different phases and that can be returned thrown by a higher-level TxBuilder
These are the sum type for any errors that may occur during different phases and that can be returned thrown by a higher-level TxBuilder
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
- Known subtypes
Base trait for errors that occur during transaction building step processing.
Base trait for errors that occur during transaction building step processing.
Each error captures the specific TransactionBuilderStep that caused the failure, allowing users to identify which operation in their transaction building sequence failed. The explain method provides a human-readable description of the error.
Attributes
- See also
-
TransactionBuilder.build for the main entry point that may return these errors
SomeBuildError.SomeStepError for how step errors are wrapped in the build result
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class AttachedScriptNotFoundclass CannotExtractSignaturesclass CannotMintZeroclass CollateralNotPubKeyclass DatumIsMissingclass DatumWitnessNotProvidedclass FeeAlreadySetclass IncorrectDatumHashclass IncorrectScriptHashclass InputAlreadyExistsclass RedeemerIndexingErrorclass ResolvedUtxosIncoherenceclass ScriptResolutionErrorclass Unimplementedclass UnneededSpoVoteWitnessclass WrongCredentialTypeclass WrongNetworkIdclass WrongOutputTypeShow all
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait SpendWitnesstrait Witnessclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TransactionBuilder.type
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class AddCollateralclass Feeclass IssueCertificateclass Mintclass ModifyAuxiliaryDataclass ReferenceOutputclass Sendclass SetCollateralReturnclass Spendclass SpendWithDelayedRedeemerclass SubmitProposalclass SubmitVotingProcedureclass ValidityEndSlotclass ValidityStartSlotclass WithdrawRewardsShow all
Steps to build the transaction:
Steps to build the transaction:
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TransactionEditor.type
JVM TransactionSigner that uses JvmEd25519Signer directly.
JVM TransactionSigner that uses JvmEd25519Signer directly.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TransactionSigner.type
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Transaction balancing error types.
Transaction balancing error types.
These errors can occur during the transaction balancing process, which iteratively adjusts fees and change outputs until the transaction is balanced (consumed == produced).
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A high-level, fluent API for building Cardano transactions.
A high-level, fluent API for building Cardano transactions.
TxBuilder provides a convenient way to construct transactions by chaining method calls. It handles input selection, output creation, script attachment, minting, and transaction finalization including fee calculation and change handling.
TxBuilder is purely functional; each method returns a new instance with the updated state. The complete method is the only one that performs effects (querying UTXOs from a provider).
==Platform Support==
TxBuilder supports both JVM and JavaScript platforms:
complete(provider, sponsor): ReturnsFuture[TxBuilder]. Available on all platforms.complete(provider, sponsor, timeout): JVM-only blocking version with timeout parameter.
On JVM, you can also use the await extension method on Future:
import scalus.cardano.txbuilder.await
builder.complete(provider, sponsor).await()
==Usage==
// Cross-platform - async (returns Future)
val txFuture = TxBuilder(env)
.payTo(recipientAddress, Value.ada(10))
.complete(provider, sponsorAddress)
.map(_.sign(signer).transaction)
// JVM-only - blocking with timeout
import scala.concurrent.duration.*
val tx = TxBuilder(env)
.payTo(recipientAddress, Value.ada(10))
.complete(provider, sponsorAddress, 30.seconds)
.sign(signer)
.transaction
Value parameters
- attachedData
-
datum values to be included in the transaction witness set
- context
-
the current transaction builder context
- env
-
the environment containing protocol parameters, network info, and slot configuration
- evaluator
-
the Plutus script evaluator used for script validation
- steps
-
accumulated transaction building steps
- validators
-
ledger rules to run against the built transaction for additional validations
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Base exception for all TxBuilder errors.
Base exception for all TxBuilder errors.
This sealed hierarchy provides typed exceptions for different failure modes in TxBuilder, enabling programmatic error handling while remaining backwards compatible with RuntimeException.
Attributes
- Companion
- object
- Supertypes
-
class RuntimeExceptionclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
class BalancingExceptionclass BuildStepExceptionclass DelayedRedeemerExceptionclass InsufficientAdaExceptionShow all
Attributes
- Companion
- class
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
TxBuilderException.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
A witness to conduct an authorized operation on-chain. This could be spending an input, minting, rewarding, governance ops, certificate ops, etc.
A witness to conduct an authorized operation on-chain. This could be spending an input, minting, rewarding, governance ops, certificate ops, etc.
The only ways to do this as of writing (2025-10-03) are
- PubKey
- Native Script
- Plutus Script
The types include all additional data required to authorize the operation.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Deprecated classlikes
Attributes
- Companion
- object
- Deprecated
-
[Since version 0.13.0]Will be removed - Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Deprecated
-
[Since version 0.13.0]Will be removed - Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
BuilderContext.type
Helper class that creates a diff handler function for an existing change output.
Helper class that creates a diff handler function for an existing change output.
Attributes
- Deprecated
-
[Since version 0.13.0]Use Change.changeOutputDiffHandler insteadUse Change.changeOutputDiffHandler instead
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class ChangeOutputDiffHandler
Attributes
- Deprecated
-
[Since version 0.13.0]Use CardanoInfo directly instead - Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Environment.type
Attributes
- Deprecated
-
[Since version scalus 0.13.0]Use TransactionBuilder methods insteadThis object is deprecated. Use the functions and types from their new locations:
balanceFeeAndChangeandbalanceFeeAndChangeWithTokensare now inTransactionBuilderobjectTxBalancingErroris now in its own filescalus.cardano.txbuilder.TxBalancingErrormodifyBody,modifyWs,setFee,calculateChangeValueare now inTransactionBuilderobjectwithValueextension is now inTransactionOutputcompanion object inscalus.cardano.ledger
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LowLevelTxBuilder.type
Attributes
- Deprecated
-
[Since version 0.13.0]use RedeemerPurpose instead - Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RedeemerPurposeUtils.type
Contains parts of a transaction that are needed for redeemer processing.
Contains parts of a transaction that are needed for redeemer processing.
Attributes
- Companion
- object
- Deprecated
-
[Since version 0.13.0]Use Transaction-based methods directly - Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Deprecated
-
[Since version 0.13.0]Use Credential instead - Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Types
Deprecated types
Attributes
- Deprecated
-
[Since version 0.13.0]Use CardanoInfo directly instead
Attributes
- Deprecated
-
[Since version 0.13.0]Use scalus.cardano.ledger.Utxo instead
Value members
Concrete methods
add at most 256 keys
add at most 256 keys
Attributes
Append an element to a sequence, returning distinct values only and preserving the order of elements.
Append an element to a sequence, returning distinct values only and preserving the order of elements.
Attributes
remove at most 256 keys, must be used in conjunction with addDummyVKeys
remove at most 256 keys, must be used in conjunction with addDummyVKeys
Attributes
Deprecated methods
Attributes
- Deprecated
-
[Since version scalus 0.13.0]Use TransactionBuilder.calculateChangeValue instead
Attributes
- Deprecated
-
[Since version scalus 0.13.0]Use TransactionBuilder.modifyBody instead
Attributes
- Deprecated
-
[Since version scalus 0.13.0]Use TransactionBuilder.modifyWs instead
Attributes
- Deprecated
-
[Since version scalus 0.13.0]Use TransactionBuilder.setFee instead
Deprecated fields
Attributes
- Deprecated
-
[Since version 0.13.0]Use scalus.cardano.ledger.Utxo instead
Extensions
Deprecated extensions
Attributes
- Deprecated
-
[Since version 0.13.0]Use Network.networkId instead