66
77package com.cordaSimpleApplication.client
88
9- import com.cordaSimpleApplication.flow.AssetFlow.IssueAssetState
10- import com.cordaSimpleApplication.flow.AssetFlow.GetStatesByTokenType
11- import com.cordaSimpleApplication.flow.AssetFlow.IssueAssetStateFromStateRef
9+ import com.cordaSimpleApplication.flow.IssueAssetState
10+ import com.cordaSimpleApplication.flow.GetStatesByTokenType
11+ import com.cordaSimpleApplication.flow.IssueAssetStateFromStateRef
12+ import com.cordaSimpleApplication.flow.DeleteAssetState
13+ import com.cordaSimpleApplication.flow.GetAssetStateByLinearId
14+ import com.cordaSimpleApplication.flow.RetrieveStateAndRef
15+ import com.cordaSimpleApplication.flow.MergeAssetStates
16+ import com.cordaSimpleApplication.flow.SplitAssetState
17+
18+ import com.cordaSimpleApplication.flow.TransferAssetStateInitiator
1219import com.cordaSimpleApplication.state.AssetState
1320import com.github.ajalt.clikt.core.CliktCommand
1421import com.github.ajalt.clikt.core.requireObject
@@ -28,14 +35,14 @@ class IssueAssetStateCommand : CliktCommand(help = "Invokes the IssueAssetState
2835 private val tokenType: String by argument()
2936 val config by requireObject<Map <String , String >>()
3037 override fun run () {
31- issueAssetStateHelper(quantity.toInt (), tokenType, config)
38+ issueAssetStateHelper(quantity.toLong (), tokenType, config)
3239 }
3340}
3441
3542/* *
3643 * Helper function used by IssueAssetStateCommand
3744 */
38- fun issueAssetStateHelper (numberOfTokens : Int , tokenType : String , config : Map <String , String >) {
45+ fun issueAssetStateHelper (numberOfTokens : Long , tokenType : String , config : Map <String , String >) {
3946 val rpc = NodeRPCConnection (
4047 host = config[" CORDA_HOST" ]!! ,
4148 username = " clientUser1" ,
@@ -106,11 +113,11 @@ class GetAssetStatesByTypeCommand : CliktCommand(help = "Get asset states by tok
106113}
107114
108115/* *
109- * The CLI command used to trigger a GetStateByLinearId flow.
116+ * The CLI command used to trigger a GetAssetStateByLinearId flow.
110117 *
111118 * @property linearId The linearId for the [AssetState] to be retrieved.
112119 */
113- class GetAssetStateUsingLinearIdCommand : CliktCommand (help = " Gets asset state by linearId. Requires a linearId" ) {
120+ class GetAssetStateByLinearIdCommand : CliktCommand (help = " Gets asset state by linearId. Requires a linearId" ) {
114121 private val linearId: String by argument()
115122 val config by requireObject<Map <String , String >>()
116123 override fun run () {
@@ -122,7 +129,7 @@ class GetAssetStateUsingLinearIdCommand : CliktCommand(help = "Gets asset state
122129 rpcPort = config[" CORDA_PORT" ]!! .toInt())
123130 try {
124131 val proxy = rpc.proxy
125- val state = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow :: GetStateByLinearId , linearId)
132+ val state = proxy.startFlow(:: GetAssetStateByLinearId , linearId)
126133 .returnValue.get()
127134 println (state)
128135 } catch (e: Exception ) {
@@ -150,7 +157,7 @@ class DeleteAssetStateCommand : CliktCommand(help = "Invokes the DeleteAssetStat
150157 rpcPort = config[" CORDA_PORT" ]!! .toInt())
151158 try {
152159 val proxy = rpc.proxy
153- val deletedState = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow ::DeleteAssetState , linearId)
160+ val deletedState = proxy.startFlow(::DeleteAssetState , linearId)
154161 .returnValue.get().inputs.first()
155162 println (deletedState)
156163 } catch (e: Exception ) {
@@ -180,7 +187,7 @@ class MergeAssetStatesCommand : CliktCommand(help = "Invokes the MergeAssetState
180187 rpcPort = config[" CORDA_PORT" ]!! .toInt())
181188 try {
182189 val proxy = rpc.proxy
183- val mergedState = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow ::MergeAssetStates , linearId1, linearId2)
190+ val mergedState = proxy.startFlow(::MergeAssetStates , linearId1, linearId2)
184191 .returnValue.get().inputs.first()
185192 println (mergedState)
186193 } catch (e: Exception ) {
@@ -210,7 +217,7 @@ class RetrieveAssetStateAndRefCommand : CliktCommand(help = "Invokes the Retriev
210217 rpcPort = config[" CORDA_PORT" ]!! .toInt())
211218 try {
212219 val proxy = rpc.proxy
213- val stateAndRef = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow ::RetrieveStateAndRef , tokenType, quantity.toInt ())
220+ val stateAndRef = proxy.startFlow(::RetrieveStateAndRef , tokenType, quantity.toLong ())
214221 .returnValue.get()
215222 println (stateAndRef.toString())
216223 } catch (e: Exception ) {
@@ -243,7 +250,7 @@ class SplitAssetStateCommand : CliktCommand(help = "Invokes the SplitAssetState
243250 rpcPort = config[" CORDA_PORT" ]!! .toInt())
244251 try {
245252 val proxy = rpc.proxy
246- val outputStates = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow ::SplitAssetState , linearId, quantity1.toInt (), quantity2.toInt ())
253+ val outputStates = proxy.startFlow(::SplitAssetState , linearId, quantity1.toLong (), quantity2.toLong ())
247254 .returnValue.get().inputs
248255 println (outputStates)
249256 } catch (e: Exception ) {
@@ -275,7 +282,7 @@ class TransferAssetStateCommand : CliktCommand(help = "Invokes the TransferAsset
275282 val proxy = rpc.proxy
276283 val partyX500Name = CordaX500Name .parse(partyName)
277284 val otherParty = proxy.wellKnownPartyFromX500Name(partyX500Name) ? : return println (" Party named $partyName cannot be found.\n " )
278- val outputStates = proxy.startFlow(com.cordaSimpleApplication.flow. AssetFlow ::TransferAssetStateInitiator , linearId, otherParty)
285+ val outputStates = proxy.startFlow(::TransferAssetStateInitiator , linearId, otherParty)
279286 .returnValue.get().inputs
280287 println (outputStates)
281288 } catch (e: Exception ) {
0 commit comments