corda / net.corda.testing.dsl / TransactionDSLInterpreter

TransactionDSLInterpreter

@DoNotImplement interface TransactionDSLInterpreter : Verifies, OutputStateLookup

This interface defines the bare bone functionality that a Transaction DSL interpreter should implement.

Parameters

Properties

ledgerInterpreter

abstract val ledgerInterpreter: LedgerDSLInterpreter<TransactionDSLInterpreter>

A reference to the enclosing ledger{..}'s interpreter.

Functions

_attachment

abstract fun _attachment(contractClassName: ContractClassName): Unit

Attaches an attachment containing the named contract to the transaction

_tweak

abstract fun _tweak(dsl: TransactionDSLInterpreter.() -> EnforceVerifyOrFail): EnforceVerifyOrFail

Creates a local scoped copy of the transaction.

attachment

abstract fun attachment(attachmentId: SecureHash): Unit

Adds an Attachment reference to the transaction.

command

abstract fun command(signers: List<PublicKey>, commandData: CommandData): Unit

Adds a command to the transaction.

input

abstract fun input(stateRef: StateRef): Unit

Adds an input reference to the transaction. Note that verifies will resolve this reference.

output

abstract fun output(contractClassName: ContractClassName, label: String?, notary: Party, encumbrance: Int?, attachmentConstraint: AttachmentConstraint, contractState: ContractState): Unit

Adds an output to the transaction.

timeWindow

abstract fun timeWindow(data: TimeWindow): Unit

Sets the time-window of the transaction.

Inherited Functions

fails

open fun fails(): EnforceVerifyOrFail

Asserts that verifies throws, with no condition on the exception message.

fails with

open infix fun fails with(msg: String): EnforceVerifyOrFail

failsWith

open fun failsWith(expectedMessage: String?): EnforceVerifyOrFail

Asserts that verifies() throws.

retrieveOutputStateAndRef

abstract fun <S : ContractState> retrieveOutputStateAndRef(clazz: Class<S>, label: String): StateAndRef<S>

Retrieves an output previously defined by TransactionDSLInterpreter.output with a label passed in.

verifies

abstract fun verifies(): EnforceVerifyOrFail

Verifies the ledger/transaction, throws if the verification fails.

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.

Inheritors

TestTransactionDSLInterpreter

data class TestTransactionDSLInterpreter : TransactionDSLInterpreter, OutputStateLookup

This interpreter builds a transaction, and TransactionDSL.verifies that the resolved transaction is correct. Note that transactions corresponding to input states are not verified. Use LedgerDSL.verifies for that.

TransactionDSL

class TransactionDSL<out T : TransactionDSLInterpreter> : TransactionDSLInterpreter

Underlying class for the transaction DSL. Do not instantiate directly, instead use the transaction function.