Skip to content

Commit

Permalink
add feature cactus-plugin-persistence-fabric
Browse files Browse the repository at this point in the history
Signed-off-by: Barnaba Pawełczak <barnaba.pawelczak@fujitsu.com>
  • Loading branch information
barnapa committed Apr 3, 2023
1 parent 703d56a commit 22213f2
Show file tree
Hide file tree
Showing 41 changed files with 4,269 additions and 216 deletions.
309 changes: 154 additions & 155 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,157 +1,156 @@
{
"version": "0.1",
"language": "en",
"minWordLength": 4,
"allowCompoundWords": true,
"words": [
"adminpw",
"Albertirsa",
"ALLFORTX",
"ANYFORTX",
"APIV",
"approveformyorg",
"Authz",
"authzn",
"AWSSM",
"Besu",
"Bools",
"brioux",
"cactusf",
"cafile",
"caio",
"cccs",
"ccid",
"celo",
"cids",
"clsx",
"commenceack",
"configtx",
"Corda",
"Cordapp",
"couchdb",
"COUCHDBADDRESS",
"COUCHDBCONFIG",
"data",
"dclm",
"DHTAPI",
"DockerOde",
"ealen",
"ecparams",
"embeddable",
"Errorf",
"escc",
"execa",
"faio",
"fidm",
"flowdb",
"fsouza",
"GETHKEYCHAINPASSWORD",
"ghcr",
"gopath",
"goquorum",
"grpc",
"grpcs",
"grpcwebtext",
"guks",
"hada",
"hashicorp",
"Healthcheck",
"htlc",
"Htlc",
"HTLC",
"HyperLedger",
"ipaddress",
"ipfs",
"Iroha",
"Irohad",
"isready",
"jboss",
"JORDI",
"jsrsa",
"jsrsasign",
"Keychain",
"Keycloak",
"KEYUTIL",
"KJUR",
"Knetic",
"LEDGERBLOCKACK",
"leveldb",
"lmify",
"LOCALMSPID",
"miekg",
"mitchellh",
"MSPCONFIGPATH",
"MSPID",
"MSPIDSCOPEALLFORTX",
"MSPIDSCOPEANYFORTX",
"Mtls",
"myapp",
"mychannel",
"myroot",
"mysecretpassword",
"myvolume",
"Nerc",
"NETWORKSCOPEALLFORTX",
"NETWORKSCOPEANYFORTX",
"NODETXPOOLACK",
"notok",
"Odap",
"Oidc",
"oneofs",
"onsi",
"OpenAPI",
"openethereum",
"organisation",
"Orgs",
"parameterizable",
"Postgres",
"proto",
"protobuf",
"protoc",
"protos",
"qscc",
"recoverupdateackmessage",
"RUSTC",
"Rwset",
"sbjpubkey",
"Secp",
"shrn",
"Smonitor",
"socketio",
"SPDX",
"Splug",
"Sprintf",
"stretchr",
"supervisorctl",
"supervisord",
"svcs",
"sykesm",
"tezos",
"TEZOS",
"thream",
"tlsca",
"tlscacerts",
"txid",
"txqueue",
"Uisrs",
"undici",
"Unmarshal",
"uuidv",
"vscc",
"wasm",
"Xdai"
],
"dictionaries": [
"typescript,node,npm,go,rust"
],
"ignorePaths": [
"**/node_modules/**",
"**/build/**",
"**/src/main/typescript/generated/**",
"packages/cactus-plugin-verifier-cc/**",
"packages/cactus-cmd-socketio-server/**",
"packages/cactus-plugin-ledger-connector-sawtooth-socketio/**",
"packages/cactus-plugin-ledger-connector-go-ethereum-socketio/**",
"packages/cactus-plugin-ledger-connector-*-socketio/**"
]
"version": "0.1",
"language": "en",
"minWordLength": 4,
"allowCompoundWords": true,
"words": [
"adminpw",
"Albertirsa",
"ALLFORTX",
"ANYFORTX",
"APIV",
"approveformyorg",
"Authz",
"authzn",
"AWSSM",
"Besu",
"Bools",
"brioux",
"cactusf",
"cafile",
"caio",
"cccs",
"ccid",
"celo",
"cids",
"clsx",
"commenceack",
"configtx",
"Corda",
"Cordapp",
"couchdb",
"COUCHDBADDRESS",
"COUCHDBCONFIG",
"data",
"dclm",
"DHTAPI",
"DockerOde",
"ealen",
"ecparams",
"embeddable",
"Errorf",
"escc",
"execa",
"faio",
"fidm",
"flowdb",
"fsouza",
"GETHKEYCHAINPASSWORD",
"ghcr",
"gopath",
"goquorum",
"grpc",
"grpcs",
"grpcwebtext",
"guks",
"hada",
"hashicorp",
"Healthcheck",
"htlc",
"Htlc",
"HTLC",
"HyperLedger",
"ipaddress",
"ipfs",
"Iroha",
"Irohad",
"isready",
"jboss",
"JORDI",
"jsrsa",
"jsrsasign",
"Keychain",
"Keycloak",
"KEYUTIL",
"KJUR",
"Knetic",
"LEDGERBLOCKACK",
"leveldb",
"lmify",
"LOCALMSPID",
"miekg",
"mitchellh",
"MSPCONFIGPATH",
"MSPID",
"MSPIDSCOPEALLFORTX",
"MSPIDSCOPEANYFORTX",
"Mtls",
"myapp",
"mychannel",
"myroot",
"mysecretpassword",
"myvolume",
"Nerc",
"NETWORKSCOPEALLFORTX",
"NETWORKSCOPEANYFORTX",
"NODETXPOOLACK",
"notok",
"Odap",
"Oidc",
"oneofs",
"onsi",
"OpenAPI",
"openethereum",
"organisation",
"Orgs",
"parameterizable",
"Postgres",
"proto",
"protobuf",
"protoc",
"protos",
"qscc",
"recoverupdateackmessage",
"RUSTC",
"Rwset",
"sbjpubkey",
"Secp",
"shrn",
"Smonitor",
"socketio",
"SPDX",
"Splug",
"Sprintf",
"stretchr",
"supervisorctl",
"supervisord",
"svcs",
"sykesm",
"tezos",
"TEZOS",
"thream",
"tlsca",
"tlscacerts",
"txid",
"txqueue",
"Uisrs",
"undici",
"Unmarshal",
"uuidv",
"vscc",
"wasm",
"Xdai",
"ossp"
],
"dictionaries": ["typescript,node,npm,go,rust"],
"ignorePaths": [
"**/node_modules/**",
"**/build/**",
"**/src/main/typescript/generated/**",
"packages/cactus-plugin-verifier-cc/**",
"packages/cactus-cmd-socketio-server/**",
"packages/cactus-plugin-ledger-connector-sawtooth-socketio/**",
"packages/cactus-plugin-ledger-connector-go-ethereum-socketio/**",
"packages/cactus-plugin-ledger-connector-*-socketio/**"
]
}
1 change: 1 addition & 0 deletions jest.config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cactus-cmd-api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"bluebird": "3.7.2",
"body-parser": "1.19.0",
"compression": "1.7.4",
"convict": "6.2.4",
"convict": "6.2.3",
"convict-format-with-validator": "6.2.0",
"cors": "2.8.5",
"express": "4.17.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import path from "path";
import * as fabricprototypes from "fabric-protos";

