TransactionBuilderStep

scalus.cardano.txbuilder.TransactionBuilderStep
See theTransactionBuilderStep companion trait

Steps to build the transaction:

  • generally non-commutative, so the order matters
  • some are additive (e.g. Mint), some are not, e.g., (Spend)

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case class AddCollateral(utxo: Utxo) extends TransactionBuilderStep

Add a utxo as a collateral input. The utxo must be controlled by a key (not a script).

Add a utxo as a collateral input. The utxo must be controlled by a key (not a script).

Per Babbage era specification (CIP-40), native tokens in collateral inputs are allowed. All tokens will be returned via the collateral return output. Use SetCollateralReturn to specify the return address, or it will default to the address of the first collateral input.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Fee(fee: Coin) extends TransactionBuilderStep

Set the minimal fee.

Set the minimal fee.

Attributes

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

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Mint(scriptHash: ScriptHash, assetName: AssetName, amount: Long, witness: NativeScriptWitness | TwoArgumentPlutusScriptWitness) extends TransactionBuilderStep

Mint/burn tokens using a native/plutus script. Additive - sum monoid over amount. You should determine your aggregate mint amount outside of the builder. Chaining steps together to calculate the mint amount.

Mint/burn tokens using a native/plutus script. Additive - sum monoid over amount. You should determine your aggregate mint amount outside of the builder. Chaining steps together to calculate the mint amount.

WARNING: If you explicitly pass amount == 0, this will return a Left.

WARNING: If you do a reciprocal pair of mint/burn of the same amount (i.e., Mint 4, Mint -4), you will nullify the mint amount, but the additionalSigners/requiredSigners/witnesses will not be removed.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ModifyAuxiliaryData(f: (Option[AuxiliaryData]) => Option[AuxiliaryData]) extends TransactionBuilderStep

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ReferenceOutput(utxo: Utxo) extends TransactionBuilderStep

Add a scalus.cardano.ledger.Utxo as a CIP-31 reference input. Consuming the same UTxO twice (reference or spend) is an error

Add a scalus.cardano.ledger.Utxo as a CIP-31 reference input. Consuming the same UTxO twice (reference or spend) is an error

The reason that action is represented as a step is that reference utxos should be added to the context and also may be required to create a scalus.cardano.txbuilder.SpendWitness.

Value parameters

utxo

any utxo

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Send(output: TransactionOutput) extends TransactionBuilderStep

Send some funds/data to an address. Multiple identical steps are acceptable.

Send some funds/data to an address. Multiple identical steps are acceptable.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class SetCollateralReturn(returnAddress: Address) extends TransactionBuilderStep

Set the address where collateral return output should be sent.

Set the address where collateral return output should be sent.

This is optional - if not set, the first collateral input's address will be used. Use this when you want the collateral return to go to a different address than where the collateral came from.

The collateral return output is automatically created during transaction finalization when collateral contains native tokens (required by protocol) or when excess ADA above the required collateral can cover the min ADA for a return output.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class Spend(utxo: Utxo, witness: SpendWitness = ...) extends TransactionBuilderStep

Spend any utxo. An attempt to consume (reference or spend) the same utxo twice will error. If a reference script is used, the containing utxo should be added beforehand with ReferenceOutput or Spend steps.

Spend any utxo. An attempt to consume (reference or spend) the same utxo twice will error. If a reference script is used, the containing utxo should be added beforehand with ReferenceOutput or Spend steps.

Attributes

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

Attributes

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

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ValidityEndSlot(slot: Long) extends TransactionBuilderStep

Set transaction validity end slot (aka TTL), can be used once.

Set transaction validity end slot (aka TTL), can be used once.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class ValidityStartSlot(slot: Long) extends TransactionBuilderStep

Set transactions validity start slot, can be used once.

Set transactions validity start slot, can be used once.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class WithdrawRewards(stakeCredential: Credential, amount: Coin, witness: PubKeyWitness.type | NativeScriptWitness | TwoArgumentPlutusScriptWitness = ...) extends TransactionBuilderStep

Attributes

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

Deprecated classlikes

case class SpendWithDelayedRedeemer(utxo: Utxo, redeemerBuilder: Transaction => Data, validator: PlutusScript, datum: Option[Data] = ...) extends TransactionBuilderStep

Spend a utxo guarded by plutus script.

Spend a utxo guarded by plutus script.

The redeemerBuilder is invoked after TransactionBuilder.build, but before it's balanced by the low lever builder. As a result, the number and order of inputs, outputs, certificates etc. is predetermined.

Use this instead of Spend when assembling the redeemer requires the knowledge of the transaction contents, e.g. to include the indices of inputs or outputs.

Attributes

Deprecated
[Since version 0.13.0] Use Spend directly
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror