public class TransactionForContract
A transaction to be passed as input to a contract verification function. Defines helper methods to simplify verification logic in contracts.
Modifier and Type | Class and Description |
---|---|
static class |
TransactionForContract.InOutGroup<T extends ContractState,K>
A set of related inputs and outputs that are connected by some common attributes. An InOutGroup is calculated
using groupStates and is useful for handling cases where a transaction may contain similar but unrelated
state evolutions, for example, a transaction that moves cash in two different currencies. The numbers must add
up on both sides of the transaction, but the values must be summed independently per currency. Grouping can
be used to simplify this logic.
|
Constructor and Description |
---|
TransactionForContract(java.util.List<? extends net.corda.core.contracts.ContractState> inputs,
java.util.List<? extends net.corda.core.contracts.ContractState> outputs,
java.util.List<? extends net.corda.core.contracts.Attachment> attachments,
java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands,
SecureHash origHash,
Party inputNotary,
Timestamp timestamp)
A transaction to be passed as input to a contract verification function. Defines helper methods to
simplify verification logic in contracts.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<net.corda.core.contracts.ContractState> |
component1() |
java.util.List<net.corda.core.contracts.ContractState> |
component2() |
java.util.List<net.corda.core.contracts.Attachment> |
component3() |
java.util.List<net.corda.core.contracts.AuthenticatedObject> |
component4() |
SecureHash |
component5() |
Party |
component6() |
Timestamp |
component7() |
TransactionForContract |
copy(java.util.List<? extends net.corda.core.contracts.ContractState> inputs,
java.util.List<? extends net.corda.core.contracts.ContractState> outputs,
java.util.List<? extends net.corda.core.contracts.Attachment> attachments,
java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands,
SecureHash origHash,
Party inputNotary,
Timestamp timestamp)
A transaction to be passed as input to a contract verification function. Defines helper methods to
simplify verification logic in contracts.
|
boolean |
equals(java.lang.Object other) |
java.util.List<net.corda.core.contracts.Attachment> |
getAttachments() |
java.util.List<net.corda.core.contracts.AuthenticatedObject> |
getCommands() |
Party |
getInputNotary() |
java.util.List<net.corda.core.contracts.ContractState> |
getInputs() |
SecureHash |
getOrigHash() |
java.util.List<net.corda.core.contracts.ContractState> |
getOutputs() |
Timestamp |
getTimestamp() |
<T extends ContractState,K> |
groupStates(java.lang.Class<T> ofType,
kotlin.jvm.functions.Function1<? super T,? extends K> selector)
Given a type and a function that returns a grouping key, associates inputs and outputs together so that they
can be processed as one. The grouping key is any arbitrary object that can act as a map key (so must implement
equals and hashCode).
|
<T extends ContractState,K> |
groupStatesInternal(java.util.Map<K,? extends java.util.List<? extends T>> inGroups,
java.util.Map<K,? extends java.util.List<? extends T>> outGroups)
Deprecated.
|
int |
hashCode() |
java.lang.String |
toString() |
public TransactionForContract(java.util.List<? extends net.corda.core.contracts.ContractState> inputs, java.util.List<? extends net.corda.core.contracts.ContractState> outputs, java.util.List<? extends net.corda.core.contracts.Attachment> attachments, java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands, SecureHash origHash, Party inputNotary, Timestamp timestamp)
A transaction to be passed as input to a contract verification function. Defines helper methods to simplify verification logic in contracts.
public int hashCode()
public boolean equals(java.lang.Object other)
public <T extends ContractState,K> java.util.List<net.corda.core.contracts.TransactionForContract.InOutGroup> groupStates(java.lang.Class<T> ofType, kotlin.jvm.functions.Function1<? super T,? extends K> selector)
Given a type and a function that returns a grouping key, associates inputs and outputs together so that they can be processed as one. The grouping key is any arbitrary object that can act as a map key (so must implement equals and hashCode).
The purpose of this function is to simplify the writing of verification logic for transactions that may contain similar but unrelated state evolutions which need to be checked independently. Consider a transaction that simultaneously moves both dollars and euros (e.g. is an atomic FX trade). There may be multiple dollar inputs and multiple dollar outputs, depending on things like how fragmented the owner's vault is and whether various privacy techniques are in use. The quantity of dollars on the output side must sum to the same as on the input side, to ensure no money is being lost track of. This summation and checking must be repeated independently for each currency. To solve this, you would use groupStates with a type of Cash.State and a selector that returns the currency field: the resulting list can then be iterated over to perform the per-currency calculation.
public <T extends ContractState,K> java.util.List<net.corda.core.contracts.TransactionForContract.InOutGroup> groupStatesInternal(java.util.Map<K,? extends java.util.List<? extends T>> inGroups, java.util.Map<K,? extends java.util.List<? extends T>> outGroups)
public java.util.List<net.corda.core.contracts.ContractState> getInputs()
public java.util.List<net.corda.core.contracts.ContractState> getOutputs()
public java.util.List<net.corda.core.contracts.Attachment> getAttachments()
public java.util.List<net.corda.core.contracts.AuthenticatedObject> getCommands()
public SecureHash getOrigHash()
public Party getInputNotary()
public Timestamp getTimestamp()
public java.util.List<net.corda.core.contracts.ContractState> component1()
public java.util.List<net.corda.core.contracts.ContractState> component2()
public java.util.List<net.corda.core.contracts.Attachment> component3()
public java.util.List<net.corda.core.contracts.AuthenticatedObject> component4()
public SecureHash component5()
public Party component6()
public Timestamp component7()
public TransactionForContract copy(java.util.List<? extends net.corda.core.contracts.ContractState> inputs, java.util.List<? extends net.corda.core.contracts.ContractState> outputs, java.util.List<? extends net.corda.core.contracts.Attachment> attachments, java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands, SecureHash origHash, Party inputNotary, Timestamp timestamp)
A transaction to be passed as input to a contract verification function. Defines helper methods to simplify verification logic in contracts.
public java.lang.String toString()