import { Certificate } from "@fidm/x509";
import { Express } from "express";
Expand Down Expand Up @@ -951,8 +952,10 @@ export class PluginLedgerConnectorFabric
protected async createGateway(req: RunTransactionRequest): Promise<Gateway> {
if (req.gatewayOptions) {
return this.createGatewayWithOptions(req.gatewayOptions);
} else {
} else if (req.signingCredential) {
return this.createGatewayLegacy(req.signingCredential);
} else {
throw new Error("Missing either gatewayOptions or signingCredential");
}
}

Expand Down Expand Up @@ -1102,6 +1105,23 @@ export class PluginLedgerConnectorFabric
let transactionId = "";
switch (invocationType) {
case FabricContractInvocationType.Call: {
if (fnName === "getLastBlock") {
const result = await contract.evaluateTransaction(
"GetChainInfo",
...params,
);

const blockProto = JSON.stringify(
fabricprototypes.common.BlockchainInfo.decode(result),
);
const lastBlockPreview = JSON.parse(blockProto);
this.log.info("lastBlockPreview ", lastBlockPreview.height);
this.log.info(lastBlockPreview.height.toString());
this.log.info(blockProto);
out = lastBlockPreview.height;
success = true;
break;
}
out = await contract.evaluateTransaction(fnName, ...params);
success = true;
break;
Expand Down
2 changes: 2 additions & 0 deletions packages/cactus-plugin-persistence-fabric/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cactus-openapi-spec-plugin-consortium-manual.json
src/main/typescript/generated/openapi/typescript-axios/.npmignore
5 changes: 5 additions & 0 deletions packages/cactus-plugin-persistence-fabric/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

Loading

0 comments on commit 22213f2

Please sign in to comment.