Last active
October 25, 2021 08:26
-
-
Save ashutoshmeher-r3/d0ca80143902da7df15e2a5b85db0ed5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@InitiatingFlow | |
@StartableByRPC | |
public class IssueLandTitleFlow implements Flow<Void>{ | |
// FlowIdentity, IdentityService and NotaryLookupService Injected Here | |
@CordaInject | |
private TransactionBuilderFactory transactionBuilderFactory; | |
@CordaInject | |
private FlowEngine flowEngine; | |
@CordaInject | |
private FlowMessaging flowMessaging; | |
@Override | |
@Suspendable | |
public Void call() { | |
// Code Here to fetch identites as dicuscussed earlier i.e. notary, owner and issuer. | |
// Build the transaction. | |
TransactionBuilder transactionBuilder = transactionBuilderFactory.create() | |
.setNotary(notary) | |
.addOutputState(landTitleOutputState) | |
.addCommand(new LandTitleContract.Commands.Issue(), Arrays.asList(issuer.getOwningKey())); | |
// Verify that the transaction is valid. | |
transactionBuilder.verify(); | |
// Self Sign the transaction. | |
SignedTransaction signedTx = transactionBuilder.sign(); | |
// Notarise and record the transaction | |
FlowSession receiverSession = flowMessaging.initiateFlow(landTitleState.getOwner()); | |
SignedTransaction notarisedTx = flowEngine.subFlow(new FinalityFlow(signedTx, Arrays.asList(receiverSession))); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment