class TransactionBuilder
A TransactionBuilder is a transaction class thats mutable (unlike the others which are all immutable). It is intended to be passed around contracts that may edit it by adding new states/commands or modifying the existing set. Then once the states and commands are right, this class can be used as a holding bucket to gather signatures from multiple parties.
<init> |
TransactionBuilder(inputs: MutableList<StateRef> = arrayListOf(), attachments: MutableList<SecureHash> = arrayListOf(), outputs: MutableList<ContractState> = arrayListOf(), commands: MutableList<Command> = arrayListOf()) A TransactionBuilder is a transaction class thats mutable (unlike the others which are all immutable). It is intended to be passed around contracts that may edit it by adding new states/commands or modifying the existing set. Then once the states and commands are right, this class can be used as a holding bucket to gather signatures from multiple parties. |
time |
val time: TimestampCommand? |
addAttachment |
fun addAttachment(attachment: Attachment): Unit |
addCommand |
fun addCommand(arg: Command): Unit fun addCommand(data: CommandData, vararg keys: PublicKey): <ERROR CLASS> fun addCommand(data: CommandData, keys: List<PublicKey>): Unit |
addInputState |
fun addInputState(ref: StateRef): Unit |
addOutputState |
fun addOutputState(state: ContractState): Unit |
addSignatureUnchecked |
fun addSignatureUnchecked(sig: WithKey): Unit Adds the signature directly to the transaction, without checking it for validity. |
attachments |
fun attachments(): List<SecureHash> |
checkAndAddSignature |
fun checkAndAddSignature(sig: WithKey): Unit Checks that the given signature matches one of the commands and that it is a correct signature over the tx, then adds it. |
checkSignature |
fun checkSignature(sig: WithKey): Unit Checks that the given signature matches one of the commands and that it is a correct signature over the tx. |
commands |
fun commands(): List<Command> |
inputStates |
fun inputStates(): List<StateRef> |
outputStates |
fun outputStates(): List<ContractState> |
setTime |
fun setTime(time: Instant, authenticatedBy: Party, timeTolerance: Duration): Unit Places a TimestampCommand in this transaction, removing any existing command if there is one. To get the right signature from the timestamping service, use the timestamp method after building is finished, or run use the TimestampingProtocol yourself. |
signWith |
fun signWith(key: KeyPair): Unit |
timestamp |
fun timestamp(timestamper: TimestamperService, clock: Clock = Clock.systemUTC()): Unit Uses the given timestamper service to request a signature over the WireTransaction be added. There must always be at least one such signature, but others may be added as well. You may want to have multiple redundant timestamps in the following cases: |
toSignedTransaction |
fun toSignedTransaction(checkSufficientSignatures: Boolean = true): SignedTransaction |
toWireTransaction |
fun toWireTransaction(): WireTransaction |
withItems |
fun withItems(vararg items: Any): TransactionBuilder A more convenient way to add items to this transaction that calls the add* methods for you based on type |