Skip to content

Instantly share code, notes, and snippets.

@apemon
Created December 23, 2018 17:57
Show Gist options
  • Save apemon/9021ba4c70e4d38e551860b38a94381b to your computer and use it in GitHub Desktop.
Save apemon/9021ba4c70e4d38e551860b38a94381b to your computer and use it in GitHub Desktop.
@InitiatingFlow
@StartableByRPC
class ProxyNameIssueFlow(val state: ProxyNameState): FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction {
val notary = serviceHub.networkMapCache.notaryIdentities.first()
val issueCommand = Command(ProxyNameContract.Commands.Issue(), state.participants.map { it.owningKey })
val builder = TransactionBuilder(notary = notary)
builder.addOutputState(state, ProxyNameContract.PROXYNAME_CONTRACT_ID)
builder.addCommand(issueCommand)
builder.verify(serviceHub)
val ptx = serviceHub.signInitialTransaction(builder)
val ftx = subFlow(FinalityFlow(ptx))
subFlow(BroadcastTransaction(ftx))
return ftx
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment