Skip to content

Commit

Permalink
feat(corda): support 5.1 via TS/HTTP (no JVM)
Browse files Browse the repository at this point in the history
Fixes #2978
Fixes #3293

Signed-off-by: adrianbatuto <adrian.batuto@accenture.com>
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
adrianbatuto committed Jul 19, 2024
1 parent 603ff0e commit 15069c2
Show file tree
Hide file tree
Showing 58 changed files with 6,549 additions and 124 deletions.
4 changes: 4 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@
"couchdb",
"COUCHDBADDRESS",
"COUCHDBCONFIG",
"CPIV",
"cplcs",
"Creds",
"Crpc",
"CSDE",
"csdetemplate",
"data",
"davecgh",
"dclm",
Expand Down Expand Up @@ -197,6 +200,7 @@
"undici",
"unixfs",
"Unmarshal",
"utxoexample",
"uuidv",
"vscc",
"vuln",
Expand Down
5 changes: 4 additions & 1 deletion packages/cactus-plugin-ledger-connector-corda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@
"@hyperledger/cactus-core": "2.0.0-rc.2",
"@hyperledger/cactus-core-api": "2.0.0-rc.2",
"axios": "1.6.0",
"express": "4.19.2",
"express-openapi-validator": "5.2.0",
"internal-ip": "6.2.0",
"joi": "17.13.3",
"node-fetch": "2.7.0",
"node-ssh": "13.1.0",
"prom-client": "15.1.3",
"rxjs": "7.8.1",
"temp": "0.9.4",
"typescript-optional": "2.0.1"
"typescript-optional": "2.0.1",
"urlcat": "3.1.0"
},
"devDependencies": {
"@hyperledger/cactus-test-tooling": "2.0.0-rc.2",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ settings.gradle
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiUtil.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CPIIDV1.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ClearMonitorTransactionsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/CordaNodeSshCredentials.kt
Expand All @@ -16,6 +17,11 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/DiagnoseNodeV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowInvocationType.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV1Responses.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowStatusV1ResponsesFlowStatusResponsesInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/FlowV1Error.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetFlowCidV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetFlowCidV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/GetMonitorTransactionsV1ResponseTxInner.kt
Expand All @@ -25,6 +31,10 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmObject.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmType.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/JvmTypeKind.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1ResponseCpisInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListCpiV1ResponseCpisInnerCpksInner.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListFlowsV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/ListFlowsV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/NetworkHostAndPort.kt
Expand All @@ -33,6 +43,9 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/Party.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/PublicKey.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/SHA256.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1RequestRequestBody.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartFlowV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Request.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StartMonitorV1Response.kt
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StopMonitorV1Request.kt
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request
Expand Down Expand Up @@ -80,6 +87,17 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/getFlowCid"],
produces = ["text/plain"],
consumes = ["application/json"]
)
fun getFlowV1( @Valid @RequestBody getFlowCidV1Request: GetFlowCidV1Request): ResponseEntity<GetFlowCidV1Response> {
return ResponseEntity(service.getFlowV1(getFlowCidV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions"],
Expand Down Expand Up @@ -112,6 +130,28 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listCPI"],
produces = ["application/json"],
consumes = ["application/json"]
)
fun listCpiV1( @Valid @RequestBody listCpiV1Request: ListCpiV1Request): ResponseEntity<ListCpiV1Response> {
return ResponseEntity(service.listCpiV1(listCpiV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.GET],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listFlows"],
produces = ["text/plain"],
consumes = ["application/json"]
)
fun listFlowV1( @Valid @RequestBody getFlowCidV1Request: GetFlowCidV1Request): ResponseEntity<FlowStatusV1Responses> {
return ResponseEntity(service.listFlowV1(getFlowCidV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows"],
Expand All @@ -134,6 +174,17 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/startFlow"],
produces = ["application/json"],
consumes = ["application/json"]
)
fun startFlowV1( @Valid @RequestBody startFlowV1Request: StartFlowV1Request): ResponseEntity<StartFlowV1Response> {
return ResponseEntity(service.startFlowV1(startFlowV1Request), HttpStatus.valueOf(200))
}


@RequestMapping(
method = [RequestMethod.POST],
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployC
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DeployContractJarsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.DiagnoseNodeV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1Responses
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetFlowCidV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.InvokeContractV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListCpiV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.ListFlowsV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.NodeInfo
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartFlowV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Request
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request
Expand Down Expand Up @@ -51,6 +58,17 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun diagnoseNodeV1(diagnoseNodeV1Request: DiagnoseNodeV1Request?): DiagnoseNodeV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/getFlowCid : This method gets the current status of the specified flow instance.
*
* @param getFlowCidV1Request This method gets the current status of the specified flow instance. (required)
* @return OK (status code 200)
* or Unauthorized (status code 401)
* or Forbidden (status code 403)
* @see ApiPluginLedgerConnectorCorda#getFlowV1
*/
fun getFlowV1(getFlowCidV1Request: GetFlowCidV1Request): GetFlowCidV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions : Get transactions for monitored state classes.
*
Expand All @@ -77,6 +95,26 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun invokeContractV1(invokeContractV1Request: InvokeContractV1Request?): InvokeContractV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listCPI : List all CPIs uploaded to the cluster
*
* @param listCpiV1Request (required)
* @return OK (status code 200)
* @see ApiPluginLedgerConnectorCorda#listCpiV1
*/
fun listCpiV1(listCpiV1Request: ListCpiV1Request): ListCpiV1Response

/**
* GET /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/listFlows : This method returns an array containing the statuses of all flows running for a specified holding identity. An empty array is returned if there are no flows running.
*
* @param getFlowCidV1Request This method gets the current status of the specified flow instance. (required)
* @return OK (status code 200)
* or Unauthorized (status code 401)
* or Forbidden (status code 403)
* @see ApiPluginLedgerConnectorCorda#listFlowV1
*/
fun listFlowV1(getFlowCidV1Request: GetFlowCidV1Request): FlowStatusV1Responses

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows
* Responds with a list of the flows on the Corda node.
Expand All @@ -97,6 +135,15 @@ interface ApiPluginLedgerConnectorCordaService {
*/
fun networkMapV1(body: kotlin.Any?): List<NodeInfo>

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/startFlow : This method starts a new instance for the specified flow for the specified holding identity.
*
* @param startFlowV1Request Request body for starting a flow (required)
* @return OK (status code 200)
* @see ApiPluginLedgerConnectorCorda#startFlowV1
*/
fun startFlowV1(startFlowV1Request: StartFlowV1Request): StartFlowV1Response

/**
* POST /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor : Start monitoring corda changes (transactions) of given state class
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param name
* @param version
* @param signerSummaryHash
*/
data class CPIIDV1(

@get:JsonProperty("name", required = true) val name: kotlin.String,

@get:JsonProperty("version", required = true) val version: kotlin.String,

@get:JsonProperty("signerSummaryHash") val signerSummaryHash: kotlin.String? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowStatusV1ResponsesFlowStatusResponsesInner
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param flowStatusResponses
*/
data class FlowStatusV1Responses(

@field:Valid
@get:JsonProperty("flowStatusResponses") val flowStatusResponses: kotlin.collections.List<FlowStatusV1ResponsesFlowStatusResponsesInner>? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.FlowV1Error
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param clientRequestId
* @param flowError
* @param flowId
* @param flowResult
* @param flowStatus
* @param holdingIDShortHash
* @param timestamp
*/
data class FlowStatusV1ResponsesFlowStatusResponsesInner(

@get:JsonProperty("clientRequestId") val clientRequestId: kotlin.String? = null,

@field:Valid
@get:JsonProperty("flowError") val flowError: FlowV1Error? = null,

@get:JsonProperty("flowId") val flowId: kotlin.String? = null,

@get:JsonProperty("flowResult") val flowResult: kotlin.String? = null,

@get:JsonProperty("flowStatus") val flowStatus: kotlin.String? = null,

@get:JsonProperty("holdingIDShortHash") val holdingIDShortHash: kotlin.String? = null,

@get:JsonProperty("timestamp") val timestamp: java.time.OffsetDateTime? = null
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.hyperledger.cactus.plugin.ledger.connector.corda.server.model

import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import javax.validation.constraints.DecimalMax
import javax.validation.constraints.DecimalMin
import javax.validation.constraints.Email
import javax.validation.constraints.Max
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern
import javax.validation.constraints.Size
import javax.validation.Valid

/**
*
* @param message
* @param type
*/
data class FlowV1Error(

@get:JsonProperty("message", required = true) val message: kotlin.String,

@get:JsonProperty("type", required = true) val type: kotlin.String
) {

}
Loading

0 comments on commit 15069c2

Please sign in to comment.