We have a use case which requires the following steps: (1) Initiator triggers the transaction flow through UI (2) The flow is initiated, signed by the initiator and sent to reci
See the Negotiation Cordapp sample for an example of how this would work in practice here.
Suspending a flow for human interaction isn't currently implemented (as of Corda V3.0).
Instead, you'd implement this by adding a status flag to your state:
class FooState(
override val participants: List<Party>,
val accepted: Boolean) : ContractState
You'd have three commands:
interface Commands : CommandData {
class Propose : Commands
class Reject: Commands
class Accept: Commands
}
And two flows:
A proposal flow: In this flow, the initiator creates and signs a Propose
transaction to issue the state onto the ledger with a Propose
command and the accepted
flag set to false
An accept flow: In this flow, the recipient either:
Reject
transaction that consumes the proposed state and outputs nothing. The state has been removed from the ledger and is effectively rejectedAccept
transaction that updates the proposed state so that accepted
is true
. The state has now been accepted, and this fact is registered on the ledgerYou'd give the accept flow a parameter which determines whether or not to accept the proposal. This parameter would be provided by the user when the flow is kicked off either via an API or directly over RPC.