Skip to content

Commit b18a4e6

Browse files
committed
feat(weaver): weaver fabric driver connector implementation
Signed-off-by: Carlos Amaro <[email protected]>
1 parent 4244eb6 commit b18a4e6

File tree

149 files changed

+21870
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+21870
-60
lines changed

packages/cactus-plugin-ccmodel-hephaestus/src/main/typescript/plugin-ccmodel-hephaestus.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ export class CcModelHephaestus implements ICactusPlugin, IPluginWebService {
260260
private createReceiptFromRunTxReqWithTxId(
261261
data: IRunTxReqWithTxId,
262262
): FabricV2TxReceipt {
263+
if (!data.request.signingCredential) {
264+
throw new Error(
265+
`Cannot create FabricV2TxReceipt if signingCredential is missing in IRunTxReqWithTxId`,
266+
);
267+
}
263268
return {
264269
caseID: this.caseID,
265270
blockchainID: LedgerType.Fabric2,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CONNECTION_PROFILE=path_to_connection_profile
2+
RELAY_ENDPOINT=localhost:9080
3+
RELAY_TLS=false
4+
RELAY_TLSCA_CERT_PATH=path_to_tls_ca_cert_pem_for_relay
5+
DRIVER_ENDPOINT=localhost:9090
6+
DRIVER_TLS=false
7+
DRIVER_TLS_CERT_PATH=path_to_tls_cert_pem_for_driver
8+
DRIVER_TLS_KEY_PATH=path_to_tls_key_pem_for_driver
9+
NETWORK_NAME=network1
10+
DRIVER_CONFIG=
11+
INTEROP_CHAINCODE=interop
12+
MOCK=false
13+
DB_PATH=driverdbs
14+
WALLET_PATH=
15+
DEBUG=true
16+
LEVELDB_LOCKED_MAX_RETRIES=
17+
LEVELDB_LOCKED_RETRY_BACKOFF_MSEC=
18+
ENABLE_MONITOR=false
19+
MONITOR_SYNC_PERIOD=
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.env
2+
wallet-network1/*.id
3+
!wallet-network1/relay.id
4+
wallet-network2/*.id
5+
!wallet-network2/relay.id
6+
driverdbs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: v2
2+
clean: true
3+
plugins:
4+
- local: protoc-gen-es
5+
out: src/main/typescript/generated/protos/
6+
opt: target=ts
7+
strategy: directory
8+
- local: protoc-gen-connect-es
9+
out: src/main/typescript/generated/protos/
10+
opt:
11+
- target=ts
12+
- js_import_style=module
13+
strategy: directory
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: v2
2+
modules:
3+
- path: src/main/protos/driver-protos
4+
- path: src/main/protos/fabric-protos
5+
lint:
6+
use:
7+
- STANDARD
8+
except:
9+
- PACKAGE_VERSION_SUFFIX
10+
enum_zero_value_suffix: _UNSPECIFIED
11+
rpc_allow_same_request_response: true
12+
rpc_allow_google_protobuf_empty_requests: true
13+
rpc_allow_google_protobuf_empty_responses: true
14+
service_suffix: Service
15+
breaking:
16+
use:
17+
- FILE
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"admin":{
3+
"name":"admin",
4+
"secret":"adminpw"
5+
},
6+
"relay": {
7+
"name":"relay",
8+
"affiliation":"org1.department1",
9+
"role": "client",
10+
"attrs": [{ "name": "relay", "value": "true", "ecert": true }]
11+
},
12+
"mspId":"Org1MSP",
13+
"caUrl":""
14+
}

packages/cactus-plugin-ledger-connector-fabric/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
"dist/*"
4444
],
4545
"scripts": {
46+
"start-fabric-weaver-driver": "node ./dist/lib/main/typescript/plugin-ledger-connector-fabric-cli.js",
4647
"codegen": "yarn run --top-level run-s 'codegen:*'",
4748
"codegen:openapi": "npm run generate-sdk",
49+
"codegen:proto": "buf generate --verbose",
4850
"generate-sdk": "run-p 'generate-sdk:*'",
4951
"generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
5052
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
@@ -56,14 +58,21 @@
5658
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
5759
},
5860
"dependencies": {
61+
"@bufbuild/protobuf": "2.2.2",
62+
"@connectrpc/connect": "2.0.0",
63+
"@connectrpc/connect-express": "2.0.0",
64+
"@connectrpc/connect-node": "2.0.0",
65+
"@connectrpc/protoc-gen-connect-es": "1.6.1",
5966
"@fidm/x509": "1.2.1",
67+
"@hyperledger/cacti-weaver-protos-js": "2.1.0",
6068
"@hyperledger/cactus-common": "2.1.0",
6169
"@hyperledger/cactus-core": "2.1.0",
6270
"@hyperledger/cactus-core-api": "2.1.0",
6371
"axios": "1.8.4",
6472
"bl": "6.1.0",
6573
"bn.js": "4.12.0",
6674
"dockerode": "3.3.0",
75+
"dotenv": "17.2.3",
6776
"elliptic": "6.6.1",
6877
"express": "5.1.0",
6978
"fabric-ca-client": "2.5.0-snapshot.23",
@@ -72,11 +81,14 @@
7281
"fabric-protos": "2.5.0-snapshot.23",
7382
"fast-safe-stringify": "2.1.1",
7483
"form-data": "4.0.0",
84+
"google-protobuf": "3.21.2",
7585
"http-errors": "2.0.0",
7686
"http-status-codes": "2.1.4",
87+
"http2": "^3.3.7",
7788
"joi": "17.13.3",
7889
"json5": "2.2.3",
7990
"jsrsasign": "11.0.0",
91+
"level": "8.0.0",
8092
"lodash": "4.17.21",
8193
"long": "5.2.3",
8294
"multer": "1.4.5-lts.1",
@@ -99,6 +111,10 @@
99111
"ws-identity-client": "1.0.2"
100112
},
101113
"devDependencies": {
114+
"@bufbuild/buf": "1.47.2",
115+
"@bufbuild/protoc-gen-es": "2.2.2",
116+
"@grpc/grpc-js": "1.13.3",
117+
"@grpc/proto-loader": "0.7.13",
102118
"@hyperledger/cactus-plugin-keychain-memory": "2.1.0",
103119
"@hyperledger/cactus-test-tooling": "2.1.0",
104120
"@types/bn.js": "5.1.0",
@@ -107,6 +123,7 @@
107123
"@types/elliptic": "6.4.16",
108124
"@types/express": "5.0.1",
109125
"@types/fs-extra": "11.0.4",
126+
"@types/google-protobuf": "3.15.12",
110127
"@types/http-errors": "2.0.4",
111128
"@types/jsrsasign": "8.0.13",
112129
"@types/lodash": "4.14.172",
@@ -118,7 +135,9 @@
118135
"@types/uuid": "10.0.0",
119136
"body-parser": "1.20.3",
120137
"fs-extra": "11.2.0",
138+
"grpc_tools_node_protoc_ts": "5.3.3",
121139
"internal-ip": "6.2.0",
140+
"protobufjs": "7.2.5",
122141
"socket.io": "4.6.2",
123142
"ws-wallet": "1.1.5"
124143
},

packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ model_deploy_contract_v1_request_constructor_args.go
2222
model_deploy_contract_v1_response.go
2323
model_deployment_target_org_fabric2x.go
2424
model_deployment_target_organization.go
25+
model_endorsed_proposal_response.go
26+
model_endorsement.go
2527
model_error_exception_response_v1.go
28+
model_event_type.go
2629
model_fabric_certificate_identity_v1.go
2730
model_fabric_contract_invocation_type.go
2831
model_fabric_signing_credential.go
2932
model_fabric_signing_credential_type.go
33+
model_fabric_view.go
3034
model_fabric_x509_certificate_v1.go
3135
model_file_base64.go
3236
model_full_block_transaction_action_v1.go
@@ -53,8 +57,13 @@ model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go
5357
model_get_discovery_results_response_v1_peers_by_msp_value.go
5458
model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go
5559
model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go
60+
model_get_latest_block_number_request_v1.go
61+
model_get_latest_block_number_response_v1.go
5662
model_get_transaction_receipt_response.go
63+
model_proposal_response_payload.go
5764
model_run_delegated_sign_transaction_request.go
65+
model_run_invoke_request.go
66+
model_run_invoke_response.go
5867
model_run_transaction_request.go
5968
model_run_transaction_response.go
6069
model_run_transaction_response_type.go

packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Class | Method | HTTP request | Description
8181
*DefaultApi* | [**GetBlockV1**](docs/DefaultApi.md#getblockv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x.
8282
*DefaultApi* | [**GetChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info.
8383
*DefaultApi* | [**GetDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service).
84+
*DefaultApi* | [**GetLatestBlockNumberV1**](docs/DefaultApi.md#getlatestblocknumberv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number | Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x.
8485
*DefaultApi* | [**GetPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics
8586
*DefaultApi* | [**GetTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger.
8687
*DefaultApi* | [**RunDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback.
@@ -105,11 +106,15 @@ Class | Method | HTTP request | Description
105106
- [DeployContractV1Response](docs/DeployContractV1Response.md)
106107
- [DeploymentTargetOrgFabric2x](docs/DeploymentTargetOrgFabric2x.md)
107108
- [DeploymentTargetOrganization](docs/DeploymentTargetOrganization.md)
109+
- [EndorsedProposalResponse](docs/EndorsedProposalResponse.md)
110+
- [Endorsement](docs/Endorsement.md)
108111
- [ErrorExceptionResponseV1](docs/ErrorExceptionResponseV1.md)
112+
- [EventType](docs/EventType.md)
109113
- [FabricCertificateIdentityV1](docs/FabricCertificateIdentityV1.md)
110114
- [FabricContractInvocationType](docs/FabricContractInvocationType.md)
111115
- [FabricSigningCredential](docs/FabricSigningCredential.md)
112116
- [FabricSigningCredentialType](docs/FabricSigningCredentialType.md)
117+
- [FabricView](docs/FabricView.md)
113118
- [FabricX509CertificateV1](docs/FabricX509CertificateV1.md)
114119
- [FileBase64](docs/FileBase64.md)
115120
- [FullBlockTransactionActionV1](docs/FullBlockTransactionActionV1.md)
@@ -136,8 +141,13 @@ Class | Method | HTTP request | Description
136141
- [GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md)
137142
- [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md)
138143
- [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md)
144+
- [GetLatestBlockNumberRequestV1](docs/GetLatestBlockNumberRequestV1.md)
145+
- [GetLatestBlockNumberResponseV1](docs/GetLatestBlockNumberResponseV1.md)
139146
- [GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md)
147+
- [ProposalResponsePayload](docs/ProposalResponsePayload.md)
140148
- [RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md)
149+
- [RunInvokeRequest](docs/RunInvokeRequest.md)
150+
- [RunInvokeResponse](docs/RunInvokeResponse.md)
141151
- [RunTransactionRequest](docs/RunTransactionRequest.md)
142152
- [RunTransactionResponse](docs/RunTransactionResponse.md)
143153
- [RunTransactionResponseType](docs/RunTransactionResponseType.md)

0 commit comments

Comments
 (0)