Context

scalus.cardano.txbuilder.TransactionBuilder.Context
See theContext companion object
case class Context(transaction: Transaction, redeemers: Seq[DetachedRedeemer], network: Network, expectedSigners: Set[ExpectedSigner], resolvedUtxos: ResolvedUtxos, delayedRedeemerSpecs: Seq[DelayedRedeemerSpec] = ..., collateralReturnAddress: Option[Address] = ...)

An opaque context in which the builder operates.

TODO: make a class, remove toTuple()?

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def addSigners(additionalSigners: Set[ExpectedSigner]): Context

Add additional signers to the Context.

Add additional signers to the Context.

Attributes

def balance(diffHandler: DiffHandler, protocolParams: ProtocolParams, evaluator: PlutusScriptEvaluator): Either[TxBalancingError, Context]

Balance the transaction in a context, adding and removing mock signatures where necessary.

Balance the transaction in a context, adding and removing mock signatures where necessary.

Attributes

def balanceContext(protocolParams: ProtocolParams, diffHandler: DiffHandler, evaluator: PlutusScriptEvaluator): Either[SomeBuildError, Context]

Balance the transaction, handling dummy signatures and collateral return.

Balance the transaction, handling dummy signatures and collateral return.

This method:

  1. Adds dummy signatures for accurate fee calculation
  2. Ensures min ADA on all outputs
  3. Balances fees and change
  4. Handles collateral return output
  5. Removes dummy signatures

Call validateContext after this to validate the balanced transaction.

Attributes

def ensureMinAdaAll(protocolParams: ProtocolParams): Context

Ensure that all transaction outputs in the context have min ada.

Ensure that all transaction outputs in the context have min ada.

Attributes

def finalizeContext(protocolParams: ProtocolParams, diffHandler: DiffHandler, evaluator: PlutusScriptEvaluator, validators: Seq[Validator], slot: Long = ..., certState: CertState = ...): Either[SomeBuildError, Context]

Set min ada, balance, and validate a context.

Set min ada, balance, and validate a context.

Value parameters

certState

the certificate state for validation context (default: empty)

diffHandler

the handler for managing transaction balance differences (change)

evaluator

the Plutus script evaluator

protocolParams

the protocol parameters

slot

the current slot number for validation context (default: 1)

validators

the ledger rule validators to run

Attributes

Returns

the finalized context or an error

Conversion help to Scalus scalus.cardano.ledger.Utxos

Conversion help to Scalus scalus.cardano.ledger.Utxos

Attributes

def replaceRedeemers(newRedeemers: Seq[DetachedRedeemer]): Context
def validate(validators: Seq[Validator], protocolParams: ProtocolParams, slot: Long = ..., certState: CertState = ...): Either[TransactionException, Context]

Validate a context according to a set of ledger rules.

Validate a context according to a set of ledger rules.

Value parameters

certState

the certificate state for validation context (default: empty)

protocolParams

the protocol parameters

slot

the current slot number for validation context (default: 1)

validators

the ledger rule validators to run

Attributes

Returns

the validated context or a validation error

def validateContext(validators: Seq[Validator], protocolParams: ProtocolParams, slot: Long = ..., certState: CertState = ...): Either[SomeBuildError, Context]

Validate the transaction against ledger rules.

Validate the transaction against ledger rules.

Adds dummy signatures during validation to ensure accurate signature count validation, then removes them before returning.

Value parameters

certState

the certificate state for validation context (default: empty)

protocolParams

the protocol parameters

slot

the current slot number for validation context (default: 1)

validators

the ledger rule validators to run

Attributes

Returns

the validated context or a validation error

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

Extract tupled information from a Context. This method is provided to avoid breaking opacity while making it easier to check for equality in testing. Note: delayedRedeemerSpecs is excluded since it contains lambdas that can't be compared.

Extract tupled information from a Context. This method is provided to avoid breaking opacity while making it easier to check for equality in testing. Note: delayedRedeemerSpecs is excluded since it contains lambdas that can't be compared.

Attributes