Skip to content

Commit 5fb3635

Browse files
committed
start
Signed-off-by: Carlos Amaro <[email protected]> feat(fabric-connector): invoke function Signed-off-by: Carlos Amaro <[email protected]> feat(fabric-connector): chaincode listner for blocks Signed-off-by: Carlos Amaro <[email protected]> continuation Signed-off-by: Carlos Amaro <[email protected]> cont Signed-off-by: Carlos Amaro <[email protected]> more implementation Signed-off-by: Carlos Amaro <[email protected]> progress and add getLatestBlockNumber to the connector Signed-off-by: Carlos Amaro <[email protected]> listener and events Signed-off-by: Carlos Amaro <[email protected]> continuation Signed-off-by: Carlos Amaro <[email protected]> continuation Signed-off-by: Carlos Amaro <[email protected]> compilable version Signed-off-by: Carlos Amaro <[email protected]>
1 parent 4244eb6 commit 5fb3635

File tree

140 files changed

+21565
-48
lines changed

Some content is hidden

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

140 files changed

+21565
-48
lines changed
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

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"scripts": {
4646
"codegen": "yarn run --top-level run-s 'codegen:*'",
4747
"codegen:openapi": "npm run generate-sdk",
48+
"codegen:proto": "buf generate --verbose",
4849
"generate-sdk": "run-p 'generate-sdk:*'",
4950
"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",
5051
"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,7 +57,13 @@
5657
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
5758
},
5859
"dependencies": {
60+
"@bufbuild/protobuf": "2.2.2",
61+
"@connectrpc/connect": "2.0.0",
62+
"@connectrpc/connect-express": "2.0.0",
63+
"@connectrpc/connect-node": "2.0.0",
64+
"@connectrpc/protoc-gen-connect-es": "1.6.1",
5965
"@fidm/x509": "1.2.1",
66+
"@hyperledger/cacti-weaver-protos-js": "2.1.0",
6067
"@hyperledger/cactus-common": "2.1.0",
6168
"@hyperledger/cactus-core": "2.1.0",
6269
"@hyperledger/cactus-core-api": "2.1.0",
@@ -72,12 +79,14 @@
7279
"fabric-protos": "2.5.0-snapshot.23",
7380
"fast-safe-stringify": "2.1.1",
7481
"form-data": "4.0.0",
82+
"google-protobuf": "3.21.2",
7583
"http-errors": "2.0.0",
7684
"http-status-codes": "2.1.4",
7785
"joi": "17.13.3",
7886
"json5": "2.2.3",
7987
"jsrsasign": "11.0.0",
8088
"lodash": "4.17.21",
89+
"level": "8.0.0",
8190
"long": "5.2.3",
8291
"multer": "1.4.5-lts.1",
8392
"ngo": "2.7.0",
@@ -99,6 +108,10 @@
99108
"ws-identity-client": "1.0.2"
100109
},
101110
"devDependencies": {
111+
"@bufbuild/buf": "1.47.2",
112+
"@bufbuild/protoc-gen-es": "2.2.2",
113+
"@grpc/grpc-js": "1.13.3",
114+
"@grpc/proto-loader": "0.7.13",
102115
"@hyperledger/cactus-plugin-keychain-memory": "2.1.0",
103116
"@hyperledger/cactus-test-tooling": "2.1.0",
104117
"@types/bn.js": "5.1.0",
@@ -107,6 +120,7 @@
107120
"@types/elliptic": "6.4.16",
108121
"@types/express": "5.0.1",
109122
"@types/fs-extra": "11.0.4",
123+
"@types/google-protobuf": "3.15.12",
110124
"@types/http-errors": "2.0.4",
111125
"@types/jsrsasign": "8.0.13",
112126
"@types/lodash": "4.14.172",
@@ -118,7 +132,9 @@
118132
"@types/uuid": "10.0.0",
119133
"body-parser": "1.20.3",
120134
"fs-extra": "11.2.0",
135+
"grpc_tools_node_protoc_ts": "5.3.3",
121136
"internal-ip": "6.2.0",
137+
"protobufjs": "7.2.5",
122138
"socket.io": "4.6.2",
123139
"ws-wallet": "1.1.5"
124140
},

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)

packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,34 @@ paths:
149149
http:
150150
verbLowerCase: post
151151
path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block
152+
/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number:
153+
post:
154+
operationId: getLatestBlockNumberV1
155+
parameters: []
156+
requestBody:
157+
content:
158+
application/json:
159+
schema:
160+
$ref: '#/components/schemas/GetLatestBlockNumberRequestV1'
161+
responses:
162+
"200":
163+
content:
164+
application/json:
165+
schema:
166+
$ref: '#/components/schemas/GetLatestBlockNumberResponseV1'
167+
description: OK
168+
"500":
169+
content:
170+
application/json:
171+
schema:
172+
$ref: '#/components/schemas/ErrorExceptionResponseV1'
173+
description: Internal Server Error
174+
summary: Get block number from the channel using one of selectors from the input.
175+
Works only on Fabric 2.x.
176+
x-hyperledger-cacti:
177+
http:
178+
verbLowerCase: post
179+
path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number
152180
/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info:
153181
post:
154182
operationId: getChainInfoV1
@@ -441,6 +469,13 @@ components:
441469
- node
442470
- java
443471
type: string
472+
EventType:
473+
description: Type of event to listen supported by Hyperledger Fabric
474+
enum:
475+
- Contract
476+
- Block
477+
- Commit
478+
type: string
444479
ConnectionProfile:
445480
additionalProperties: true
446481
example:
@@ -655,6 +690,100 @@ components:
655690
- stderr
656691
- stdout
657692
type: object
693+
FabricView:
694+
properties:
695+
endorsedProposalResponses:
696+
items:
697+
$ref: '#/components/schemas/EndorsedProposalResponse'
698+
minItems: 1
699+
nullable: false
700+
type: array
701+
required:
702+
- EndorsedProposalResponses
703+
type: object
704+
EndorsedProposalResponse:
705+
properties:
706+
payload:
707+
$ref: '#/components/schemas/ProposalResponsePayload'
708+
endorsement:
709+
$ref: '#/components/schemas/endorsement'
710+
type: object
711+
ProposalResponsePayload:
712+
properties:
713+
proposalHash:
714+
format: byte
715+
nullable: false
716+
type: string
717+
extension:
718+
format: byte
719+
nullable: false
720+
type: string
721+
type: object
722+
endorsement:
723+
properties:
724+
endorser:
725+
format: byte
726+
nullable: false
727+
type: string
728+
signature:
729+
format: byte
730+
nullable: false
731+
type: string
732+
type: object
733+
RunInvokeResponse:
734+
properties:
735+
view:
736+
$ref: '#/components/schemas/FabricView'
737+
required:
738+
- view
739+
type: object
740+
RunInvokeRequest:
741+
additionalProperties: false
742+
properties:
743+
transientData:
744+
nullable: true
745+
type: object
746+
gatewayOptions:
747+
$ref: '#/components/schemas/GatewayOptions'
748+
signingCredential:
749+
$ref: '#/components/schemas/FabricSigningCredential'
750+
channelName:
751+
maxLength: 100
752+
minLength: 1
753+
nullable: false
754+
type: string
755+
contractName:
756+
maxLength: 100
757+
minLength: 1
758+
nullable: false
759+
type: string
760+
methodName:
761+
maxLength: 100
762+
minLength: 1
763+
nullable: false
764+
type: string
765+
params:
766+
default: []
767+
items:
768+
nullable: true
769+
type: string
770+
nullable: false
771+
type: array
772+
policies:
773+
default: []
774+
description: List of endorsers
775+
items:
776+
nullable: true
777+
type: string
778+
nullable: true
779+
type: array
780+
required:
781+
- channelName
782+
- contractName
783+
- methodName
784+
- params
785+
- signingCredential
786+
type: object
658787
RunTransactionResponseType:
659788
description: Response format from transaction / query execution
660789
enum:
@@ -1405,6 +1534,75 @@ components:
14051534
- gatewayOptions
14061535
- query
14071536
type: object
1537+
GetLatestBlockNumberRequestV1:
1538+
description: Request for GetBlockNumber endpoint.
1539+
example:
1540+
gatewayOptions:
1541+
wallet:
1542+
keychain:
1543+
vaultTransitKey:
1544+
keyName: keyName
1545+
token: token
1546+
keychainId: keychainId
1547+
keychainRef: keychainRef
1548+
webSocketKey:
1549+
signature: signature
1550+
sessionId: sessionId
1551+
type: null
1552+
json: json
1553+
connectionProfile:
1554+
channels:
1555+
key: ""
1556+
certificateAuthorities:
1557+
key: ""
1558+
name: basic-network
1559+
organizations:
1560+
key: ""
1561+
peers:
1562+
key: ""
1563+
x-type: hlfv1
1564+
description: The basic network
1565+
client:
1566+
organization: Org1
1567+
orderers:
1568+
key: ""
1569+
version: "1.0"
1570+
discovery:
1571+
asLocalhost: true
1572+
enabled: true
1573+
identity: identity
1574+
eventHandlerOptions:
1575+
commitTimeout: 0.8008281904610115
1576+
strategy: null
1577+
endorseTimeout: 6.027456183070403
1578+
channelName: channelName
1579+
properties:
1580+
channelName:
1581+
description: Fabric channel which we want to query.
1582+
maxLength: 100
1583+
minLength: 1
1584+
nullable: false
1585+
type: string
1586+
gatewayOptions:
1587+
$ref: '#/components/schemas/GatewayOptions'
1588+
required:
1589+
- channelName
1590+
- contractName
1591+
- gatewayOptions
1592+
- methodName
1593+
type: object
1594+
GetLatestBlockNumberResponseV1:
1595+
description: Response from GetBlockNumber endpoint.
1596+
example:
1597+
blockNumber: 0.8008281904610115
1598+
properties:
1599+
blockNumber:
1600+
description: Number of the block that was queried.
1601+
nullable: false
1602+
type: number
1603+
required:
1604+
- blockNumber
1605+
type: object
14081606
GetChainInfoRequestV1:
14091607
description: Request for GetChainInfo endpoint.
14101608
example:

0 commit comments

Comments
 (0)