diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 08c67181ba..3e34b03c08 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -57,7 +57,7 @@ jobs:
- './packages/cactus-core-api/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)'
- './packages/cactus-test-tooling/**!(*.md|*.css|*.html|*.jpg|*.jpeg|*.png)'
# - './.github/workflows/ci.yaml'
-
+
plugin-ledger-connector-aries-changed:
- './packages/cactus-plugin-ledger-connector-aries/**'
- './packages/cactus-common/**'
@@ -1507,33 +1507,6 @@ jobs:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/checkout@v4.1.1
- - id: yarn-cache
- name: Restore Yarn Cache
- uses: actions/cache@v4.0.1
- with:
- key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- path: ./.yarn/
- restore-keys: |
- ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- - run: ./tools/ci.sh
- cactus-plugin-ledger-connector-iroha:
- continue-on-error: false
- env:
- FULL_BUILD_DISABLED: true
- JEST_TEST_PATTERN: packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
- JEST_TEST_RUNNER_DISABLED: false
- TAPE_TEST_PATTERN: >-
- --files={./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts,./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts,./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts,./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/iroha-test-ledger-parameters.test.ts,./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/postgres-test-container-parameters.test.ts}
- TAPE_TEST_RUNNER_DISABLED: false
- needs: build-dev
- runs-on: ubuntu-22.04
- steps:
- - name: Use Node.js ${{ env.NODEJS_VERSION }}
- uses: actions/setup-node@v4.0.2
- with:
- node-version: ${{ env.NODEJS_VERSION }}
- - uses: actions/checkout@v4.1.1
-
- id: yarn-cache
name: Restore Yarn Cache
uses: actions/cache@v4.0.1
@@ -2046,7 +2019,7 @@ jobs:
JEST_TEST_PATTERN: packages/cactus-test-tooling/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
TAPE_TEST_PATTERN: >-
- --files={./packages/cactus-test-tooling/src/test/typescript/integration/besu/besu-test-ledger/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/fabric/fabric-test-ledger-v1/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/iroha/iroha-test-ledger/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/postgres/postgres-test-container/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/quorum/quorum-test-ledger/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-constructor.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-multiple-concurrent.test.ts}
+ --files={./packages/cactus-test-tooling/src/test/typescript/integration/besu/besu-test-ledger/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/fabric/fabric-test-ledger-v1/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/postgres/postgres-test-container/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/quorum/quorum-test-ledger/constructor-validates-options.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-constructor.test.ts,./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-multiple-concurrent.test.ts}
TAPE_TEST_RUNNER_DISABLED: false
runs-on: ubuntu-22.04
steps:
@@ -2298,21 +2271,6 @@ jobs:
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- ghcr-iroha-all-in-one:
- runs-on: ubuntu-22.04
- steps:
- - uses: actions/checkout@v4.1.1
- - name: ghcr.io/hyperledger/cactus-iroha-all-in-one
- run: DOCKER_BUILDKIT=1 docker build ./tools/docker/iroha-all-in-one/ -f ./tools/docker/iroha-all-in-one/Dockerfile -t cactus-iroha-all-in-one
- - name: Run Trivy vulnerability scan for cactus-iroha-all-in-one
- uses: aquasecurity/trivy-action@0.11.2
- with:
- image-ref: 'cactus-iroha-all-in-one'
- format: 'table'
- exit-code: '1'
- ignore-unfixed: true
- vuln-type: 'os,library'
- severity: 'CRITICAL,HIGH'
ghcr-keychain-vault-server:
runs-on: ubuntu-22.04
steps:
diff --git a/.github/workflows/iroha-all-in-one-publish.yaml b/.github/workflows/iroha-all-in-one-publish.yaml
deleted file mode 100644
index f87fcfec07..0000000000
--- a/.github/workflows/iroha-all-in-one-publish.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: iroha-all-in-one-publish
-
-on:
- push:
- # Publish `main` as Docker `latest` image.
- branches:
- - main
-
- # Publish `v1.2.3` tags as releases.
- tags:
- - v*
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-env:
- IMAGE_NAME: cactus-iroha-all-in-one
-
-jobs:
- # Push image to GitHub Packages.
- # See also https://docs.docker.com/docker-hub/builds/
- build-tag-push-container:
- runs-on: ubuntu-22.04
- env:
- DOCKER_BUILDKIT: 1
- DOCKERFILE_PATH: ./tools/docker/iroha-all-in-one/Dockerfile
- DOCKER_BUILD_DIR: ./tools/docker/iroha-all-in-one/
- permissions:
- packages: write
- contents: read
-
- steps:
- - uses: actions/checkout@v4.1.1
-
- - name: Build image
- run: docker build $DOCKER_BUILD_DIR --file $DOCKERFILE_PATH --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
-
- - name: Log in to registry
- # This is where you will update the PAT to GITHUB_TOKEN
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
-
- - name: Push image
- run: |
- SHORTHASH=$(git rev-parse --short "$GITHUB_SHA")
- TODAYS_DATE="$(date +%F)"
- DOCKER_TAG="$TODAYS_DATE-$SHORTHASH"
- IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
- # Change all uppercase to lowercase
- IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
- # Strip git ref prefix from version
- VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
- # Strip "v" prefix from tag name
- [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
- # Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag
- [ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG
- echo IMAGE_ID=$IMAGE_ID
- echo VERSION=$VERSION
- docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
- docker push $IMAGE_ID:$VERSION
diff --git a/.taprc b/.taprc
index fad3ab8a63..a9ecd40dd9 100644
--- a/.taprc
+++ b/.taprc
@@ -56,11 +56,6 @@ files:
- ./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/deploy-contract/get-block.test.ts
- ./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/v21-besu-get-transaction.test.ts
- ./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/openapi/openapi-validation.test.ts
- - ./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts
- - ./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts
- - ./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts
- - ./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/iroha-test-ledger-parameters.test.ts
- - ./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/postgres-test-container-parameters.test.ts
- ./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/deploy-contract-from-json-xdai-json-object.test.ts
- ./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/invoke-contract-xdai-json-object.test.ts
- ./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/openapi/openapi-validation.test.ts
@@ -96,7 +91,6 @@ files:
- ./packages/cactus-test-tooling/src/test/typescript/integration/fabric/fabric-test-ledger-v1/constructor-validates-options.test.ts
- ./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-constructor.test.ts
- ./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-multiple-concurrent.test.ts
- - ./packages/cactus-test-tooling/src/test/typescript/integration/iroha/iroha-test-ledger/constructor-validates-options.test.ts
- ./packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts
- ./packages/cactus-test-tooling/src/test/typescript/integration/besu/besu-test-ledger/constructor-validates-options.test.ts
- ./packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/get-single-status-endpoint.test.ts
diff --git a/docs-cactus/source/support/iroha.md b/docs-cactus/source/support/iroha.md
deleted file mode 100644
index 90767397d1..0000000000
--- a/docs-cactus/source/support/iroha.md
+++ /dev/null
@@ -1,17 +0,0 @@
-Iroha Support
------------------
-
-```{note}
-The deployContract feature not yet implemented since Iroha lacks full smart contract support during the initial development stage of the Iroha connector plugin.
-```
-
-
- Hyperledger Cactus v0.9.0
-
- | Iroha version | runTransaction |
- | --- | :---: |
- | Iroha 1.2.0 and Postgres 9.5 | ✅ [test](https://github.com/hyperledger/cactus/blob/v0.9.0/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts) |
-
-
-
-
\ No newline at end of file
diff --git a/docs/docs/cactus/support/fabric.md b/docs/docs/cactus/support/fabric.md
index caa1e79f64..bf8d0db23a 100644
--- a/docs/docs/cactus/support/fabric.md
+++ b/docs/docs/cactus/support/fabric.md
@@ -161,8 +161,8 @@ Fabric 1.4.8
✅ [test](https://github.com/hyperledger/cactus/blob/v0.4.1/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts)
-
-[Previous](corda.md "Corda Support") [Next](iroha.md "Iroha Support")
+
+[Previous](corda.md "Corda Support") [Next](quorum.md "Quorum Support")
* * *
diff --git a/docs/docs/cactus/support/iroha.md b/docs/docs/cactus/support/iroha.md
deleted file mode 100644
index dec2132b10..0000000000
--- a/docs/docs/cactus/support/iroha.md
+++ /dev/null
@@ -1,22 +0,0 @@
-Iroha Support
-============================================================
-
-Note
-
-The deployContract feature not yet implemented since Iroha lacks full smart contract support during the initial development stage of the Iroha connector plugin.
-
-Hyperledger Cactus v0.9.0
-
-Iroha version
-
-runTransaction
-
-Iroha 1.2.0 and Postgres 9.5
-
-✅ [test](https://github.com/hyperledger/cactus/blob/v0.9.0/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts)
-
-
-
-[Previous](fabric.md "Fabric Support") [Next](quorum.md "Quorum Support")
-
-* * *
diff --git a/docs/docs/cactus/support/quorum.md b/docs/docs/cactus/support/quorum.md
index 6ad23472bb..341fb2e008 100644
--- a/docs/docs/cactus/support/quorum.md
+++ b/docs/docs/cactus/support/quorum.md
@@ -161,8 +161,8 @@ Quorum 2.3.0 and Tessera 0.10.0
✅ [test](https://github.com/hyperledger/cactus/blob/v0.4.1/packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/deploy-contract-from-json.test.ts)
-
-[Previous](iroha.md "Iroha Support") [Next](xdai.md "xDai Support")
+
+[Previous](fabric.md "Fabric Support") [Next](xdai.md "xDai Support")
* * *
diff --git a/jest.config.js b/jest.config.js
index 59a1dbfdd5..26da294755 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -65,11 +65,6 @@ module.exports = {
`./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/deploy-contract/get-block.test.ts`,
`./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/v21-besu-get-transaction.test.ts`,
`./packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/openapi/openapi-validation.test.ts`,
- `./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/iroha-iroha-transfer-example.test.ts`,
- `./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/run-transaction-endpoint-v1.test.ts`,
- `./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/openapi/openapi-validation.test.ts`,
- `./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/iroha-test-ledger-parameters.test.ts`,
- `./packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/unit/postgres-test-container-parameters.test.ts`,
`./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/deploy-contract-from-json-xdai-json-object.test.ts`,
`./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/invoke-contract-xdai-json-object.test.ts`,
`./packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/integration/openapi/openapi-validation.test.ts`,
@@ -105,7 +100,6 @@ module.exports = {
`./packages/cactus-test-tooling/src/test/typescript/integration/fabric/fabric-test-ledger-v1/constructor-validates-options.test.ts`,
`./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-constructor.test.ts`,
`./packages/cactus-test-tooling/src/test/typescript/integration/substrate/substrate-test-ledger-multiple-concurrent.test.ts`,
- `./packages/cactus-test-tooling/src/test/typescript/integration/iroha/iroha-test-ledger/constructor-validates-options.test.ts`,
`./packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts`,
`./packages/cactus-test-tooling/src/test/typescript/integration/besu/besu-test-ledger/constructor-validates-options.test.ts`,
`./packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/get-single-status-endpoint.test.ts`,
diff --git a/packages/cactus-plugin-ledger-connector-iroha/CHANGELOG.md b/packages/cactus-plugin-ledger-connector-iroha/CHANGELOG.md
deleted file mode 100644
index 73f375e05b..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/CHANGELOG.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file.
-See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
-
-# [2.0.0-alpha.2](https://github.com/hyperledger/cacti/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2023-09-27)
-
-### Bug Fixes
-
-* **security:** crash in HeaderParser in dicer ([77fb559](https://github.com/hyperledger/cacti/commit/77fb559532448aae45cfe704da2637119bf93c27))
-* use common conventions: tsconfig.json, package.json ([50f5c02](https://github.com/hyperledger/cacti/commit/50f5c02190ba28b77492c09e81f5d5ba6578e862)), closes [#2216](https://github.com/hyperledger/cacti/issues/2216)
-
-# [2.0.0-alpha.1](https://github.com/hyperledger/cacti/compare/v2.0.0-alpha-prerelease...v2.0.0-alpha.1) (2023-05-19)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-# [2.0.0-alpha-prerelease](https://github.com/hyperledger/cacti/compare/v1.2.0...v2.0.0-alpha-prerelease) (2023-05-11)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-# [1.2.0](https://github.com/hyperledger/cactus/compare/v1.1.3...v1.2.0) (2023-03-28)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-## [1.1.3](https://github.com/hyperledger/cactus/compare/v1.1.2...v1.1.3) (2022-12-08)
-
-### Bug Fixes
-
-* **connector-iroha:** fix review comments and smaller issues ([b2742e8](https://github.com/hyperledger/cactus/commit/b2742e8f6512f9804c6b4a943947b5bbe90785f0)), closes [PR#2048](https://github.com/PR/issues/2048)
-* **plugin-ledger-connector-iroha:** running dockerfile locally ([f5faaab](https://github.com/hyperledger/cactus/commit/f5faaab75cecf22f588f0cdcb502952652fee058)), closes [#1874](https://github.com/hyperledger/cactus/issues/1874)
-
-### Features
-
-* **connector-iroha:** update-iroha-js ([74929b1](https://github.com/hyperledger/cactus/commit/74929b17869731adb67930429780cb5d33346d4a))
-* monitoring, sync and async requests ([47da608](https://github.com/hyperledger/cactus/commit/47da608d378f5d48ca78b3d388b1c67da4c7aaf3)), closes [#1941](https://github.com/hyperledger/cactus/issues/1941)
-
-## [1.1.2](https://github.com/hyperledger/cactus/compare/v1.1.1...v1.1.2) (2022-11-11)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-## [1.1.1](https://github.com/hyperledger/cactus/compare/v1.1.0...v1.1.1) (2022-11-03)
-
-### Features
-
-* **connector-iroha:** add dynamic request params ([a1f908f](https://github.com/hyperledger/cactus/commit/a1f908f4c27b652a15896c9847aee97cc6ea11fd))
-
-# [1.1.0](https://github.com/hyperledger/cactus/compare/v1.0.0...v1.1.0) (2022-10-17)
-
-### Bug Fixes
-
-* remove skip to pass test case ([99cb9a7](https://github.com/hyperledger/cactus/commit/99cb9a7fb22f112f32de333756f32ac13e588a54)), closes [#1957](https://github.com/hyperledger/cactus/issues/1957)
-
-### Features
-
-* **connector-iroha:** sending transactions signed on the client-side ([da94cd6](https://github.com/hyperledger/cactus/commit/da94cd6b4fc5a364761716374ec7f6e7021bc76b))
-
-# [1.0.0](https://github.com/hyperledger/cactus/compare/v1.0.0-rc.3...v1.0.0) (2022-03-16)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-# [1.0.0-rc.3](https://github.com/hyperledger/cactus/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2021-12-07)
-
-### Bug Fixes
-
-* **cmd-api-server:** build occasionally broken - protoc-gen-ts [#1563](https://github.com/hyperledger/cactus/issues/1563) ([c2ecba5](https://github.com/hyperledger/cactus/commit/c2ecba54396d5e72b28d9ad538460d3bde2ca6d0))
-
-# [1.0.0-rc.2](https://github.com/hyperledger/cactus/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2021-11-01)
-
-**Note:** Version bump only for package @hyperledger/cactus-plugin-ledger-connector-iroha
-
-# [1.0.0-rc.1](https://github.com/hyperledger/cactus/compare/v0.10.0...v1.0.0-rc.1) (2021-10-11)
-
-### Bug Fixes
-
-* openapi validation test for iroha plugin ([6deed6d](https://github.com/hyperledger/cactus/commit/6deed6d3f070982061e33a11064ffb8d4e752f37)), closes [#1331](https://github.com/hyperledger/cactus/issues/1331) [#847](https://github.com/hyperledger/cactus/issues/847)
-* **webpack:** prod build chokes on upgraded ssh2 binaries [#1405](https://github.com/hyperledger/cactus/issues/1405) ([18979fb](https://github.com/hyperledger/cactus/commit/18979fb33880d8ca30e2fda01fb3d598deb839f9))
-
-# [0.10.0](https://github.com/hyperledger/cactus/compare/v0.9.0...v0.10.0) (2021-09-28)
-
-### Features
-
-* **core-api:** discontinue dedicated HTTP listeners for web service plugins ([3fbd2fc](https://github.com/hyperledger/cactus/commit/3fbd2fcb60d49090bf4e986bea74d4e988348659)), closes [#358](https://github.com/hyperledger/cactus/issues/358)
-* **core:** add installOpenapiValidationMiddleware ([1f6ea5f](https://github.com/hyperledger/cactus/commit/1f6ea5fe3aa1ba997a655098d632034f13f232a5)), closes [#847](https://github.com/hyperledger/cactus/issues/847)
-
-# [0.9.0](https://github.com/hyperledger/cactus/compare/v0.8.0...v0.9.0) (2021-08-31)
-
-### Features
-
-* **connector-iroha:** adds connector plugin ([4745df0](https://github.com/hyperledger/cactus/commit/4745df0bee6b9ab5fb9e57bb603ae95d6baeb391))
diff --git a/packages/cactus-plugin-ledger-connector-iroha/Dockerfile b/packages/cactus-plugin-ledger-connector-iroha/Dockerfile
deleted file mode 100644
index 09f5169a64..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/Dockerfile
+++ /dev/null
@@ -1,7 +0,0 @@
-FROM ghcr.io/hyperledger/cactus-cmd-api-server:2022-11-14-6ff6aac
-RUN npm install -g yarn@1.22.17
-
-ENV NODE_ENV=production
-ARG NPM_PKG_VERSION=latest
-
-RUN yarn add @hyperledger/cactus-plugin-ledger-connector-iroha@${NPM_PKG_VERSION} --production --ignore-engines
\ No newline at end of file
diff --git a/packages/cactus-plugin-ledger-connector-iroha/README.md b/packages/cactus-plugin-ledger-connector-iroha/README.md
deleted file mode 100644
index 21b42e9d98..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/README.md
+++ /dev/null
@@ -1,247 +0,0 @@
-# `@hyperledger/cactus-plugin-ledger-connector-iroha`
-
-This plugin provides `Cactus` a way to interact with Iroha networks. Using this we can perform:
-* Run various Iroha leger commands and queries.
-* Build and sign transactions using any arbitrary credential.
-## Summary
-
- - [Getting Started](#getting-started)
- - [Architecture](#architecture)
- - [Usage](#usage)
- - [Runing the tests](#running-the-tests)
- - [Built With](#built-with)
- - [Contributing](#contributing)
- - [License](#license)
- - [Acknowledgments](#acknowledgments)
-
-## Getting Started
-
-Clone the git repository on your local machine. Follow these instructions that will get you a copy of the project up and running on your local machine for development and testing purposes.
-
-### Prerequisites
-
-In the root of the project, execute the command to install the dependencies:
-```sh
-yarn run configure
-```
-
-### Compiling
-
-In the project root folder, run this command to compile the plugin and create the dist directory:
-```sh
-# For one off builds:
-yarn run build:dev:backend
-```
-
-```sh
-# For continuous watching of the source code with
-# automatic recompilation (more convenient)
-yarn run watch
-```
-
-### Architecture
-The sequence diagrams for various endpoints are mentioned below
-
-#### run-transaction-endpoint
-![run-transaction-endpoint sequence diagram](docs/architecture/images/run-transaction-endpoint.png)
-
-The above diagram shows the sequence diagram of run-transaction-endpoint. User A (One of the many Users) interacts with the API Client which in turn, calls the API server. The API server then executes `transact()` method which is explained in detailed in the subsequent diagrams.
-
-![run-transaction-endpoint transact() method](docs/architecture/images/run-transaction-endpoint-transact.png)
-
-The above diagram shows the sequence diagram of `transact()` method of the `PluginLedgerConnectorIroha` class. The caller to this function, which in reference to the above sequence diagram is API server, sends `RunTransactionRequestV1` object as an argument to the `transact()` method. Based on the exact command name of the request, corresponsing response `RunTransactionResponse` is sent back to the caller.
-
-### Usage
-
-To use this import public-api and create new **PluginFactoryLedgerConnector**. Then use it to create a connector.
-```typescript
- const factory = new PluginFactoryLedgerConnector({
- pluginImportType: PluginImportType.Local,
- });
-
- const connector: PluginLedgerConnectorIroha = await factory.create({
- rpcToriiPortHost,
- instanceId: uuidv4(),
- pluginRegistry: new PluginRegistry(),
- });
-```
-You can make calls through the connector to the plugin API:
-
-```typescript
-async transact(req: RunTransactionRequestV1):Promise;
-```
-
-Call example to run an Iroha execute account command:
-```typescript
- const req = {
- commandName: IrohaCommand.CreateAccount,
- baseConfig: {
- irohaHost: "localhost",
- irohaPort: 50051,
- creatorAccountId: "admin@test",
- privKey: ["f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70"],
- quorum: 1,
- timeoutLimit: 5000,
- },
- const res = await apiClient.runTransactionV1(req);
-```
-Call example to run an Iroha get account query:
-```typescript
- const req = {
- commandName: IrohaQuery.GetAccount,
- baseConfig: {
- irohaHost: "localhost",
- irohaPort: 50051,
- creatorAccountId: "admin@test",
- privKey: ["f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70"],
- quorum: 1,
- timeoutLimit: 5000,
- },
- params: ["admin@test"],
- };
- const res = await apiClient.runTransactionV1(req);
-```
-> Extensive documentation and examples in the [readthedocs](https://readthedocs.org/projects/hyperledger-cactus/) (WIP)
-
-
-### Building/running the container image locally
-
-In the Cactus project root say:
-
-```sh
-DOCKER_BUILDKIT=1 docker build -f ./packages/cactus-plugin-ledger-connector-iroha/Dockerfile . -t cplcb
-```
-
-Build with a specific version of the npm package:
-```sh
-DOCKER_BUILDKIT=1 docker build --build-arg NPM_PKG_VERSION=latest -f ./packages/cactus-plugin-ledger-connector-iroha/Dockerfile . -t cplcb
-```
-
-#### Running the container
-
-Launch container with plugin configuration as an **environment variable**:
-```sh
-docker run \
- --rm \
- --publish 3000:3000 \
- --publish 4000:4000 \
- --publish 5000:5000 \
- --env AUTHORIZATION_PROTOCOL='NONE' \
- --env AUTHORIZATION_CONFIG_JSON='{}' \
- --env GRPC_TLS_ENABLED=false \
- --env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-iroha", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcToriiPortHost": "http://localhost:8545", "instanceId": "some-unique-iroha-connector-instance-id"}}]' \
- cplcb
-```
-
-Launch container with plugin configuration as a **CLI argument**:
-```sh
-docker run \
- --rm \
- --publish 3000:3000 \
- --publish 4000:4000 \
- --publish 5000:5000 \
- --env AUTHORIZATION_PROTOCOL='NONE' \
- --env AUTHORIZATION_CONFIG_JSON='{}' \
- --env GRPC_TLS_ENABLED=false \
- cplcb \
- ./node_modules/.bin/cactusapi \
- --plugins='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-iroha", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcToriiPortHost": "http://localhost:8545", "instanceId": "some-unique-iroha-connector-instance-id"}}]'
-```
-
-Launch container with **configuration file** mounted from host machine:
-```sh
-
-echo '[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-iroha", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcToriiPortHost": "http://localhost:8545", "instanceId": "some-unique-iroha-connector-instance-id"}}]' > cactus.json
-
-docker run \
- --rm \
- --publish 3000:3000 \
- --publish 4000:4000 \
- --publish 5000:5000 \
- --env AUTHORIZATION_PROTOCOL='NONE' \
- --env AUTHORIZATION_CONFIG_JSON='{}' \
- --env GRPC_TLS_ENABLED=false \
- --mount type=bind,source="$(pwd)"/cactus.json,target=/cactus.json \
- cplcb \
- ./node_modules/.bin/cactusapi \
- --config-file=/cactus.json
-```
-
-#### Testing API calls with the container
-
-Don't have an Iroha network on hand to test with? Test or develop against our Iroha All-In-One dockerfile!
-
-**Terminal Window 1 (Ledger)**
-```sh
-docker run -p 0.0.0.0:8545:8545/tcp -p 0.0.0.0:8546:8546/tcp -p 0.0.0.0:8888:8888/tcp -p 0.0.0.0:9001:9001/tcp -p 0.0.0.0:9545:9545/tcp hyperledger/cactus-iroha-all-in-one:latest
-```
-
-**Terminal Window 2 (Cactus API Server)**
-```sh
-docker run \
- --network host \
- --rm \
- --publish 3000:3000 \
- --publish 4000:4000 \
- --publish 5000:5000 \
- --env AUTHORIZATION_PROTOCOL='NONE' \
- --env AUTHORIZATION_CONFIG_JSON='{}' \
- --env GRPC_TLS_ENABLED=false \
- --env PLUGINS='[{"packageName": "@hyperledger/cactus-plugin-ledger-connector-iroha", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcToriiPortHost": "http://localhost:8545", "instanceId": "some-unique-iroha-connector-instance-id"}}]' \
- cplcb
-```
-
-**Terminal Window 3 (curl - replace transaction request as needed)**
-```sh
-curl --location --request POST 'http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/run-transaction' \
---header 'Content-Type: application/json' \
---data-raw '{
- commandName: 'createAsset',
- baseConfig: {
- irohaHost: 'localhost',
- irohaPort: 50051,
- creatorAccountId: 'admin@test',
- privKey: [
- 'f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70'
- ],
- quorum: 1,
- timeoutLimit: 5000
- },
- params: [ 'coolcoin', 'test', 3]
-}'
-```
-
-The above should produce a response that looks similar to this:
-
-```json
-{
- "success": true,
- "data": {
- "transactionReceipt": {
- "txHash": "c3ffd772f26950243aa357ab4f21b9703d5172490b66ddc285355230d6df60b8",
- "status": "COMMITTED"
- }
- }
-}
-```
-
-## Running the tests
-
-To check that all has been installed correctly and that the plugin has no errors run the tests:
-
-* Run this command at the project's root:
-```sh
-yarn run test:plugin-ledger-connector-iroha
-```
-
-## Contributing
-
-We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do!
-
-Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started.
-
-## License
-
-This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file.
-
-## Acknowledgments
diff --git a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint-transact.png b/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint-transact.png
deleted file mode 100644
index 70dcf46186..0000000000
Binary files a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint-transact.png and /dev/null differ
diff --git a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint.png b/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint.png
deleted file mode 100644
index d25d7b0193..0000000000
Binary files a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/images/run-transaction-endpoint.png and /dev/null differ
diff --git a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint-transact.puml b/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint-transact.puml
deleted file mode 100644
index 6557546360..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint-transact.puml
+++ /dev/null
@@ -1,28 +0,0 @@
-@startuml
-title Hyperledger Cactus\nSequence Diagram\nRun Transaction Endpoint\ntransact() method
-
-skinparam sequenceArrowThickness 2
-skinparam roundcorner 20
-skinparam maxmessagesize 120
-skinparam sequenceParticipant underline
-
-actor "Caller" as caller
-participant "PluginLedgerConnectorIroha" as t << (C,#ADD1B2) class >>
-
-autoactivate on
-
-activate caller
-caller -> t: transact(RunTransactionRequest)
-
-alt #LightBlue commandName is an Iroha command
- t -> t: generate Iroha commandOptions
- return RunTransactionResponse
- t --> caller: return RunTransactionResponse
-else #LightGreen commandName is an Iroha query
- t -> t: generate Iroha queryOptions
- return RunTransactionResponse
- t --> caller: return RunTransactionResponse
-else #LightCoral default
- t --> caller: throw RuntimeError("command or query does not exist)
-end
-@enduml
\ No newline at end of file
diff --git a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint.puml b/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint.puml
deleted file mode 100644
index 91c3724d8e..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/docs/architecture/run-transaction-endpoint.puml
+++ /dev/null
@@ -1,29 +0,0 @@
-@startuml Sequence Diagram - Transaction
-
-title Hyperledger Cactus\nSequence Diagram\nRun Transaction Endpoint
-
-skinparam sequenceArrowThickness 2
-skinparam roundcorner 20
-skinparam maxmessagesize 120
-skinparam sequenceParticipant underline
-
-box "Users" #LightBlue
-actor "User A" as a
-end box
-
-box "Hyperledger Cactus" #LightGray
-entity "API Client" as apic
-entity "API Server" as apis
-end box
-
-box "Ledger Connector" #LightGreen
-database "Iroha" as irohacon
-end box
-
-a --> apic : Tx Iroha Ledger
-apic --> apis: Request
-apis --> irohacon: transact()
-irohacon --> apis: Response
-apis --> apic: Formatted Response
-apic --> a: RunTransactionResponse
-@enduml
diff --git a/packages/cactus-plugin-ledger-connector-iroha/openapitools.json b/packages/cactus-plugin-ledger-connector-iroha/openapitools.json
deleted file mode 100644
index 225ff1aaae..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/openapitools.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
- "spaces": 2,
- "generator-cli": {
- "version": "6.6.0"
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/package.json b/packages/cactus-plugin-ledger-connector-iroha/package.json
deleted file mode 100644
index fe573073f1..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/package.json
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "name": "@hyperledger/cactus-plugin-ledger-connector-iroha",
- "version": "2.0.0-alpha.2",
- "description": "Allows Cactus nodes to connect to an Iroha ledger.",
- "keywords": [
- "Hyperledger",
- "Cactus",
- "Iroha",
- "Integration",
- "Blockchain",
- "Distributed Ledger Technology"
- ],
- "homepage": "https://github.com/hyperledger/cacti#readme",
- "bugs": {
- "url": "https://github.com/hyperledger/cacti/issues"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/hyperledger/cacti.git"
- },
- "license": "Apache-2.0",
- "author": {
- "name": "Hyperledger Cactus Contributors",
- "email": "cactus@lists.hyperledger.org",
- "url": "https://www.hyperledger.org/use/cacti"
- },
- "contributors": [
- {
- "name": "Peter Somogyvari",
- "email": "peter.somogyvari@accenture.com",
- "url": "https://accenture.com"
- },
- {
- "name": "Han Xu",
- "email": "hanxu8@illinois.edu",
- "url": "https://github.com/hxlaf"
- }
- ],
- "main": "dist/lib/main/typescript/index.js",
- "module": "dist/lib/main/typescript/index.js",
- "browser": "dist/cactus-plugin-ledger-connector-iroha.web.umd.js",
- "types": "dist/types/main/typescript/index.d.ts",
- "files": [
- "dist/*"
- ],
- "scripts": {
- "codegen": "run-p 'codegen:*'",
- "codegen:openapi": "npm run generate-sdk",
- "generate-sdk": "run-p 'generate-sdk:*'",
- "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
- "watch": "npm-watch",
- "webpack": "npm-run-all webpack:dev",
- "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
- "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js",
- "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
- },
- "dependencies": {
- "@grpc/grpc-js": "1.10.3",
- "@hyperledger/cactus-common": "2.0.0-alpha.2",
- "@hyperledger/cactus-core": "2.0.0-alpha.2",
- "@hyperledger/cactus-core-api": "2.0.0-alpha.2",
- "@types/google-protobuf": "3.15.5",
- "axios": "1.6.0",
- "express": "4.19.2",
- "fast-safe-stringify": "2.1.1",
- "iroha-helpers": "1.5.0",
- "key-encoder": "2.0.3",
- "openapi-types": "12.1.3",
- "prom-client": "13.1.0",
- "run-time-error-cjs": "1.4.0",
- "rxjs": "7.8.1",
- "sanitize-html": "2.12.1",
- "socket.io-client-fixed-types": "4.5.4",
- "typescript-optional": "2.0.1"
- },
- "devDependencies": {
- "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2",
- "@hyperledger/cactus-test-tooling": "2.0.0-alpha.2",
- "@types/body-parser": "1.19.4",
- "@types/express": "4.17.19",
- "@types/sanitize-html": "2.9.5",
- "@types/uuid": "9.0.8",
- "body-parser": "1.20.2",
- "internal-ip": "6.2.0",
- "socket.io": "4.5.4",
- "uuid": "9.0.1"
- },
- "engines": {
- "node": ">=18",
- "npm": ">=8"
- },
- "publishConfig": {
- "access": "public"
- },
- "browserMinified": "dist/cactus-plugin-ledger-connector-iroha.web.umd.min.js",
- "mainMinified": "dist/cactus-plugin-ledger-connector-iroha.node.umd.min.js",
- "watch": {
- "codegen:openapi": {
- "patterns": [
- "./src/main/json/openapi.json"
- ]
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/json/openapi.json b/packages/cactus-plugin-ledger-connector-iroha/src/main/json/openapi.json
deleted file mode 100644
index d4184dd1af..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/json/openapi.json
+++ /dev/null
@@ -1,1111 +0,0 @@
-{
- "openapi": "3.0.3",
- "info": {
- "title": "Hyperledger Cactus Plugin - Connector Iroha",
- "description": "Can perform basic tasks on a Iroha ledger",
- "version": "v2.0.0-alpha.2",
- "license": {
- "name": "Apache-2.0",
- "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
- }
- },
- "components": {
- "schemas": {
- "IrohaCommand": {
- "type": "string",
- "enum": [
- "createAccount",
- "setAccountDetail",
- "setAccountQuorum",
- "compareAndSetAccountDetail",
- "createAsset",
- "addAssetQuantity",
- "subtractAssetQuantity",
- "transferAsset",
- "createDomain",
- "createRole",
- "detachRole",
- "appendRole",
- "addSignatory",
- "removeSignatory",
- "grantPermission",
- "revokePermission",
- "addPeer",
- "removePeer",
- "setSettingValue",
- "callEngine"
- ],
- "x-enum-descriptions": [
- "Make entity in the system, capable of sending transactions or queries, storing signatories, personal data and identifiers.",
- "Set key-value information for a given account.",
- "Set the number of signatories required to confirm the identity of a user, who creates the transaction.",
- "Set key-value information for a given account if the old value matches the value passed.",
- "Create a new type of asset, unique in a domain. An asset is a countable representation of a commodity.",
- "Increase the quantity of an asset on account of transaction creator.",
- "Decrease the number of assets on account of transaction creator.",
- "Share assets within the account in peer network: in the way that source account transfers assets to the target account.",
- "Make new domain in Iroha network, which is a group of accounts.",
- "Create a new role in the system from the set of permissions.",
- "Detach a role from the set of roles of an account.",
- "Promote an account to some created role in the system, where a role is a set of permissions account has to perform an action (command or query).",
- "Add an identifier to the account. Such identifier is a public key of another device or a public key of another user.",
- "Remove a public key, associated with an identity, from an account",
- "Give another account rights to perform actions on the account of transaction sender (give someone right to do something with my account).",
- "Revoke or dismiss given granted permission from another account in the network.",
- "Write into ledger the fact of peer addition into the peer network.",
- "Write into ledger the fact of peer removal from the network.",
- "This command is not available for use, it was added for backward compatibility with Iroha.",
- "This command is not availalbe for use because it is related to smart contract."
- ],
- "x-enum-varnames": [
- "CreateAccount",
- "SetAccountDetail",
- "SetAccountQuorum",
- "CompareAndSetAccountDetail",
- "CreateAsset",
- "AddAssetQuantity",
- "SubtractAssetQuantity",
- "TransferAsset",
- "CreateDomain",
- "CreateRole",
- "DetachRole",
- "AppendRole",
- "AddSignatory",
- "RemoveSignatory",
- "GrantPermission",
- "RevokePermission",
- "AddPeer",
- "RemovePeer",
- "SetSettingValue",
- "CallEngine"
- ]
- },
- "IrohaQuery": {
- "type": "string",
- "enum": [
- "getAccount",
- "getAccountDetail",
- "getAssetInfo",
- "getAccountAssets",
- "getTransactions",
- "getPendingTransactions",
- "getAccountTransactions",
- "getAccountAssetTransactions",
- "getRoles",
- "getSignatories",
- "getRolePermissions",
- "getBlock",
- "getEngineReceipts",
- "fetchCommits",
- "getPeers"
- ],
- "x-enum-descriptions": [
- "To get the state of an account",
- "To get details of the account.",
- "To get information on the given asset (as for now - its precision).",
- "To get the state of all assets in an account (a balance).",
- "To retrieve information about transactions, based on their hashes.",
- "To retrieve a list of pending (not fully signed) multisignature transactions or batches of transactions issued by account of query creator.",
- "To retrieve a list of transactions per account.",
- "To retrieve all transactions associated with given account and asset.",
- "To get existing roles in the system.",
- "To get signatories, which act as an identity of the account.",
- "To get available permissions per role in the system.",
- "To get a specific block, using its height as an identifier.",
- "To retrieve a receipt of a CallEngine command. Allows to access the event log created during computations inside the EVM.",
- "To get new blocks as soon as they are committed, a user can invoke FetchCommits RPC call to Iroha network.",
- "A query that returns a list of peers in Iroha network."
- ],
- "x-enum-varnames": [
- "GetAccount",
- "GetAccountDetail",
- "GetAssetInfo",
- "GetAccountAssets",
- "GetTransactions",
- "GetPendingTransactions",
- "GetAccountTransactions",
- "GetAccountAssetTransactions",
- "GetRoles",
- "GetSignatories",
- "GetRolePermissions",
- "GetBlock",
- "GetEngineReceipts",
- "FetchCommits",
- "GetPeers"
- ]
- },
- "KeyPair": {
- "type": "object",
- "required": ["publicKey", "privateKey"],
- "properties": {
- "publicKey": {
- "description": "SHA-3 ed25519 public keys of length 64 are recommended.",
- "example": "313a07e6384776ed95447710d15e59148473ccfc052a681317a72a69f2a49910",
- "type": "string",
- "nullable": false
- },
- "privateKey": {
- "description": "SHA-3 ed25519 private keys of length 64 are recommended.",
- "example": "f101537e319568c765b2cc89698325604991dca57b9716b58016b253506cab70",
- "type": "string",
- "nullable": false
- }
- }
- },
- "RunTransactionRequestV1Params": {
- "oneOf": [
- {
- "type": "array",
- "items": {}
- },
- {
- "$ref": "#/components/schemas/AddAssetQuantityRequestParameters"
- },
- {
- "$ref": "#/components/schemas/AddPeerRequestParameters"
- },
- {
- "$ref": "#/components/schemas/AddSignatoryRequestParameters"
- },
- {
- "$ref": "#/components/schemas/AppendRoleRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CallEngineRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CreateAccountRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CreateAssetRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CreateDomainRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CreateRoleRequestParameters"
- },
- {
- "$ref": "#/components/schemas/DetachRoleRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GrantPermissionRequestParameters"
- },
- {
- "$ref": "#/components/schemas/RemovePeerRequestParameters"
- },
- {
- "$ref": "#/components/schemas/RemoveSignatoryRequestParameters"
- },
- {
- "$ref": "#/components/schemas/RevokePermissionRequestParameters"
- },
- {
- "$ref": "#/components/schemas/SetAccountDetailRequestParameters"
- },
- {
- "$ref": "#/components/schemas/SetAccountQuorumRequestParameters"
- },
- {
- "$ref": "#/components/schemas/SubtractAssetQuantityRequestParameters"
- },
- {
- "$ref": "#/components/schemas/TransferAssetRequestParameters"
- },
- {
- "$ref": "#/components/schemas/CompareAndSetAccountDetailRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAccountRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetBlockRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetSignatoriesRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetTransactionsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetPendingTransactionsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAccountTransactionsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAccountAssetTransactionsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAccountAssetsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAccountDetailRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetAssetInfoRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetRolePermissionsRequestParameters"
- },
- {
- "$ref": "#/components/schemas/GetEngineReceiptsRequestParameters"
- }
- ]
- },
- "RunTransactionRequestV1Body": {
- "oneOf": [
- {
- "$ref": "#/components/schemas/RunTransactionRequestV1"
- },
- {
- "$ref": "#/components/schemas/RunTransactionSignedRequestV1"
- }
- ]
- },
- "RunTransactionRequestV1": {
- "type": "object",
- "required": ["commandName", "baseConfig", "params"],
- "additionalProperties": false,
- "properties": {
- "commandName": {
- "type": "string",
- "nullable": false
- },
- "baseConfig": {
- "$ref": "#/components/schemas/IrohaBaseConfig"
- },
- "params": {
- "$ref": "#/components/schemas/RunTransactionRequestV1Params"
- }
- }
- },
- "AddAssetQuantityRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Add Asset Quantity.",
- "type": "object",
- "required": ["assetId", "amount"],
- "properties": {
- "assetId": {
- "type": "string"
- },
- "amount": {
- "type": "number"
- }
- }
- },
- "AddPeerRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Add Peer.",
- "type": "object",
- "required": ["address", "peerKey"],
- "properties": {
- "address": {
- "type": "string"
- },
- "peerKey": {
- "type": "string"
- },
- "tlsCertificate": {
- "type": "string"
- },
- "syncingPeer": {
- "type": "boolean"
- }
- }
- },
- "AddSignatoryRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Add Signatory.",
- "type": "object",
- "required": ["accountId", "publicKey"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "publicKey": {
- "type": "string"
- }
- }
- },
- "AppendRoleRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Append Role.",
- "type": "object",
- "required": ["accountId", "roleName"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "roleName": {
- "type": "string"
- }
- }
- },
- "CallEngineRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Call Engine.",
- "type": "object",
- "required": ["caller", "callee", "input"],
- "properties": {
- "caller": {
- "type": "string"
- },
- "callee": {
- "type": "string"
- },
- "input": {
- "type": "string"
- }
- }
- },
- "CreateAccountRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Create Account.",
- "type": "object",
- "required": ["accountName", "domainId", "publicKey"],
- "properties": {
- "accountName": {
- "type": "string"
- },
- "domainId": {
- "type": "string"
- },
- "publicKey": {
- "type": "string"
- }
- }
- },
- "CreateAssetRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Create Asset.",
- "type": "object",
- "required": ["assetName", "domainId", "precision"],
- "properties": {
- "assetName": {
- "type": "string"
- },
- "domainId": {
- "type": "string"
- },
- "precision": {
- "type": "integer"
- }
- }
- },
- "CreateDomainRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Create Domain.",
- "type": "object",
- "required": ["domainId", "defaultRole"],
- "properties": {
- "domainId": {
- "type": "string"
- },
- "defaultRole": {
- "type": "string"
- }
- }
- },
- "CreateRoleRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Create Role.",
- "type": "object",
- "required": ["roleName", "permissionsList"],
- "properties": {
- "roleName": {
- "type": "string"
- },
- "permissionsList": {
- "type": "array",
- "items": {
- "type": "number"
- }
- }
- }
- },
- "DetachRoleRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Detach Role.",
- "type": "object",
- "required": ["accountId", "roleName"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "roleName": {
- "type": "string"
- }
- }
- },
- "GrantPermissionRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Grant Permission.",
- "type": "object",
- "required": ["accountId", "permission"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "permission": {
- "type": "string"
- }
- }
- },
- "RemovePeerRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Remove Peer.",
- "type": "object",
- "required": ["publicKey"],
- "properties": {
- "publicKey": {
- "type": "string"
- }
- }
- },
- "RemoveSignatoryRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Remove Signatory.",
- "type": "object",
- "required": ["accountId", "publicKey"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "publicKey": {
- "type": "string"
- }
- }
- },
- "RevokePermissionRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Revoke Permission.",
- "type": "object",
- "required": ["accountId", "permission"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "permission": {
- "type": "number"
- }
- }
- },
- "SetAccountDetailRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Set Account Detail.",
- "type": "object",
- "required": ["accountId", "key", "value"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "SetAccountQuorumRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Set Account Quorum.",
- "type": "object",
- "required": ["accountId", "quorum"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "quorum": {
- "type": "integer"
- }
- }
- },
- "SubtractAssetQuantityRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Subtract Asset Quantity.",
- "type": "object",
- "required": ["assetId", "amount"],
- "properties": {
- "assetId": {
- "type": "string"
- },
- "amount": {
- "type": "number"
- }
- }
- },
- "TransferAssetRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Transfer Asset.",
- "type": "object",
- "required": [
- "srcAccountId",
- "destAccountId",
- "assetId",
- "description",
- "amount"
- ],
- "properties": {
- "srcAccountId": {
- "type": "string"
- },
- "destAccountId": {
- "type": "string"
- },
- "assetId": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "amount": {
- "type": "number"
- }
- }
- },
- "CompareAndSetAccountDetailRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Compare And Set Account Detail.",
- "type": "object",
- "required": ["accountId", "key", "value", "check_empty"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "value": {
- "type": "string"
- },
- "oldValue": {
- "type": "string"
- },
- "check_empty": {
- "type": "boolean"
- }
- }
- },
- "GetAccountRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Account.",
- "type": "object",
- "required": ["accountId"],
- "properties": {
- "accountId": {
- "type": "string"
- }
- }
- },
- "GetBlockRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Block.",
- "type": "object",
- "required": ["height"],
- "properties": {
- "height": {
- "type": "integer"
- }
- }
- },
- "GetSignatoriesRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Signatories.",
- "type": "object",
- "required": ["accountId"],
- "properties": {
- "accountId": {
- "type": "string"
- }
- }
- },
- "GetTransactionsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Transactions.",
- "type": "object",
- "required": ["txHashesList"],
- "properties": {
- "txHashesList": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- },
- "GetPendingTransactionsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Pending Transactions.",
- "type": "object",
- "required": ["pageSize"],
- "properties": {
- "pageSize": {
- "type": "integer"
- },
- "firstTxHash": {
- "type": "string"
- },
- "firstTxTime": {
- "type": "object"
- },
- "lastTxTime": {
- "type": "object"
- }
- }
- },
- "GetAccountTransactionsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Account Transactions.",
- "type": "object",
- "required": ["accountId", "pageSize", "firstTxHash"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "pageSize": {
- "type": "integer"
- },
- "firstTxHash": {
- "type": "string"
- },
- "firstTxTime": {
- "type": "object"
- },
- "lastTxTime": {
- "type": "object"
- },
- "firstTxHeight": {
- "type": "integer"
- },
- "lastTxHeight": {
- "type": "integer"
- }
- }
- },
- "GetAccountAssetTransactionsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Account Asset Transactions.",
- "type": "object",
- "required": ["accountId", "assetId", "pageSize", "firstTxHash"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "assetId": {
- "type": "string"
- },
- "pageSize": {
- "type": "integer"
- },
- "firstTxHash": {
- "type": "string"
- }
- }
- },
- "GetAccountAssetsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Account Assets.",
- "type": "object",
- "required": ["accountId", "pageSize"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "pageSize": {
- "type": "number"
- },
- "firstAssetId": {
- "type": "string"
- }
- }
- },
- "GetAccountDetailRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Account Detail.",
- "type": "object",
- "required": ["pageSize", "paginationKey", "paginationWriter"],
- "properties": {
- "accountId": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "writer": {
- "type": "string"
- },
- "pageSize": {
- "type": "integer"
- },
- "paginationKey": {
- "type": "string"
- },
- "paginationWriter": {
- "type": "string"
- }
- }
- },
- "GetAssetInfoRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Asset Info.",
- "type": "object",
- "required": ["assetId"],
- "properties": {
- "assetId": {
- "type": "string"
- }
- }
- },
- "GetRolePermissionsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Role Permissions.",
- "type": "object",
- "required": ["roleId"],
- "properties": {
- "roleId": {
- "type": "string"
- }
- }
- },
- "GetEngineReceiptsRequestParameters": {
- "description": "The list of arguments to pass in to the transaction request to Get Engine Receipts.",
- "type": "object",
- "required": ["txHash"],
- "properties": {
- "txHash": {
- "type": "string"
- }
- }
- },
- "RunTransactionSignedRequestV1": {
- "type": "object",
- "required": ["signedTransaction"],
- "properties": {
- "signedTransaction": {
- "description": "Signed transaction binary data received from generate-transaction endpoint.",
- "type": "string"
- },
- "baseConfig": {
- "$ref": "#/components/schemas/IrohaBaseConfig"
- }
- }
- },
- "GenerateTransactionRequestV1": {
- "type": "object",
- "required": ["commandName", "commandParams", "creatorAccountId"],
- "additionalProperties": false,
- "properties": {
- "commandName": {
- "description": "Iroha command name.",
- "type": "IrohaCommand",
- "nullable": false
- },
- "commandParams": {
- "description": "Parameters for iroha command specified in commandName",
- "type": "object"
- },
- "creatorAccountId": {
- "description": "Sender account id",
- "type": "string",
- "nullable": false
- },
- "quorum": {
- "description": "Requested transaction quorum",
- "type": "number",
- "nullable": false,
- "default": 1
- }
- }
- },
- "IrohaBaseConfig": {
- "type": "object",
- "additionalProperties": true,
- "properties": {
- "irohaHost": {
- "type": "string",
- "nullable": false
- },
- "irohaPort": {
- "type": "number",
- "nullable": false
- },
- "creatorAccountId": {
- "type": "string",
- "nullable": false
- },
- "privKey": {
- "type": "array",
- "items": {},
- "default": [],
- "nullable": false
- },
- "quorum": {
- "type": "number",
- "nullable": false
- },
- "timeoutLimit": {
- "type": "number",
- "nullable": false
- },
- "tls": {
- "type": "boolean",
- "nullable": false,
- "description": "Can only be set to false for an insecure grpc connection."
- },
- "monitorMode": {
- "type": "boolean",
- "nullable": true,
- "description": "Flag used for monitoring. It changes default beahviour of transaction wrapper so it return error to caller instead of throwing RuntimeError straight away."
- }
- }
- },
- "RunTransactionResponse": {
- "type": "object",
- "required": ["transactionReceipt"],
- "properties": {
- "transactionReceipt": {}
- }
- },
- "PrometheusExporterMetricsResponse": {
- "type": "string",
- "nullable": false
- },
- "ErrorExceptionJsonResponseV1": {
- "type": "object",
- "required": ["message"],
- "properties": {
- "message": {
- "type": "string",
- "nullable": false
- },
- "name": {
- "type": "string",
- "nullable": false
- },
- "error": {
- "type": "string",
- "nullable": false
- },
- "stack": {
- "type": "string",
- "nullable": false
- },
- "cause": {
- "type": "string",
- "nullable": false
- }
- }
- },
- "ErrorExceptionResponseV1": {
- "type": "object",
- "required": ["message", "error"],
- "properties": {
- "message": {
- "type": "string",
- "nullable": false
- },
- "error": {
- "type": "string",
- "nullable": false
- }
- }
- },
- "WatchBlocksV1": {
- "type": "string",
- "enum": [
- "org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Subscribe",
- "org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Next",
- "org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Unsubscribe",
- "org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Error",
- "org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Complete"
- ],
- "x-enum-varnames": [
- "Subscribe",
- "Next",
- "Unsubscribe",
- "Error",
- "Complete",
- "SendAsyncRequest",
- "SendSyncRequest"
- ]
- },
- "IrohaSocketIOTransactV1": {
- "type": "string",
- "enum": [
- "org.hyperledger.cactus.api.async.iroha.IrohaSocketIOTransactV1.SendAsyncRequest",
- "org.hyperledger.cactus.api.async.iroha.IrohaSocketIOTransactV1.SendSyncRequest"
- ],
- "x-enum-varnames": ["SendAsyncRequest", "SendSyncRequest"]
- },
- "IrohaBlockResponse": {
- "type": "object",
- "required": ["payload", "signaturesList"],
- "properties": {
- "payload": {
- "type": "object",
- "required": [
- "txNumber",
- "transactionsList",
- "height",
- "prevBlockHash",
- "createdTime",
- "rejectedTransactionsHashesList"
- ],
- "properties": {
- "transactionsList": {
- "type": "array",
- "items": {}
- },
- "txNumber": {
- "type": "number"
- },
- "height": {
- "type": "number"
- },
- "prevBlockHash": {
- "type": "string"
- },
- "createdTime": {
- "type": "number"
- },
- "rejectedTransactionsHashesList": {
- "type": "array",
- "items": {}
- }
- }
- },
- "signaturesList": {
- "type": "array",
- "items": {}
- }
- }
- },
- "IrohaBlockProgress": {
- "type": "object",
- "required": ["transactionReceipt"],
- "properties": {
- "transactionReceipt": {
- "$ref": "#/components/schemas/IrohaBlockResponse"
- }
- }
- }
- }
- },
- "paths": {
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/run-transaction": {
- "post": {
- "x-hyperledger-cacti": {
- "http": {
- "verbLowerCase": "post",
- "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/run-transaction"
- }
- },
- "operationId": "runTransactionV1",
- "summary": "Executes a transaction on a Iroha ledger",
- "parameters": [],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RunTransactionRequestV1Body"
- }
- }
- }
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RunTransactionResponse"
- }
- }
- }
- },
- "400": {
- "description": "Bad Request error.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorExceptionJsonResponseV1"
- }
- }
- }
- },
- "405": {
- "description": "Method Not Allowed error.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorExceptionJsonResponseV1"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorExceptionJsonResponseV1"
- }
- }
- }
- }
- }
- }
- },
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/generate-transaction": {
- "post": {
- "x-hyperledger-cacti": {
- "http": {
- "verbLowerCase": "post",
- "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/generate-transaction"
- }
- },
- "operationId": "generateTransactionV1",
- "summary": "Generate transaction that can be signed locally.",
- "parameters": [],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/GenerateTransactionRequestV1"
- }
- }
- }
- },
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "application/octet-stream": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
- "400": {
- "description": "Bad Request Error",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorExceptionResponseV1"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ErrorExceptionResponseV1"
- }
- }
- }
- }
- }
- }
- },
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/get-prometheus-exporter-metrics": {
- "get": {
- "x-hyperledger-cacti": {
- "http": {
- "verbLowerCase": "get",
- "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/get-prometheus-exporter-metrics"
- }
- },
- "operationId": "getPrometheusMetricsV1",
- "summary": "Get the Prometheus Metrics",
- "parameters": [],
- "responses": {
- "200": {
- "description": "OK",
- "content": {
- "text/plain": {
- "schema": {
- "$ref": "#/components/schemas/PrometheusExporterMetricsResponse"
- }
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts
deleted file mode 100644
index 528fb2a668..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/api-client/iroha-api-client.ts
+++ /dev/null
@@ -1,283 +0,0 @@
-import { Observable, ReplaySubject, share } from "rxjs";
-import { finalize } from "rxjs/operators";
-import { Socket, io } from "socket.io-client-fixed-types";
-import { Logger, Checks } from "@hyperledger/cactus-common";
-import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common";
-import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api";
-import {
- DefaultApi,
- WatchBlocksV1,
- IrohaSocketIOTransactV1,
- IrohaBlockProgress,
- IrohaBaseConfig,
-} from "../generated/openapi/typescript-axios";
-import {
- Configuration,
- ConfigurationParameters,
-} from "../generated/openapi/typescript-axios/configuration";
-import { RuntimeError } from "run-time-error-cjs";
-
-export interface IrohaApiClientParameters extends ConfigurationParameters {
- logLevel?: LogLevelDesc;
- wsApiHost?: string;
- wsApiPath?: string;
- timeoutLimit?: number;
-}
-
-export class IrohaApiClientOptions extends Configuration {
- readonly logLevel?: LogLevelDesc;
- readonly wsApiHost?: string;
- readonly wsApiPath?: string;
- readonly timeoutLimit?: number;
-
- constructor(param: IrohaApiClientParameters = {}) {
- super(param);
- this.logLevel = param.logLevel;
- this.wsApiHost = param.wsApiHost;
- this.wsApiPath = param.wsApiPath;
- this.timeoutLimit = param.timeoutLimit;
- }
-}
-
-export class IrohaApiClient
- extends DefaultApi
- implements ISocketApiClient
-{
- public static readonly CLASS_NAME = "IrohaApiClient";
- private readonly log: Logger;
- private readonly wsApiHost: string;
- private readonly wsApiPath: string;
- public get className(): string {
- return IrohaApiClient.CLASS_NAME;
- }
-
- constructor(public readonly options: IrohaApiClientOptions) {
- super(options);
- const fnTag = `${this.className}#constructor()`;
- Checks.truthy(options, `${fnTag} arg options`);
-
- const level = this.options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
-
- this.wsApiHost = options.wsApiHost || options.basePath || location.host;
- this.wsApiPath = options.wsApiPath || Constants.SocketIoConnectionPathV1;
- this.log.debug(`Created ${this.className} OK.`);
- this.log.debug(`wsApiHost=${this.wsApiHost}`);
- this.log.debug(`wsApiPath=${this.wsApiPath}`);
- this.log.debug(`basePath=${this.options.basePath}`);
- this.log.debug(`timeoutLimit=${this.options.timeoutLimit}`);
-
- Checks.nonBlankString(
- this.wsApiHost,
- `${this.className}::constructor() wsApiHost`,
- );
- Checks.nonBlankString(
- this.wsApiPath,
- `${this.className}::constructor() wsApiPath`,
- );
- }
-
- /**
- * Start monitoring for new blocks on the Iroha ledger.
- * @param monitorOptions - Options to be passed to validator `startMonitoring` procedure.
- * @returns RxJs Observable, `next` - new block, `error` - any error from the validator.
- */
- public watchBlocksV1(
- monitorOptions?: Record,
- ): Observable {
- const socket: Socket = io(this.wsApiHost, { path: this.wsApiPath });
- const subject = new ReplaySubject(0);
- this.log.debug(monitorOptions);
- socket.on(WatchBlocksV1.Next, (data: IrohaBlockProgress) => {
- subject.next(data);
- });
-
- socket.on("connect", () => {
- this.log.debug("connected OK...");
- socket.emit(WatchBlocksV1.Subscribe, monitorOptions);
- });
-
- socket.connect();
-
- socket.on("connect_error", (err: Error) => {
- this.log.error("Error (connect_error): ", err);
- socket.disconnect();
- subject.error(err);
- });
-
- socket.on("connect_timeout", (err: Record) => {
- this.log.error("Error (connect_timeout): ", err);
- socket.disconnect();
- subject.error(err);
- });
-
- socket.on("error", (err: unknown) => {
- this.log.error("Error: ", err);
- socket.disconnect();
- subject.error(err);
- });
-
- return subject.pipe(
- finalize(() => {
- this.log.info("FINALIZE - unsubscribing from the stream...");
- socket.emit(WatchBlocksV1.Unsubscribe);
- socket.disconnect();
- }),
- share(),
- );
- }
-
- /**
- * Immediately sends request to the validator, doesn't report any error or responses.
- * @param args - arguments.
- * @param method - function / method to be executed by validator.
- * @param baseConfig - baseConfig needed to properly connect to ledger
-
- */
- public sendAsyncRequest(
- method: Record,
- args: any,
- baseConfig?: IrohaBaseConfig,
- ): void {
- this.log.debug(`inside: sendAsyncRequest()`);
- this.log.debug(`baseConfig=${baseConfig}`);
- this.log.debug(`methodName=${method.methodName}`);
- this.log.debug(`args=${args}`);
-
- if (!baseConfig) {
- throw new RuntimeError("baseConfig object must exist and not be empty");
- }
-
- Checks.truthy(baseConfig.privKey, "privKey in baseConfig");
- Checks.truthy(
- baseConfig.creatorAccountId,
- "creatorAccountId in baseConfig",
- );
- Checks.truthy(baseConfig.irohaHost, "irohaHost in baseConfig");
- Checks.truthy(baseConfig.irohaPort, "irohaPort in baseConfig");
- Checks.truthy(baseConfig.quorum, "quorum in baseConfig");
- Checks.nonBlankString(method.methodName, "methodName");
-
- const socket: Socket = io(this.wsApiHost, { path: this.wsApiPath });
- const asyncRequestData = {
- baseConfig: baseConfig,
- methodName: method.methodName,
- args: args,
- };
-
- this.log.debug("requestData:", asyncRequestData);
-
- try {
- socket.emit(IrohaSocketIOTransactV1.SendAsyncRequest, asyncRequestData);
-
- // Connector should disconnect us after receiving this request.
- // If he doesn't, disconnect after specified amount of time.
- setTimeout(
- () => {
- if (socket.connected) {
- socket.disconnect();
- }
- },
- this.options.timeoutLimit ?? 10 * 1000,
- );
- } catch (err) {
- this.log.error("Exception in: sendAsyncRequest(): ", err);
- throw err;
- }
- }
-
- /**
- * Sends request to be executed on the ledger, watches and reports any error and the response from a ledger.
- * @param args - arguments.
- * @param method - function / method to be executed by validator.
- * @param baseConfig - baseConfig needed to properly connect to ledger
- * @returns Promise that will resolve with response from the ledger, or reject when error occurred.
- */
- public sendSyncRequest(
- method: Record,
- args: any,
- baseConfig?: IrohaBaseConfig,
- ): Promise {
- this.log.debug(`inside: sendSyncRequest()`);
- this.log.debug(`baseConfig=${baseConfig}`);
- this.log.debug(`method=${method}`);
- this.log.debug(`args=${args}`);
-
- if (!baseConfig) {
- throw new RuntimeError("baseConfig object must exist and not be empty");
- }
-
- Checks.truthy(baseConfig.privKey, "privKey in baseConfig");
- Checks.truthy(
- baseConfig.creatorAccountId,
- "creatorAccountId in baseConfig",
- );
- Checks.truthy(baseConfig.irohaHost, "irohaHost in baseConfig");
- Checks.truthy(baseConfig.irohaPort, "irohaPort in baseConfig");
- Checks.truthy(baseConfig.quorum, "quorum in baseConfig");
- Checks.nonBlankString(method.methodName, "methodName");
-
- const socket: Socket = io(this.wsApiHost, { path: this.wsApiPath });
-
- let responseFlag = false;
-
- return new Promise((resolve, reject) => {
- try {
- socket.on("connect_error", (err: Error) => {
- this.log.error("Error (connect_error): ", err);
- socket.disconnect();
- reject(err);
- });
-
- socket.on("connect_timeout", (err: Record) => {
- this.log.error("Error (connect_timeout): ", err);
- socket.disconnect();
- reject(err);
- });
-
- socket.on("error", (err: unknown) => {
- socket.disconnect();
- reject(err);
- });
-
- socket.on("response", (result: any) => {
- responseFlag = true;
- this.log.debug("#[recv]response, res:", result);
- const resultObj = {
- status: result.status,
- data: result.txHash,
- };
- this.log.debug("resultObj =", resultObj);
- socket.disconnect();
- resolve(resultObj);
- });
-
- const syncRequestData = {
- baseConfig: baseConfig,
- methodName: method.methodName,
- args: args,
- };
-
- this.log.debug("requestData:", syncRequestData);
-
- try {
- socket.emit(IrohaSocketIOTransactV1.SendSyncRequest, syncRequestData);
- } catch (err) {
- this.log.error("Exception in: sendAsyncRequest(): ", err);
- throw err;
- }
-
- setTimeout(() => {
- if (responseFlag === false) {
- socket.disconnect();
- resolve({ status: 504 });
- }
- }, this.options.timeoutLimit);
- } catch (err) {
- this.log.error("Exception in: sendSyncRequest(): ", err);
- reject(err);
- }
- });
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES
deleted file mode 100644
index 53250c0269..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES
+++ /dev/null
@@ -1,5 +0,0 @@
-api.ts
-base.ts
-common.ts
-configuration.ts
-index.ts
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION
deleted file mode 100644
index cd802a1ec4..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-6.6.0
\ No newline at end of file
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/api.ts
deleted file mode 100644
index 922e111083..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/api.ts
+++ /dev/null
@@ -1,1457 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Hyperledger Cactus Plugin - Connector Iroha
- * Can perform basic tasks on a Iroha ledger
- *
- * The version of the OpenAPI document: v2.0.0-alpha.2
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import type { Configuration } from './configuration';
-import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
-import globalAxios from 'axios';
-// Some imports not used depending on template conditions
-// @ts-ignore
-import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
-import type { RequestArgs } from './base';
-// @ts-ignore
-import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base';
-
-/**
- * The list of arguments to pass in to the transaction request to Add Asset Quantity.
- * @export
- * @interface AddAssetQuantityRequestParameters
- */
-export interface AddAssetQuantityRequestParameters {
- /**
- *
- * @type {string}
- * @memberof AddAssetQuantityRequestParameters
- */
- 'assetId': string;
- /**
- *
- * @type {number}
- * @memberof AddAssetQuantityRequestParameters
- */
- 'amount': number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Add Peer.
- * @export
- * @interface AddPeerRequestParameters
- */
-export interface AddPeerRequestParameters {
- /**
- *
- * @type {string}
- * @memberof AddPeerRequestParameters
- */
- 'address': string;
- /**
- *
- * @type {string}
- * @memberof AddPeerRequestParameters
- */
- 'peerKey': string;
- /**
- *
- * @type {string}
- * @memberof AddPeerRequestParameters
- */
- 'tlsCertificate'?: string;
- /**
- *
- * @type {boolean}
- * @memberof AddPeerRequestParameters
- */
- 'syncingPeer'?: boolean;
-}
-/**
- * The list of arguments to pass in to the transaction request to Add Signatory.
- * @export
- * @interface AddSignatoryRequestParameters
- */
-export interface AddSignatoryRequestParameters {
- /**
- *
- * @type {string}
- * @memberof AddSignatoryRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof AddSignatoryRequestParameters
- */
- 'publicKey': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Append Role.
- * @export
- * @interface AppendRoleRequestParameters
- */
-export interface AppendRoleRequestParameters {
- /**
- *
- * @type {string}
- * @memberof AppendRoleRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof AppendRoleRequestParameters
- */
- 'roleName': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Call Engine.
- * @export
- * @interface CallEngineRequestParameters
- */
-export interface CallEngineRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CallEngineRequestParameters
- */
- 'caller': string;
- /**
- *
- * @type {string}
- * @memberof CallEngineRequestParameters
- */
- 'callee': string;
- /**
- *
- * @type {string}
- * @memberof CallEngineRequestParameters
- */
- 'input': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Compare And Set Account Detail.
- * @export
- * @interface CompareAndSetAccountDetailRequestParameters
- */
-export interface CompareAndSetAccountDetailRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CompareAndSetAccountDetailRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof CompareAndSetAccountDetailRequestParameters
- */
- 'key': string;
- /**
- *
- * @type {string}
- * @memberof CompareAndSetAccountDetailRequestParameters
- */
- 'value': string;
- /**
- *
- * @type {string}
- * @memberof CompareAndSetAccountDetailRequestParameters
- */
- 'oldValue'?: string;
- /**
- *
- * @type {boolean}
- * @memberof CompareAndSetAccountDetailRequestParameters
- */
- 'check_empty': boolean;
-}
-/**
- * The list of arguments to pass in to the transaction request to Create Account.
- * @export
- * @interface CreateAccountRequestParameters
- */
-export interface CreateAccountRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CreateAccountRequestParameters
- */
- 'accountName': string;
- /**
- *
- * @type {string}
- * @memberof CreateAccountRequestParameters
- */
- 'domainId': string;
- /**
- *
- * @type {string}
- * @memberof CreateAccountRequestParameters
- */
- 'publicKey': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Create Asset.
- * @export
- * @interface CreateAssetRequestParameters
- */
-export interface CreateAssetRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CreateAssetRequestParameters
- */
- 'assetName': string;
- /**
- *
- * @type {string}
- * @memberof CreateAssetRequestParameters
- */
- 'domainId': string;
- /**
- *
- * @type {number}
- * @memberof CreateAssetRequestParameters
- */
- 'precision': number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Create Domain.
- * @export
- * @interface CreateDomainRequestParameters
- */
-export interface CreateDomainRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CreateDomainRequestParameters
- */
- 'domainId': string;
- /**
- *
- * @type {string}
- * @memberof CreateDomainRequestParameters
- */
- 'defaultRole': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Create Role.
- * @export
- * @interface CreateRoleRequestParameters
- */
-export interface CreateRoleRequestParameters {
- /**
- *
- * @type {string}
- * @memberof CreateRoleRequestParameters
- */
- 'roleName': string;
- /**
- *
- * @type {Array}
- * @memberof CreateRoleRequestParameters
- */
- 'permissionsList': Array;
-}
-/**
- * The list of arguments to pass in to the transaction request to Detach Role.
- * @export
- * @interface DetachRoleRequestParameters
- */
-export interface DetachRoleRequestParameters {
- /**
- *
- * @type {string}
- * @memberof DetachRoleRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof DetachRoleRequestParameters
- */
- 'roleName': string;
-}
-/**
- *
- * @export
- * @interface ErrorExceptionJsonResponseV1
- */
-export interface ErrorExceptionJsonResponseV1 {
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionJsonResponseV1
- */
- 'message': string;
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionJsonResponseV1
- */
- 'name'?: string;
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionJsonResponseV1
- */
- 'error'?: string;
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionJsonResponseV1
- */
- 'stack'?: string;
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionJsonResponseV1
- */
- 'cause'?: string;
-}
-/**
- *
- * @export
- * @interface ErrorExceptionResponseV1
- */
-export interface ErrorExceptionResponseV1 {
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionResponseV1
- */
- 'message': string;
- /**
- *
- * @type {string}
- * @memberof ErrorExceptionResponseV1
- */
- 'error': string;
-}
-/**
- *
- * @export
- * @interface GenerateTransactionRequestV1
- */
-export interface GenerateTransactionRequestV1 {
- /**
- * Iroha command name.
- * @type {IrohaCommand}
- * @memberof GenerateTransactionRequestV1
- */
- 'commandName': IrohaCommand;
- /**
- * Parameters for iroha command specified in commandName
- * @type {object}
- * @memberof GenerateTransactionRequestV1
- */
- 'commandParams': object;
- /**
- * Sender account id
- * @type {string}
- * @memberof GenerateTransactionRequestV1
- */
- 'creatorAccountId': string;
- /**
- * Requested transaction quorum
- * @type {number}
- * @memberof GenerateTransactionRequestV1
- */
- 'quorum'?: number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Account Asset Transactions.
- * @export
- * @interface GetAccountAssetTransactionsRequestParameters
- */
-export interface GetAccountAssetTransactionsRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAccountAssetTransactionsRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof GetAccountAssetTransactionsRequestParameters
- */
- 'assetId': string;
- /**
- *
- * @type {number}
- * @memberof GetAccountAssetTransactionsRequestParameters
- */
- 'pageSize': number;
- /**
- *
- * @type {string}
- * @memberof GetAccountAssetTransactionsRequestParameters
- */
- 'firstTxHash': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Account Assets.
- * @export
- * @interface GetAccountAssetsRequestParameters
- */
-export interface GetAccountAssetsRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAccountAssetsRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {number}
- * @memberof GetAccountAssetsRequestParameters
- */
- 'pageSize': number;
- /**
- *
- * @type {string}
- * @memberof GetAccountAssetsRequestParameters
- */
- 'firstAssetId'?: string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Account Detail.
- * @export
- * @interface GetAccountDetailRequestParameters
- */
-export interface GetAccountDetailRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAccountDetailRequestParameters
- */
- 'accountId'?: string;
- /**
- *
- * @type {string}
- * @memberof GetAccountDetailRequestParameters
- */
- 'key'?: string;
- /**
- *
- * @type {string}
- * @memberof GetAccountDetailRequestParameters
- */
- 'writer'?: string;
- /**
- *
- * @type {number}
- * @memberof GetAccountDetailRequestParameters
- */
- 'pageSize': number;
- /**
- *
- * @type {string}
- * @memberof GetAccountDetailRequestParameters
- */
- 'paginationKey': string;
- /**
- *
- * @type {string}
- * @memberof GetAccountDetailRequestParameters
- */
- 'paginationWriter': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Account.
- * @export
- * @interface GetAccountRequestParameters
- */
-export interface GetAccountRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAccountRequestParameters
- */
- 'accountId': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Account Transactions.
- * @export
- * @interface GetAccountTransactionsRequestParameters
- */
-export interface GetAccountTransactionsRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {number}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'pageSize': number;
- /**
- *
- * @type {string}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'firstTxHash': string;
- /**
- *
- * @type {object}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'firstTxTime'?: object;
- /**
- *
- * @type {object}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'lastTxTime'?: object;
- /**
- *
- * @type {number}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'firstTxHeight'?: number;
- /**
- *
- * @type {number}
- * @memberof GetAccountTransactionsRequestParameters
- */
- 'lastTxHeight'?: number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Asset Info.
- * @export
- * @interface GetAssetInfoRequestParameters
- */
-export interface GetAssetInfoRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetAssetInfoRequestParameters
- */
- 'assetId': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Block.
- * @export
- * @interface GetBlockRequestParameters
- */
-export interface GetBlockRequestParameters {
- /**
- *
- * @type {number}
- * @memberof GetBlockRequestParameters
- */
- 'height': number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Engine Receipts.
- * @export
- * @interface GetEngineReceiptsRequestParameters
- */
-export interface GetEngineReceiptsRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetEngineReceiptsRequestParameters
- */
- 'txHash': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Pending Transactions.
- * @export
- * @interface GetPendingTransactionsRequestParameters
- */
-export interface GetPendingTransactionsRequestParameters {
- /**
- *
- * @type {number}
- * @memberof GetPendingTransactionsRequestParameters
- */
- 'pageSize': number;
- /**
- *
- * @type {string}
- * @memberof GetPendingTransactionsRequestParameters
- */
- 'firstTxHash'?: string;
- /**
- *
- * @type {object}
- * @memberof GetPendingTransactionsRequestParameters
- */
- 'firstTxTime'?: object;
- /**
- *
- * @type {object}
- * @memberof GetPendingTransactionsRequestParameters
- */
- 'lastTxTime'?: object;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Role Permissions.
- * @export
- * @interface GetRolePermissionsRequestParameters
- */
-export interface GetRolePermissionsRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetRolePermissionsRequestParameters
- */
- 'roleId': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Signatories.
- * @export
- * @interface GetSignatoriesRequestParameters
- */
-export interface GetSignatoriesRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GetSignatoriesRequestParameters
- */
- 'accountId': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Get Transactions.
- * @export
- * @interface GetTransactionsRequestParameters
- */
-export interface GetTransactionsRequestParameters {
- /**
- *
- * @type {Array}
- * @memberof GetTransactionsRequestParameters
- */
- 'txHashesList': Array;
-}
-/**
- * The list of arguments to pass in to the transaction request to Grant Permission.
- * @export
- * @interface GrantPermissionRequestParameters
- */
-export interface GrantPermissionRequestParameters {
- /**
- *
- * @type {string}
- * @memberof GrantPermissionRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof GrantPermissionRequestParameters
- */
- 'permission': string;
-}
-/**
- *
- * @export
- * @interface IrohaBaseConfig
- */
-export interface IrohaBaseConfig {
- [key: string]: any;
-
- /**
- *
- * @type {string}
- * @memberof IrohaBaseConfig
- */
- 'irohaHost'?: string;
- /**
- *
- * @type {number}
- * @memberof IrohaBaseConfig
- */
- 'irohaPort'?: number;
- /**
- *
- * @type {string}
- * @memberof IrohaBaseConfig
- */
- 'creatorAccountId'?: string;
- /**
- *
- * @type {Array}
- * @memberof IrohaBaseConfig
- */
- 'privKey'?: Array;
- /**
- *
- * @type {number}
- * @memberof IrohaBaseConfig
- */
- 'quorum'?: number;
- /**
- *
- * @type {number}
- * @memberof IrohaBaseConfig
- */
- 'timeoutLimit'?: number;
- /**
- * Can only be set to false for an insecure grpc connection.
- * @type {boolean}
- * @memberof IrohaBaseConfig
- */
- 'tls'?: boolean;
- /**
- * Flag used for monitoring. It changes default beahviour of transaction wrapper so it return error to caller instead of throwing RuntimeError straight away.
- * @type {boolean}
- * @memberof IrohaBaseConfig
- */
- 'monitorMode'?: boolean | null;
-}
-/**
- *
- * @export
- * @interface IrohaBlockProgress
- */
-export interface IrohaBlockProgress {
- /**
- *
- * @type {IrohaBlockResponse}
- * @memberof IrohaBlockProgress
- */
- 'transactionReceipt': IrohaBlockResponse;
-}
-/**
- *
- * @export
- * @interface IrohaBlockResponse
- */
-export interface IrohaBlockResponse {
- /**
- *
- * @type {IrohaBlockResponsePayload}
- * @memberof IrohaBlockResponse
- */
- 'payload': IrohaBlockResponsePayload;
- /**
- *
- * @type {Array}
- * @memberof IrohaBlockResponse
- */
- 'signaturesList': Array;
-}
-/**
- *
- * @export
- * @interface IrohaBlockResponsePayload
- */
-export interface IrohaBlockResponsePayload {
- /**
- *
- * @type {Array}
- * @memberof IrohaBlockResponsePayload
- */
- 'transactionsList': Array;
- /**
- *
- * @type {number}
- * @memberof IrohaBlockResponsePayload
- */
- 'txNumber': number;
- /**
- *
- * @type {number}
- * @memberof IrohaBlockResponsePayload
- */
- 'height': number;
- /**
- *
- * @type {string}
- * @memberof IrohaBlockResponsePayload
- */
- 'prevBlockHash': string;
- /**
- *
- * @type {number}
- * @memberof IrohaBlockResponsePayload
- */
- 'createdTime': number;
- /**
- *
- * @type {Array}
- * @memberof IrohaBlockResponsePayload
- */
- 'rejectedTransactionsHashesList': Array;
-}
-/**
- *
- * @export
- * @enum {string}
- */
-
-export const IrohaCommand = {
- /**
- * Make entity in the system, capable of sending transactions or queries, storing signatories, personal data and identifiers.
- */
- CreateAccount: 'createAccount',
- /**
- * Set key-value information for a given account.
- */
- SetAccountDetail: 'setAccountDetail',
- /**
- * Set the number of signatories required to confirm the identity of a user, who creates the transaction.
- */
- SetAccountQuorum: 'setAccountQuorum',
- /**
- * Set key-value information for a given account if the old value matches the value passed.
- */
- CompareAndSetAccountDetail: 'compareAndSetAccountDetail',
- /**
- * Create a new type of asset, unique in a domain. An asset is a countable representation of a commodity.
- */
- CreateAsset: 'createAsset',
- /**
- * Increase the quantity of an asset on account of transaction creator.
- */
- AddAssetQuantity: 'addAssetQuantity',
- /**
- * Decrease the number of assets on account of transaction creator.
- */
- SubtractAssetQuantity: 'subtractAssetQuantity',
- /**
- * Share assets within the account in peer network: in the way that source account transfers assets to the target account.
- */
- TransferAsset: 'transferAsset',
- /**
- * Make new domain in Iroha network, which is a group of accounts.
- */
- CreateDomain: 'createDomain',
- /**
- * Create a new role in the system from the set of permissions.
- */
- CreateRole: 'createRole',
- /**
- * Detach a role from the set of roles of an account.
- */
- DetachRole: 'detachRole',
- /**
- * Promote an account to some created role in the system, where a role is a set of permissions account has to perform an action (command or query).
- */
- AppendRole: 'appendRole',
- /**
- * Add an identifier to the account. Such identifier is a public key of another device or a public key of another user.
- */
- AddSignatory: 'addSignatory',
- /**
- * Remove a public key, associated with an identity, from an account
- */
- RemoveSignatory: 'removeSignatory',
- /**
- * Give another account rights to perform actions on the account of transaction sender (give someone right to do something with my account).
- */
- GrantPermission: 'grantPermission',
- /**
- * Revoke or dismiss given granted permission from another account in the network.
- */
- RevokePermission: 'revokePermission',
- /**
- * Write into ledger the fact of peer addition into the peer network.
- */
- AddPeer: 'addPeer',
- /**
- * Write into ledger the fact of peer removal from the network.
- */
- RemovePeer: 'removePeer',
- /**
- * This command is not available for use, it was added for backward compatibility with Iroha.
- */
- SetSettingValue: 'setSettingValue',
- /**
- * This command is not availalbe for use because it is related to smart contract.
- */
- CallEngine: 'callEngine'
-} as const;
-
-export type IrohaCommand = typeof IrohaCommand[keyof typeof IrohaCommand];
-
-
-/**
- *
- * @export
- * @enum {string}
- */
-
-export const IrohaQuery = {
- /**
- * To get the state of an account
- */
- GetAccount: 'getAccount',
- /**
- * To get details of the account.
- */
- GetAccountDetail: 'getAccountDetail',
- /**
- * To get information on the given asset (as for now - its precision).
- */
- GetAssetInfo: 'getAssetInfo',
- /**
- * To get the state of all assets in an account (a balance).
- */
- GetAccountAssets: 'getAccountAssets',
- /**
- * To retrieve information about transactions, based on their hashes.
- */
- GetTransactions: 'getTransactions',
- /**
- * To retrieve a list of pending (not fully signed) multisignature transactions or batches of transactions issued by account of query creator.
- */
- GetPendingTransactions: 'getPendingTransactions',
- /**
- * To retrieve a list of transactions per account.
- */
- GetAccountTransactions: 'getAccountTransactions',
- /**
- * To retrieve all transactions associated with given account and asset.
- */
- GetAccountAssetTransactions: 'getAccountAssetTransactions',
- /**
- * To get existing roles in the system.
- */
- GetRoles: 'getRoles',
- /**
- * To get signatories, which act as an identity of the account.
- */
- GetSignatories: 'getSignatories',
- /**
- * To get available permissions per role in the system.
- */
- GetRolePermissions: 'getRolePermissions',
- /**
- * To get a specific block, using its height as an identifier.
- */
- GetBlock: 'getBlock',
- /**
- * To retrieve a receipt of a CallEngine command. Allows to access the event log created during computations inside the EVM.
- */
- GetEngineReceipts: 'getEngineReceipts',
- /**
- * To get new blocks as soon as they are committed, a user can invoke FetchCommits RPC call to Iroha network.
- */
- FetchCommits: 'fetchCommits',
- /**
- * A query that returns a list of peers in Iroha network.
- */
- GetPeers: 'getPeers'
-} as const;
-
-export type IrohaQuery = typeof IrohaQuery[keyof typeof IrohaQuery];
-
-
-/**
- *
- * @export
- * @enum {string}
- */
-
-export const IrohaSocketIOTransactV1 = {
- SendAsyncRequest: 'org.hyperledger.cactus.api.async.iroha.IrohaSocketIOTransactV1.SendAsyncRequest',
- SendSyncRequest: 'org.hyperledger.cactus.api.async.iroha.IrohaSocketIOTransactV1.SendSyncRequest'
-} as const;
-
-export type IrohaSocketIOTransactV1 = typeof IrohaSocketIOTransactV1[keyof typeof IrohaSocketIOTransactV1];
-
-
-/**
- *
- * @export
- * @interface KeyPair
- */
-export interface KeyPair {
- /**
- * SHA-3 ed25519 public keys of length 64 are recommended.
- * @type {string}
- * @memberof KeyPair
- */
- 'publicKey': string;
- /**
- * SHA-3 ed25519 private keys of length 64 are recommended.
- * @type {string}
- * @memberof KeyPair
- */
- 'privateKey': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Remove Peer.
- * @export
- * @interface RemovePeerRequestParameters
- */
-export interface RemovePeerRequestParameters {
- /**
- *
- * @type {string}
- * @memberof RemovePeerRequestParameters
- */
- 'publicKey': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Remove Signatory.
- * @export
- * @interface RemoveSignatoryRequestParameters
- */
-export interface RemoveSignatoryRequestParameters {
- /**
- *
- * @type {string}
- * @memberof RemoveSignatoryRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof RemoveSignatoryRequestParameters
- */
- 'publicKey': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Revoke Permission.
- * @export
- * @interface RevokePermissionRequestParameters
- */
-export interface RevokePermissionRequestParameters {
- /**
- *
- * @type {string}
- * @memberof RevokePermissionRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {number}
- * @memberof RevokePermissionRequestParameters
- */
- 'permission': number;
-}
-/**
- *
- * @export
- * @interface RunTransactionRequestV1
- */
-export interface RunTransactionRequestV1 {
- /**
- *
- * @type {string}
- * @memberof RunTransactionRequestV1
- */
- 'commandName': string;
- /**
- *
- * @type {IrohaBaseConfig}
- * @memberof RunTransactionRequestV1
- */
- 'baseConfig': IrohaBaseConfig;
- /**
- *
- * @type {RunTransactionRequestV1Params}
- * @memberof RunTransactionRequestV1
- */
- 'params': RunTransactionRequestV1Params;
-}
-/**
- * @type RunTransactionRequestV1Body
- * @export
- */
-export type RunTransactionRequestV1Body = RunTransactionRequestV1 | RunTransactionSignedRequestV1;
-
-/**
- * @type RunTransactionRequestV1Params
- * @export
- */
-export type RunTransactionRequestV1Params = AddAssetQuantityRequestParameters | AddPeerRequestParameters | AddSignatoryRequestParameters | AppendRoleRequestParameters | Array | CallEngineRequestParameters | CompareAndSetAccountDetailRequestParameters | CreateAccountRequestParameters | CreateAssetRequestParameters | CreateDomainRequestParameters | CreateRoleRequestParameters | DetachRoleRequestParameters | GetAccountAssetTransactionsRequestParameters | GetAccountAssetsRequestParameters | GetAccountDetailRequestParameters | GetAccountRequestParameters | GetAccountTransactionsRequestParameters | GetAssetInfoRequestParameters | GetBlockRequestParameters | GetEngineReceiptsRequestParameters | GetPendingTransactionsRequestParameters | GetRolePermissionsRequestParameters | GetSignatoriesRequestParameters | GetTransactionsRequestParameters | GrantPermissionRequestParameters | RemovePeerRequestParameters | RemoveSignatoryRequestParameters | RevokePermissionRequestParameters | SetAccountDetailRequestParameters | SetAccountQuorumRequestParameters | SubtractAssetQuantityRequestParameters | TransferAssetRequestParameters;
-
-/**
- *
- * @export
- * @interface RunTransactionResponse
- */
-export interface RunTransactionResponse {
- /**
- *
- * @type {any}
- * @memberof RunTransactionResponse
- */
- 'transactionReceipt': any;
-}
-/**
- *
- * @export
- * @interface RunTransactionSignedRequestV1
- */
-export interface RunTransactionSignedRequestV1 {
- /**
- * Signed transaction binary data received from generate-transaction endpoint.
- * @type {string}
- * @memberof RunTransactionSignedRequestV1
- */
- 'signedTransaction': string;
- /**
- *
- * @type {IrohaBaseConfig}
- * @memberof RunTransactionSignedRequestV1
- */
- 'baseConfig'?: IrohaBaseConfig;
-}
-/**
- * The list of arguments to pass in to the transaction request to Set Account Detail.
- * @export
- * @interface SetAccountDetailRequestParameters
- */
-export interface SetAccountDetailRequestParameters {
- /**
- *
- * @type {string}
- * @memberof SetAccountDetailRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {string}
- * @memberof SetAccountDetailRequestParameters
- */
- 'key': string;
- /**
- *
- * @type {string}
- * @memberof SetAccountDetailRequestParameters
- */
- 'value': string;
-}
-/**
- * The list of arguments to pass in to the transaction request to Set Account Quorum.
- * @export
- * @interface SetAccountQuorumRequestParameters
- */
-export interface SetAccountQuorumRequestParameters {
- /**
- *
- * @type {string}
- * @memberof SetAccountQuorumRequestParameters
- */
- 'accountId': string;
- /**
- *
- * @type {number}
- * @memberof SetAccountQuorumRequestParameters
- */
- 'quorum': number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Subtract Asset Quantity.
- * @export
- * @interface SubtractAssetQuantityRequestParameters
- */
-export interface SubtractAssetQuantityRequestParameters {
- /**
- *
- * @type {string}
- * @memberof SubtractAssetQuantityRequestParameters
- */
- 'assetId': string;
- /**
- *
- * @type {number}
- * @memberof SubtractAssetQuantityRequestParameters
- */
- 'amount': number;
-}
-/**
- * The list of arguments to pass in to the transaction request to Transfer Asset.
- * @export
- * @interface TransferAssetRequestParameters
- */
-export interface TransferAssetRequestParameters {
- /**
- *
- * @type {string}
- * @memberof TransferAssetRequestParameters
- */
- 'srcAccountId': string;
- /**
- *
- * @type {string}
- * @memberof TransferAssetRequestParameters
- */
- 'destAccountId': string;
- /**
- *
- * @type {string}
- * @memberof TransferAssetRequestParameters
- */
- 'assetId': string;
- /**
- *
- * @type {string}
- * @memberof TransferAssetRequestParameters
- */
- 'description': string;
- /**
- *
- * @type {number}
- * @memberof TransferAssetRequestParameters
- */
- 'amount': number;
-}
-/**
- *
- * @export
- * @enum {string}
- */
-
-export const WatchBlocksV1 = {
- Subscribe: 'org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Subscribe',
- Next: 'org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Next',
- Unsubscribe: 'org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Unsubscribe',
- Error: 'org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Error',
- Complete: 'org.hyperledger.cactus.api.async.iroha.WatchBlocksV1.Complete'
-} as const;
-
-export type WatchBlocksV1 = typeof WatchBlocksV1[keyof typeof WatchBlocksV1];
-
-
-
-/**
- * DefaultApi - axios parameter creator
- * @export
- */
-export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
- return {
- /**
- *
- * @summary Generate transaction that can be signed locally.
- * @param {GenerateTransactionRequestV1} [generateTransactionRequestV1]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- generateTransactionV1: async (generateTransactionRequestV1?: GenerateTransactionRequestV1, options: AxiosRequestConfig = {}): Promise => {
- const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/generate-transaction`;
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
- let baseOptions;
- if (configuration) {
- baseOptions = configuration.baseOptions;
- }
-
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
- const localVarHeaderParameter = {} as any;
- const localVarQueryParameter = {} as any;
-
-
-
- localVarHeaderParameter['Content-Type'] = 'application/json';
-
- setSearchParams(localVarUrlObj, localVarQueryParameter);
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
- localVarRequestOptions.data = serializeDataIfNeeded(generateTransactionRequestV1, localVarRequestOptions, configuration)
-
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- };
- },
- /**
- *
- * @summary Get the Prometheus Metrics
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => {
- const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/get-prometheus-exporter-metrics`;
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
- let baseOptions;
- if (configuration) {
- baseOptions = configuration.baseOptions;
- }
-
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
- const localVarHeaderParameter = {} as any;
- const localVarQueryParameter = {} as any;
-
-
-
- setSearchParams(localVarUrlObj, localVarQueryParameter);
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
-
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- };
- },
- /**
- *
- * @summary Executes a transaction on a Iroha ledger
- * @param {RunTransactionRequestV1Body} [runTransactionRequestV1Body]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- runTransactionV1: async (runTransactionRequestV1Body?: RunTransactionRequestV1Body, options: AxiosRequestConfig = {}): Promise => {
- const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/run-transaction`;
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
- let baseOptions;
- if (configuration) {
- baseOptions = configuration.baseOptions;
- }
-
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
- const localVarHeaderParameter = {} as any;
- const localVarQueryParameter = {} as any;
-
-
-
- localVarHeaderParameter['Content-Type'] = 'application/json';
-
- setSearchParams(localVarUrlObj, localVarQueryParameter);
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
- localVarRequestOptions.data = serializeDataIfNeeded(runTransactionRequestV1Body, localVarRequestOptions, configuration)
-
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- };
- },
- }
-};
-
-/**
- * DefaultApi - functional programming interface
- * @export
- */
-export const DefaultApiFp = function(configuration?: Configuration) {
- const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
- return {
- /**
- *
- * @summary Generate transaction that can be signed locally.
- * @param {GenerateTransactionRequestV1} [generateTransactionRequestV1]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async generateTransactionV1(generateTransactionRequestV1?: GenerateTransactionRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.generateTransactionV1(generateTransactionRequestV1, options);
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
- },
- /**
- *
- * @summary Get the Prometheus Metrics
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options);
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
- },
- /**
- *
- * @summary Executes a transaction on a Iroha ledger
- * @param {RunTransactionRequestV1Body} [runTransactionRequestV1Body]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async runTransactionV1(runTransactionRequestV1Body?: RunTransactionRequestV1Body, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.runTransactionV1(runTransactionRequestV1Body, options);
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
- },
- }
-};
-
-/**
- * DefaultApi - factory interface
- * @export
- */
-export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
- const localVarFp = DefaultApiFp(configuration)
- return {
- /**
- *
- * @summary Generate transaction that can be signed locally.
- * @param {GenerateTransactionRequestV1} [generateTransactionRequestV1]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- generateTransactionV1(generateTransactionRequestV1?: GenerateTransactionRequestV1, options?: any): AxiosPromise {
- return localVarFp.generateTransactionV1(generateTransactionRequestV1, options).then((request) => request(axios, basePath));
- },
- /**
- *
- * @summary Get the Prometheus Metrics
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- getPrometheusMetricsV1(options?: any): AxiosPromise {
- return localVarFp.getPrometheusMetricsV1(options).then((request) => request(axios, basePath));
- },
- /**
- *
- * @summary Executes a transaction on a Iroha ledger
- * @param {RunTransactionRequestV1Body} [runTransactionRequestV1Body]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- runTransactionV1(runTransactionRequestV1Body?: RunTransactionRequestV1Body, options?: any): AxiosPromise {
- return localVarFp.runTransactionV1(runTransactionRequestV1Body, options).then((request) => request(axios, basePath));
- },
- };
-};
-
-/**
- * DefaultApi - object-oriented interface
- * @export
- * @class DefaultApi
- * @extends {BaseAPI}
- */
-export class DefaultApi extends BaseAPI {
- /**
- *
- * @summary Generate transaction that can be signed locally.
- * @param {GenerateTransactionRequestV1} [generateTransactionRequestV1]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public generateTransactionV1(generateTransactionRequestV1?: GenerateTransactionRequestV1, options?: AxiosRequestConfig) {
- return DefaultApiFp(this.configuration).generateTransactionV1(generateTransactionRequestV1, options).then((request) => request(this.axios, this.basePath));
- }
-
- /**
- *
- * @summary Get the Prometheus Metrics
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public getPrometheusMetricsV1(options?: AxiosRequestConfig) {
- return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath));
- }
-
- /**
- *
- * @summary Executes a transaction on a Iroha ledger
- * @param {RunTransactionRequestV1Body} [runTransactionRequestV1Body]
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public runTransactionV1(runTransactionRequestV1Body?: RunTransactionRequestV1Body, options?: AxiosRequestConfig) {
- return DefaultApiFp(this.configuration).runTransactionV1(runTransactionRequestV1Body, options).then((request) => request(this.axios, this.basePath));
- }
-}
-
-
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/base.ts
deleted file mode 100644
index cfd901f2d3..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/base.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Hyperledger Cactus Plugin - Connector Iroha
- * Can perform basic tasks on a Iroha ledger
- *
- * The version of the OpenAPI document: v2.0.0-alpha.2
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import type { Configuration } from './configuration';
-// Some imports not used depending on template conditions
-// @ts-ignore
-import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
-import globalAxios from 'axios';
-
-export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
-
-/**
- *
- * @export
- */
-export const COLLECTION_FORMATS = {
- csv: ",",
- ssv: " ",
- tsv: "\t",
- pipes: "|",
-};
-
-/**
- *
- * @export
- * @interface RequestArgs
- */
-export interface RequestArgs {
- url: string;
- options: AxiosRequestConfig;
-}
-
-/**
- *
- * @export
- * @class BaseAPI
- */
-export class BaseAPI {
- protected configuration: Configuration | undefined;
-
- constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
- if (configuration) {
- this.configuration = configuration;
- this.basePath = configuration.basePath || this.basePath;
- }
- }
-};
-
-/**
- *
- * @export
- * @class RequiredError
- * @extends {Error}
- */
-export class RequiredError extends Error {
- constructor(public field: string, msg?: string) {
- super(msg);
- this.name = "RequiredError"
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/common.ts
deleted file mode 100644
index 1379bf4877..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/common.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Hyperledger Cactus Plugin - Connector Iroha
- * Can perform basic tasks on a Iroha ledger
- *
- * The version of the OpenAPI document: v2.0.0-alpha.2
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-import type { Configuration } from "./configuration";
-import type { RequestArgs } from "./base";
-import type { AxiosInstance, AxiosResponse } from 'axios';
-import { RequiredError } from "./base";
-
-/**
- *
- * @export
- */
-export const DUMMY_BASE_URL = 'https://example.com'
-
-/**
- *
- * @throws {RequiredError}
- * @export
- */
-export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
- if (paramValue === null || paramValue === undefined) {
- throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
- }
-}
-
-/**
- *
- * @export
- */
-export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
- if (configuration && configuration.apiKey) {
- const localVarApiKeyValue = typeof configuration.apiKey === 'function'
- ? await configuration.apiKey(keyParamName)
- : await configuration.apiKey;
- object[keyParamName] = localVarApiKeyValue;
- }
-}
-
-/**
- *
- * @export
- */
-export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
- if (configuration && (configuration.username || configuration.password)) {
- object["auth"] = { username: configuration.username, password: configuration.password };
- }
-}
-
-/**
- *
- * @export
- */
-export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
- if (configuration && configuration.accessToken) {
- const accessToken = typeof configuration.accessToken === 'function'
- ? await configuration.accessToken()
- : await configuration.accessToken;
- object["Authorization"] = "Bearer " + accessToken;
- }
-}
-
-/**
- *
- * @export
- */
-export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
- if (configuration && configuration.accessToken) {
- const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
- ? await configuration.accessToken(name, scopes)
- : await configuration.accessToken;
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
- }
-}
-
-function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
- if (parameter == null) return;
- if (typeof parameter === "object") {
- if (Array.isArray(parameter)) {
- (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
- }
- else {
- Object.keys(parameter).forEach(currentKey =>
- setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
- );
- }
- }
- else {
- if (urlSearchParams.has(key)) {
- urlSearchParams.append(key, parameter);
- }
- else {
- urlSearchParams.set(key, parameter);
- }
- }
-}
-
-/**
- *
- * @export
- */
-export const setSearchParams = function (url: URL, ...objects: any[]) {
- const searchParams = new URLSearchParams(url.search);
- setFlattenedQueryParams(searchParams, objects);
- url.search = searchParams.toString();
-}
-
-/**
- *
- * @export
- */
-export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
- const nonString = typeof value !== 'string';
- const needsSerialization = nonString && configuration && configuration.isJsonMime
- ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
- : nonString;
- return needsSerialization
- ? JSON.stringify(value !== undefined ? value : {})
- : (value || "");
-}
-
-/**
- *
- * @export
- */
-export const toPathString = function (url: URL) {
- return url.pathname + url.search + url.hash
-}
-
-/**
- *
- * @export
- */
-export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
- return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
- const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
- return axios.request(axiosRequestArgs);
- };
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/configuration.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/configuration.ts
deleted file mode 100644
index d19a116a9a..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/configuration.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Hyperledger Cactus Plugin - Connector Iroha
- * Can perform basic tasks on a Iroha ledger
- *
- * The version of the OpenAPI document: v2.0.0-alpha.2
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-export interface ConfigurationParameters {
- apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise);
- username?: string;
- password?: string;
- accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise);
- basePath?: string;
- baseOptions?: any;
- formDataCtor?: new () => any;
-}
-
-export class Configuration {
- /**
- * parameter for apiKey security
- * @param name security name
- * @memberof Configuration
- */
- apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise);
- /**
- * parameter for basic security
- *
- * @type {string}
- * @memberof Configuration
- */
- username?: string;
- /**
- * parameter for basic security
- *
- * @type {string}
- * @memberof Configuration
- */
- password?: string;
- /**
- * parameter for oauth2 security
- * @param name security name
- * @param scopes oauth2 scope
- * @memberof Configuration
- */
- accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise);
- /**
- * override base path
- *
- * @type {string}
- * @memberof Configuration
- */
- basePath?: string;
- /**
- * base options for axios calls
- *
- * @type {any}
- * @memberof Configuration
- */
- baseOptions?: any;
- /**
- * The FormData constructor that will be used to create multipart form data
- * requests. You can inject this here so that execution environments that
- * do not support the FormData class can still run the generated client.
- *
- * @type {new () => FormData}
- */
- formDataCtor?: new () => any;
-
- constructor(param: ConfigurationParameters = {}) {
- this.apiKey = param.apiKey;
- this.username = param.username;
- this.password = param.password;
- this.accessToken = param.accessToken;
- this.basePath = param.basePath;
- this.baseOptions = param.baseOptions;
- this.formDataCtor = param.formDataCtor;
- }
-
- /**
- * Check if the given MIME is a JSON MIME.
- * JSON MIME examples:
- * application/json
- * application/json; charset=UTF8
- * APPLICATION/JSON
- * application/vnd.company+json
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
- * @return True if the given MIME is JSON, false otherwise.
- */
- public isJsonMime(mime: string): boolean {
- const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
- return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/index.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/index.ts
deleted file mode 100644
index bf6e9f96fd..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/generated/openapi/typescript-axios/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-/**
- * Hyperledger Cactus Plugin - Connector Iroha
- * Can perform basic tasks on a Iroha ledger
- *
- * The version of the OpenAPI document: v2.0.0-alpha.2
- *
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-export * from "./api";
-export * from "./configuration";
-
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.ts
deleted file mode 100755
index 87cb558397..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./public-api";
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.web.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.web.ts
deleted file mode 100755
index bdf54028d2..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/index.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./generated/openapi/typescript-axios/index";
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-sign-utils.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-sign-utils.ts
deleted file mode 100644
index ba4c2ac084..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-sign-utils.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2020-2022 Hyperledger Cactus Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Signing utility functions for HL Iroha ledger.
- */
-
-import { txHelper } from "iroha-helpers";
-import { Transaction } from "iroha-helpers/lib/proto/transaction_pb";
-
-/**
- * Sign transaction binary received from `generateTransactionV1()` call.
- * Can be signed by multiple Signatories (with multiple keys) or a single key.
- *
- * @param serializedTx Serialized transaction data.
- * To convert binary response from connector into `Uint8Array` required by this function you can use:
- * ```
- * const serializedTx = Uint8Array.from(Object.values(genTxResponse.data));
- * ```
- * @param privateKeys One or multiple keys to sign the transaction with.
- * @returns Signed transaction data (`Uint8Array`)
- */
-export function signIrohaTransaction(
- serializedTx: Uint8Array,
- privateKeys: string | string[],
-): Uint8Array {
- const unsignedTx = Transaction.deserializeBinary(serializedTx);
-
- if (typeof privateKeys === "string") {
- privateKeys = [privateKeys];
- }
-
- const signedTx = privateKeys.reduce(
- (tx, key) => txHelper.sign(tx, key),
- unsignedTx,
- );
-
- return signedTx.serializeBinary();
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts
deleted file mode 100644
index 5737bf8b21..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/iroha-transaction-wrapper.ts
+++ /dev/null
@@ -1,763 +0,0 @@
-import { Checks, Logger } from "@hyperledger/cactus-common";
-import {
- LoggerProvider,
- LogLevelDesc,
- Http405NotAllowedError,
-} from "@hyperledger/cactus-common";
-import {
- IrohaBaseConfig,
- IrohaCommand,
- IrohaQuery,
- RunTransactionRequestV1,
- RunTransactionResponse,
-} from "./generated/openapi/typescript-axios";
-
-import { RuntimeError } from "run-time-error-cjs";
-import * as grpc from "@grpc/grpc-js";
-
-import {
- GrantablePermission,
- GrantablePermissionMap,
-} from "iroha-helpers/lib/proto/primitive_pb";
-
-import { CommandService_v1Client as CommandService } from "iroha-helpers/lib/proto/endpoint_grpc_pb";
-import { QueryService_v1Client as QueryService } from "iroha-helpers/lib/proto/endpoint_grpc_pb";
-
-import commands from "iroha-helpers/lib/commands/index";
-import queries from "iroha-helpers/lib/queries";
-
-export interface IIrohaTransactionWrapperOptions {
- logLevel?: LogLevelDesc;
-}
-
-export class IrohaTransactionWrapper {
- private readonly log: Logger;
- public static readonly CLASS_NAME = "IrohaTransactionWrapper";
-
- public get className(): string {
- return IrohaTransactionWrapper.CLASS_NAME;
- }
-
- constructor(options: IIrohaTransactionWrapperOptions) {
- const level = options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
- }
-
- /**
- * Create instances of Iroha SDK CommandService and QueryService from input base config.
- *
- * @param baseConfig iroha configuration from request, must contain Iroha URL information.
- * @returns {commandService, queryService}
- */
- public static getIrohaServices(baseConfig: IrohaBaseConfig): {
- commandService: CommandService;
- queryService: QueryService;
- } {
- if (!baseConfig || !baseConfig.irohaHost || !baseConfig.irohaPort) {
- throw new RuntimeError("Missing Iroha URL information.");
- }
- const irohaHostPort = `${baseConfig.irohaHost}:${baseConfig.irohaPort}`;
-
- let grpcCredentials;
- if (baseConfig.tls) {
- throw new RuntimeError("TLS option is not supported");
- } else {
- grpcCredentials = grpc.credentials.createInsecure();
- }
-
- const commandService = new CommandService(
- irohaHostPort,
- //TODO:do something in the production environment
- grpcCredentials,
- );
- const queryService = new QueryService(irohaHostPort, grpcCredentials);
-
- return { commandService, queryService };
- }
-
- public async transact(
- req: RunTransactionRequestV1,
- ): Promise {
- const { baseConfig } = req;
- Checks.truthy(baseConfig, "baseConfig");
- Checks.truthy(baseConfig.privKey, "privKey in baseConfig");
- Checks.truthy(
- baseConfig.creatorAccountId,
- "creatorAccountId in baseConfig",
- );
- Checks.truthy(baseConfig.quorum, "quorum in baseConfig");
- Checks.truthy(baseConfig.timeoutLimit, "timeoutLimit in baseConfig");
-
- if (!baseConfig.privKey || !baseConfig.timeoutLimit) {
- // narrow the types
- throw new Error("Should never happen - Checks should catch this first");
- }
-
- const { commandService, queryService } =
- IrohaTransactionWrapper.getIrohaServices(baseConfig);
-
- const commandOptions = {
- privateKeys: baseConfig.privKey, //need an array of keys for command
- creatorAccountId: baseConfig.creatorAccountId,
- quorum: baseConfig.quorum,
- commandService: commandService,
- timeoutLimit: baseConfig.timeoutLimit,
- };
-
- const queryOptions = {
- privateKey: baseConfig.privKey[0], //only need 1 key for query
- creatorAccountId: baseConfig.creatorAccountId as string,
- queryService: queryService,
- timeoutLimit: baseConfig.timeoutLimit,
- };
-
- switch (req.commandName) {
- case IrohaCommand.AddAssetQuantity: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- assetId: req.params[0],
- amount: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.addAssetQuantity(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.AddPeer: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- address: req.params[0],
- peerKey: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.addPeer(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.AddSignatory: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- publicKey: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.addSignatory(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.AppendRole: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- roleName: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.appendRole(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CallEngine: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- type: req.params[0],
- caller: req.params[1],
- callee: req.params[2],
- input: req.params[3],
- };
- } else {
- params = req.params;
- }
- const response = await commands.callEngine(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CreateAccount: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountName: req.params[0],
- domainId: req.params[1],
- publicKey: req.params[2],
- };
- } else {
- params = req.params;
- }
- const response = await commands.createAccount(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CreateAsset: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- assetName: req.params[0],
- domainId: req.params[1],
- precision: req.params[2],
- };
- } else {
- params = req.params;
- }
- const response = await commands.createAsset(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CreateDomain: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- domainId: req.params[0],
- defaultRole: req.params[1],
- };
- params.domainId = req.params[0];
- params.defaultRole = req.params[1];
- } else {
- params = req.params;
- }
- const response = await commands.createDomain(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CreateRole: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- roleName: req.params[0],
- permissionsList: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.createRole(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.DetachRole: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- roleName: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.detachRole(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.GrantPermission: {
- try {
- let params;
- type permission = keyof GrantablePermissionMap;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- permission: GrantablePermission[req.params[1] as permission],
- };
- } else {
- params = req.params;
- if ("permission" in params) {
- params["permission"] =
- GrantablePermission[params["permission"] as permission];
- }
- }
- const response = await commands.grantPermission(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.RemovePeer: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- publicKey: req.params[0],
- };
- } else {
- params = req.params;
- }
- const response = await commands.removePeer(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.RemoveSignatory: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- publicKey: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.removeSignatory(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.RevokePermission: {
- try {
- let params;
- type permission = keyof GrantablePermissionMap;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- permission: GrantablePermission[req.params[1] as permission],
- };
- } else {
- params = req.params;
- if ("permission" in params) {
- params["permission"] =
- GrantablePermission[params["permission"] as permission];
- }
- }
- const response = await commands.revokePermission(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.SetAccountDetail: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- key: req.params[1],
- value: req.params[2],
- };
- } else {
- params = req.params;
- }
- const response = await commands.setAccountDetail(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.SetAccountQuorum: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- quorum: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.setAccountQuorum(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.SubtractAssetQuantity: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- assetId: req.params[0],
- amount: req.params[1],
- };
- } else {
- params = req.params;
- }
- const response = await commands.subtractAssetQuantity(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.TransferAsset: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- srcAccountId: req.params[0],
- destAccountId: req.params[1],
- assetId: req.params[2],
- description: req.params[3],
- amount: req.params[4],
- };
- } else {
- params = req.params;
- }
- const response = await commands.transferAsset(commandOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.CompareAndSetAccountDetail: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- key: req.params[1],
- value: req.params[2],
- oldValue: req.params[3],
- checkEmpty: req.params[4],
- };
- } else {
- params = req.params;
- }
- const response = await commands.compareAndSetAccountDetail(
- commandOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaCommand.SetSettingValue: {
- throw new Http405NotAllowedError("SetSettingValue is not supported.");
- }
- case IrohaQuery.GetEngineReceipts: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- txHash: req.params[0],
- };
- } else {
- params = req.params;
- }
- const response = await queries.getEngineReceipts(
- queryOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAccount: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- };
- } else {
- params = req.params;
- }
- const queryRes = await queries.getAccount(queryOptions, params);
- return { transactionReceipt: queryRes };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetBlock: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- height: req.params[0],
- };
- } else {
- params = req.params;
- }
- const response = await queries.getBlock(queryOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetSignatories: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- };
- } else {
- params = req.params;
- }
- const queryRes = await queries.getSignatories(queryOptions, params);
- return { transactionReceipt: queryRes };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetTransactions: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- txHashesList: req.params[0],
- };
- } else {
- params = req.params;
- }
- const response = await queries.getTransactions(queryOptions, params);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetPendingTransactions: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- pageSize: req.params[0],
- firstTxHash: req.params[1],
- firstTxTime: req.params[2],
- lastTxTime: req.params[3],
- firstTxHeight: req.params[4],
- lastTxHeight: req.params[5],
- ordering: {
- field: req.params[6],
- direction: req.params[7],
- },
- };
- } else {
- params = req.params;
- }
- const response = await queries.getPendingTransactions(
- queryOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAccountTransactions: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- pageSize: req.params[1],
- firstTxHash: req.params[2],
- firstTxTime: req.params[3],
- lastTxTime: req.params[4],
- firstTxHeight: req.params[5],
- lastTxHeight: req.params[6],
- ordering: {
- field: req.params[7],
- direction: req.params[8],
- },
- };
- } else {
- params = req.params;
- }
- const response = await queries.getAccountTransactions(
- queryOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAccountAssetTransactions: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- assetId: req.params[1],
- pageSize: req.params[2],
- firstTxHash: req.params[3],
- firstTxTime: req.params[4],
- lastTxTime: req.params[5],
- firstTxHeight: req.params[6],
- lastTxHeight: req.params[7],
- ordering: {
- field: req.params[8],
- direction: req.params[9],
- },
- };
- } else {
- params = req.params;
- }
- const response = await queries.getAccountAssetTransactions(
- queryOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAccountAssets: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- pageSize: req.params[1],
- firstAssetId: req.params[2],
- };
- } else {
- params = req.params;
- }
- const queryRes = await queries.getAccountAssets(queryOptions, params);
- return { transactionReceipt: queryRes };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAccountDetail: {
- try {
- let params: any;
- if (Array.isArray(req.params)) {
- params = {
- accountId: req.params[0],
- key: req.params[1],
- writer: req.params[2],
- pageSize: req.params[3],
- paginationKey: req.params[4],
- paginationWriter: req.params[5],
- };
- } else {
- params = req.params;
- }
- const queryRes = await queries.getAccountDetail(queryOptions, params);
- return { transactionReceipt: queryRes };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetAssetInfo: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- assetId: req.params[0],
- };
- } else {
- params = req.params;
- }
- const queryRes = await queries.getAssetInfo(queryOptions, params);
- return { transactionReceipt: queryRes };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetRoles: {
- try {
- const response = await queries.getRoles(queryOptions);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetRolePermissions: {
- try {
- let params;
- if (Array.isArray(req.params)) {
- params = {
- roleId: req.params[0],
- };
- } else {
- params = req.params;
- }
- const response = await queries.getRolePermissions(
- queryOptions,
- params,
- );
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.GetPeers: {
- try {
- const response = await queries.getPeers(queryOptions);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- case IrohaQuery.FetchCommits: {
- try {
- const response = await queries.fetchCommits(queryOptions);
- return { transactionReceipt: response };
- } catch (err) {
- throw new RuntimeError(err as any);
- }
- }
- default: {
- throw new RuntimeError(
- "command or query does not exist, or is not supported in current version",
- );
- }
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-factory-ledger-connector.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-factory-ledger-connector.ts
deleted file mode 100644
index 7734d3d514..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-factory-ledger-connector.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import {
- IPluginFactoryOptions,
- PluginFactory,
-} from "@hyperledger/cactus-core-api";
-import {
- IPluginLedgerConnectorIrohaOptions,
- PluginLedgerConnectorIroha,
-} from "./plugin-ledger-connector-iroha";
-
-export class PluginFactoryLedgerConnector extends PluginFactory<
- PluginLedgerConnectorIroha,
- IPluginLedgerConnectorIrohaOptions,
- IPluginFactoryOptions
-> {
- async create(
- pluginOptions: IPluginLedgerConnectorIrohaOptions,
- ): Promise {
- return new PluginLedgerConnectorIroha(pluginOptions);
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts
deleted file mode 100644
index 3a60f6d9db..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/plugin-ledger-connector-iroha.ts
+++ /dev/null
@@ -1,370 +0,0 @@
-import { Transaction } from "iroha-helpers/lib/proto/transaction_pb";
-import { TxBuilder } from "iroha-helpers/lib/chain";
-import type { Server as SocketIoServer } from "socket.io";
-import type { Socket as SocketIoSocket } from "socket.io";
-import type { Express } from "express";
-
-import { IrohaTransactionWrapper } from "./iroha-transaction-wrapper";
-
-import OAS from "../json/openapi.json";
-
-import {
- ConsensusAlgorithmFamily,
- IPluginLedgerConnector,
- IWebServiceEndpoint,
- IPluginWebService,
- ICactusPlugin,
- ICactusPluginOptions,
-} from "@hyperledger/cactus-core-api";
-
-import {
- PluginRegistry,
- consensusHasTransactionFinality,
-} from "@hyperledger/cactus-core";
-
-import {
- Checks,
- Logger,
- LoggerProvider,
- LogLevelDesc,
-} from "@hyperledger/cactus-common";
-
-import { RuntimeError } from "run-time-error-cjs";
-
-import {
- IrohaCommand,
- RunTransactionRequestV1,
- RunTransactionSignedRequestV1,
- GenerateTransactionRequestV1,
- RunTransactionResponse,
- WatchBlocksV1,
- IrohaSocketIOTransactV1,
-} from "./generated/openapi/typescript-axios";
-
-import { RunTransactionEndpoint } from "./web-services/run-transaction-endpoint";
-import { GenerateTransactionEndpoint } from "./web-services/generate-transaction-endpoint";
-import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter";
-import { IrohaSocketIOEndpoint } from "./web-services/iroha-socketio-endpoint";
-import {
- GetPrometheusExporterMetricsEndpointV1,
- IGetPrometheusExporterMetricsEndpointV1Options,
-} from "./web-services/get-prometheus-exporter-metrics-endpoint-v1";
-
-export const E_KEYCHAIN_NOT_FOUND = "cactus.connector.iroha.keychain_not_found";
-
-export interface IPluginLedgerConnectorIrohaOptions
- extends ICactusPluginOptions {
- rpcToriiPortHost: string; //http host:port
- rpcApiWsHost?: string;
- pluginRegistry: PluginRegistry;
- prometheusExporter?: PrometheusExporter;
- logLevel?: LogLevelDesc;
- instanceId: string;
-}
-
-export class PluginLedgerConnectorIroha
- implements
- IPluginLedgerConnector<
- never,
- never,
- RunTransactionSignedRequestV1 | RunTransactionRequestV1,
- RunTransactionResponse
- >,
- ICactusPlugin,
- IPluginWebService
-{
- private readonly instanceId: string;
- public prometheusExporter: PrometheusExporter;
- private readonly log: Logger;
-
- private endpoints: IWebServiceEndpoint[] | undefined;
-
- public static readonly CLASS_NAME = "PluginLedgerConnectorIroha";
-
- public get className(): string {
- return PluginLedgerConnectorIroha.CLASS_NAME;
- }
-
- constructor(public readonly options: IPluginLedgerConnectorIrohaOptions) {
- const fnTag = `${this.className}#constructor()`;
- Checks.truthy(options, `${fnTag} arg options`);
- Checks.truthy(
- options.rpcToriiPortHost,
- `${fnTag} options.rpcToriiPortHost`,
- );
- Checks.truthy(options.instanceId, `${fnTag} options.instanceId`);
-
- const level = this.options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
-
- this.instanceId = options.instanceId;
- this.prometheusExporter =
- options.prometheusExporter ||
- new PrometheusExporter({ pollingIntervalInMin: 1 });
- Checks.truthy(
- this.prometheusExporter,
- `${fnTag} options.prometheusExporter`,
- );
- this.prometheusExporter.startMetricsCollection();
- }
-
- public getOpenApiSpec(): unknown {
- return OAS;
- }
-
- deployContract(): Promise {
- throw new RuntimeError("Method not implemented.");
- }
-
- public getPrometheusExporter(): PrometheusExporter {
- return this.prometheusExporter;
- }
-
- public async getPrometheusExporterMetrics(): Promise {
- const res: string = await this.prometheusExporter.getPrometheusMetrics();
- this.log.debug(`getPrometheusExporterMetrics() response: %o`, res);
- return res;
- }
-
- public getInstanceId(): string {
- return this.instanceId;
- }
-
- public async onPluginInit(): Promise {
- return;
- }
-
- public async shutdown(): Promise {
- this.log.info(`Shutting down ${this.className}...`);
- }
-
- async registerWebServices(
- app: Express,
- wsApi?: SocketIoServer,
- ): Promise {
- const { logLevel } = this.options;
- const webServices = await this.getOrCreateWebServices();
- await Promise.all(webServices.map((ws) => ws.registerExpress(app)));
-
- if (wsApi) {
- wsApi.on("connection", (socket: SocketIoSocket) => {
- this.log.debug(`New Socket connected. ID=${socket.id}`);
- const irohaSocketEndpoint = new IrohaSocketIOEndpoint({
- socket,
- logLevel,
- });
- let monitorFlag: boolean;
-
- socket.on(WatchBlocksV1.Subscribe, (monitorOptions: any) => {
- this.log.debug(`Caught event: Subscribe`);
- monitorFlag = true;
- irohaSocketEndpoint.startMonitor(monitorOptions);
- });
-
- socket.on(WatchBlocksV1.Unsubscribe, () => {
- this.log.debug(`Caught event: Unsubscribe`);
- irohaSocketEndpoint.stopMonitor();
- });
-
- socket.on(
- IrohaSocketIOTransactV1.SendAsyncRequest,
- (asyncRequestData: any) => {
- this.log.debug(`Caught event: SendAsyncRequest`);
- socket.disconnect(true);
- irohaSocketEndpoint.sendRequest(asyncRequestData, true);
- },
- );
-
- socket.on(
- IrohaSocketIOTransactV1.SendSyncRequest,
- (syncRequestData: any) => {
- this.log.debug(`Caught event: SendSyncRequest`);
- irohaSocketEndpoint.sendRequest(syncRequestData, false);
- },
- );
-
- socket.on("disconnect", async (reason: string) => {
- this.log.info(
- `Session: ${socket.id} disconnected. Reason: ${reason}`,
- );
- if (monitorFlag) {
- irohaSocketEndpoint.stopMonitor();
- monitorFlag = false;
- }
- });
- });
- }
-
- return webServices;
- }
-
- public async getOrCreateWebServices(): Promise {
- if (Array.isArray(this.endpoints)) {
- return this.endpoints;
- }
- const endpoints: IWebServiceEndpoint[] = [];
- {
- const endpoint = new RunTransactionEndpoint({
- connector: this,
- logLevel: this.options.logLevel,
- });
- endpoints.push(endpoint);
- }
- {
- const opts: IGetPrometheusExporterMetricsEndpointV1Options = {
- connector: this,
- logLevel: this.options.logLevel,
- };
- const endpoint = new GetPrometheusExporterMetricsEndpointV1(opts);
- endpoints.push(endpoint);
- }
- {
- const endpoint = new GenerateTransactionEndpoint({
- connector: this,
- logLevel: this.options.logLevel,
- });
- endpoints.push(endpoint);
- }
-
- this.endpoints = endpoints;
- return endpoints;
- }
-
- public getPackageName(): string {
- return `@hyperledger/cactus-plugin-ledger-connector-iroha`;
- }
-
- public async getConsensusAlgorithmFamily(): Promise {
- return ConsensusAlgorithmFamily.Authority;
- }
- public async hasTransactionFinality(): Promise {
- const currentConsensusAlgorithmFamily =
- await this.getConsensusAlgorithmFamily();
-
- return consensusHasTransactionFinality(currentConsensusAlgorithmFamily);
- }
-
- /**
- * Create and run Iroha transaction based on input arguments.
- * Transaction is signed with a private key supplied in the input argument.
- *
- * @param req `RunTransactionSignedRequestV1`
- * @param commandService Iroha SDK `CommandService_v1Client` instance
- * @param queryService Iroha SDK `QueryService_v1Client` instance
- * @returns `Promise`
- */
- private async transactRequest(
- req: RunTransactionRequestV1,
- ): Promise {
- const transaction = new IrohaTransactionWrapper({
- logLevel: this.options.logLevel,
- });
- return await transaction.transact(req);
- }
-
- /**
- * Run Iroha transaction based on already signed transaction received from the client.
- *
- * @param req RunTransactionSignedRequestV1
- * @returns `Promise`
- */
- private async transactSigned(
- req: RunTransactionSignedRequestV1,
- ): Promise {
- const fnTag = `${this.className}:transactSigned(RunTransactionSignedRequestV1)`;
- if (!req.baseConfig || !req.baseConfig.timeoutLimit) {
- throw new RuntimeError("baseConfig.timeoutLimit is undefined");
- }
-
- const { commandService } = IrohaTransactionWrapper.getIrohaServices(
- req.baseConfig,
- );
-
- try {
- const signedTxBuffer = Buffer.from(req.signedTransaction, "base64");
- const txBinary = Uint8Array.from(signedTxBuffer);
-
- const signedTransaction = Transaction.deserializeBinary(txBinary);
- this.log.debug("Received signed transaction:", signedTransaction);
-
- const sendResponse = await new TxBuilder(signedTransaction).send(
- commandService,
- req.baseConfig.timeoutLimit,
- );
-
- return { transactionReceipt: sendResponse };
- } catch (ex) {
- throw new RuntimeError(`${fnTag} crashed with: `, ex);
- }
- }
-
- /**
- * Entry point for transact endpoint.
- * Validate common `baseConfig` arguments and perapre command and query services.
- * Call different transaction logic depending on input arguments.
- *
- * @note TLS connections are not supported yet.
- * @param req `RunTransactionSignedRequestV1 | RunTransactionRequestV1`
- * @returns `Promise`
- */
- public async transact(
- req: RunTransactionSignedRequestV1 | RunTransactionRequestV1,
- ): Promise {
- if ("signedTransaction" in req) {
- return this.transactSigned(req);
- } else {
- const transaction = new IrohaTransactionWrapper({
- logLevel: this.options.logLevel,
- });
- return await transaction.transact(req);
- }
- }
-
- /**
- * Check if given Iroha command is supported and can be safely called on the `TxBuilder`.
- * Command must be listend in OpenAPI interface and be present on the builder object.
- * @param builder `TxBuilder` that will be used to call the command on.
- * @param command Iroha command name in string format.
- * @returns `true` if command is safe, `false` otherwise.
- */
- private isSafeIrohaCommand(builder: TxBuilder, command: string): boolean {
- // Check if command is listen in the OpenAPI interface
- if (!Object.values(IrohaCommand).includes(command as IrohaCommand)) {
- this.log.debug("Command not listed in OpenAPI interface");
- return false;
- }
-
- // Check if function is present in builder object
- return (
- command in builder && typeof (builder as any)[command] === "function"
- );
- }
-
- /**
- * Entry point for generate unsigned transaction endpoint.
- * Transaction must be deserialized and signed on the client side.
- * It can be then send to transact endpoint for futher processing.
- * @param req `GenerateTransactionRequestV1`
- * @returns `Uint8Array` of serialized transaction.
- */
- public generateTransaction(req: GenerateTransactionRequestV1): Uint8Array {
- req.quorum = req.quorum ?? 1;
- const builder = new TxBuilder();
-
- if (!this.isSafeIrohaCommand(builder, req.commandName)) {
- throw new RuntimeError(
- `Bad Request: Not supported Iroha command '${req.commandName}' - aborted.`,
- );
- }
-
- try {
- return (builder as any)
- [req.commandName](req.commandParams)
- .addMeta(req.creatorAccountId, req.quorum)
- .tx.serializeBinary();
- } catch (error) {
- throw new RuntimeError(error as any);
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/data-fetcher.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/data-fetcher.ts
deleted file mode 100644
index fc752190f8..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/data-fetcher.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Transactions } from "./response.type";
-
-import { totalTxCount, K_CACTUS_IROHA_TOTAL_TX_COUNT } from "./metrics";
-
-export async function collectMetrics(
- transactions: Transactions,
-): Promise {
- transactions.counter++;
- totalTxCount.labels(K_CACTUS_IROHA_TOTAL_TX_COUNT).set(transactions.counter);
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/metrics.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/metrics.ts
deleted file mode 100644
index 05f055d5ae..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/metrics.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Gauge } from "prom-client";
-
-export const K_CACTUS_IROHA_TOTAL_TX_COUNT = "cactus_iroha_total_tx_count";
-
-export const totalTxCount = new Gauge({
- registers: [],
- name: "cactus_iroha_total_tx_count",
- help: "Total transactions executed",
- labelNames: ["type"],
-});
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/prometheus-exporter.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/prometheus-exporter.ts
deleted file mode 100644
index c4d2db9bc1..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/prometheus-exporter.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import promClient, { Registry } from "prom-client";
-import { Transactions } from "./response.type";
-import { collectMetrics } from "./data-fetcher";
-import { K_CACTUS_IROHA_TOTAL_TX_COUNT } from "./metrics";
-import { totalTxCount } from "./metrics";
-
-export interface IPrometheusExporterOptions {
- pollingIntervalInMin?: number;
-}
-
-export class PrometheusExporter {
- public readonly metricsPollingIntervalInMin: number;
- public readonly transactions: Transactions = { counter: 0 };
- public readonly registry: Registry;
-
- constructor(
- public readonly prometheusExporterOptions: IPrometheusExporterOptions,
- ) {
- this.metricsPollingIntervalInMin =
- prometheusExporterOptions.pollingIntervalInMin || 1;
- this.registry = new Registry();
- }
-
- public addCurrentTransaction(): void {
- collectMetrics(this.transactions);
- }
-
- public async getPrometheusMetrics(): Promise {
- const result = await this.registry.getSingleMetricAsString(
- K_CACTUS_IROHA_TOTAL_TX_COUNT,
- );
- return result;
- }
-
- public startMetricsCollection(): void {
- this.registry.registerMetric(totalTxCount);
- promClient.collectDefaultMetrics({ register: this.registry });
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/response.type.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/response.type.ts
deleted file mode 100644
index 3f1bc7f491..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/prometheus-exporter/response.type.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type Transactions = {
- counter: number;
-};
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/public-api.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/public-api.ts
deleted file mode 100755
index a91a8d7697..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/public-api.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-export {
- E_KEYCHAIN_NOT_FOUND,
- IPluginLedgerConnectorIrohaOptions,
- PluginLedgerConnectorIroha,
-} from "./plugin-ledger-connector-iroha";
-
-export { signIrohaTransaction } from "./iroha-sign-utils";
-
-export { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector";
-
-import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api";
-import { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector";
-
-export {
- IrohaApiClient,
- IrohaApiClientOptions,
-} from "./api-client/iroha-api-client";
-
-export * from "./generated/openapi/typescript-axios/api";
-
-export async function createPluginFactory(
- pluginFactoryOptions: IPluginFactoryOptions,
-): Promise {
- return new PluginFactoryLedgerConnector(pluginFactoryOptions);
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/generate-transaction-endpoint.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/generate-transaction-endpoint.ts
deleted file mode 100644
index 218d3f8871..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/generate-transaction-endpoint.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import type { Express, Request, Response } from "express";
-import safeStringify from "fast-safe-stringify";
-import sanitizeHtml from "sanitize-html";
-
-import {
- Logger,
- Checks,
- LogLevelDesc,
- LoggerProvider,
- IAsyncProvider,
-} from "@hyperledger/cactus-common";
-import {
- IEndpointAuthzOptions,
- IExpressRequestHandler,
- IWebServiceEndpoint,
-} from "@hyperledger/cactus-core-api";
-import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";
-
-import { PluginLedgerConnectorIroha } from "../plugin-ledger-connector-iroha";
-
-import OAS from "../../json/openapi.json";
-
-export interface IGenerateTransactionEndpointOptions {
- logLevel?: LogLevelDesc;
- connector: PluginLedgerConnectorIroha;
-}
-
-export class GenerateTransactionEndpoint implements IWebServiceEndpoint {
- public static readonly CLASS_NAME = "GenerateTransactionEndpoint";
-
- private readonly log: Logger;
-
- public get className(): string {
- return GenerateTransactionEndpoint.CLASS_NAME;
- }
-
- constructor(public readonly options: IGenerateTransactionEndpointOptions) {
- const fnTag = `${this.className}#constructor()`;
- Checks.truthy(options, `${fnTag} arg options`);
- Checks.truthy(options.connector, `${fnTag} arg options.connector`);
-
- const level = this.options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
- }
-
- public getOasPath() {
- return OAS.paths[
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/generate-transaction"
- ];
- }
-
- public getPath(): string {
- const apiPath = this.getOasPath();
- return apiPath.post["x-hyperledger-cacti"].http.path;
- }
-
- public getVerbLowerCase(): string {
- const apiPath = this.getOasPath();
- return apiPath.post["x-hyperledger-cacti"].http.verbLowerCase;
- }
-
- public getOperationId(): string {
- return this.getOasPath().post.operationId;
- }
-
- getAuthorizationOptionsProvider(): IAsyncProvider {
- // TODO: make this an injectable dependency in the constructor
- return {
- get: async () => ({
- isProtected: true,
- requiredRoles: [],
- }),
- };
- }
-
- public async registerExpress(
- expressApp: Express,
- ): Promise {
- await registerWebServiceEndpoint(expressApp, this);
- return this;
- }
-
- public getExpressRequestHandler(): IExpressRequestHandler {
- return this.handleRequest.bind(this);
- }
-
- public async handleRequest(req: Request, res: Response): Promise {
- const reqTag = `${this.getVerbLowerCase()} - ${this.getPath()}`;
- this.log.debug(reqTag);
-
- try {
- const txBytesU8 = this.options.connector.generateTransaction(req.body);
- const txBytesBuffer = Buffer.from(txBytesU8);
- const txBytesBase64 = txBytesBuffer.toString("base64");
- res.send(txBytesBase64);
- } catch (error) {
- this.log.error(`Crash while serving ${reqTag}:`, error);
-
- if (error instanceof Error) {
- let status = 500;
- let message = "Internal Server Error";
-
- if (error.message.includes("Bad Request")) {
- status = 400;
- message = "Bad Request Error";
- }
-
- this.log.info(`${message} [${status}]`);
- res.status(status).json({
- message,
- error: sanitizeHtml(error.stack || error.message, {
- allowedTags: [],
- allowedAttributes: {},
- }),
- });
- } else {
- this.log.warn("Unexpected exception that is not instance of Error!");
- res.status(500).json({
- message: "Unexpected Error",
- error: sanitizeHtml(safeStringify(error), {
- allowedTags: [],
- allowedAttributes: {},
- }),
- });
- }
- }
- }
-}
-
-/**
- * TODO
- * Review main plugin (not done yet)
- */
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/get-prometheus-exporter-metrics-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/get-prometheus-exporter-metrics-endpoint-v1.ts
deleted file mode 100644
index 209b8f7229..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/get-prometheus-exporter-metrics-endpoint-v1.ts
+++ /dev/null
@@ -1,96 +0,0 @@
-import type { Express, Request, Response } from "express";
-
-import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";
-
-import OAS from "../../json/openapi.json";
-
-import {
- IWebServiceEndpoint,
- IExpressRequestHandler,
- IEndpointAuthzOptions,
-} from "@hyperledger/cactus-core-api";
-
-import {
- LogLevelDesc,
- Logger,
- LoggerProvider,
- Checks,
- IAsyncProvider,
-} from "@hyperledger/cactus-common";
-
-import { PluginLedgerConnectorIroha } from "../plugin-ledger-connector-iroha";
-
-export interface IGetPrometheusExporterMetricsEndpointV1Options {
- connector: PluginLedgerConnectorIroha;
- logLevel?: LogLevelDesc;
-}
-
-export class GetPrometheusExporterMetricsEndpointV1
- implements IWebServiceEndpoint
-{
- private readonly log: Logger;
-
- constructor(
- public readonly options: IGetPrometheusExporterMetricsEndpointV1Options,
- ) {
- const fnTag = "GetPrometheusExporterMetricsEndpointV1#constructor()";
-
- Checks.truthy(options, `${fnTag} options`);
- Checks.truthy(options.connector, `${fnTag} options.connector`);
-
- const label = "get-prometheus-exporter-metrics-endpoint";
- const level = options.logLevel || "INFO";
- this.log = LoggerProvider.getOrCreate({ label, level });
- }
-
- getAuthorizationOptionsProvider(): IAsyncProvider {
- // TODO: make this an injectable dependency in the constructor
- return {
- get: async () => ({
- isProtected: true,
- requiredRoles: [],
- }),
- };
- }
-
- public getExpressRequestHandler(): IExpressRequestHandler {
- return this.handleRequest.bind(this);
- }
-
- getPath(): string {
- return OAS.paths[
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/get-prometheus-exporter-metrics"
- ].get["x-hyperledger-cacti"].http.path;
- }
-
- getVerbLowerCase(): string {
- return OAS.paths[
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/get-prometheus-exporter-metrics"
- ].get["x-hyperledger-cacti"].http.verbLowerCase;
- }
-
- public async registerExpress(
- expressApp: Express,
- ): Promise {
- await registerWebServiceEndpoint(expressApp, this);
- return this;
- }
-
- async handleRequest(req: Request, res: Response): Promise {
- const fnTag = "GetPrometheusExporterMetrics#handleRequest()";
- const verbUpper = this.getVerbLowerCase().toUpperCase();
- this.log.debug(`${verbUpper} ${this.getPath()}`);
-
- try {
- const resBody =
- await this.options.connector.getPrometheusExporterMetrics();
- res.status(200);
- res.send(resBody);
- } catch (ex) {
- this.log.error(`${fnTag} failed to serve request`, ex);
- res.status(500);
- res.statusMessage = ex.message;
- res.json({ error: ex.stack });
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/iroha-socketio-endpoint.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/iroha-socketio-endpoint.ts
deleted file mode 100644
index ba6c506163..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/iroha-socketio-endpoint.ts
+++ /dev/null
@@ -1,216 +0,0 @@
-import { Socket as SocketIoSocket } from "socket.io";
-
-import { Logger, Checks } from "@hyperledger/cactus-common";
-import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common";
-import {
- RunTransactionRequestV1,
- IrohaCommand,
- IrohaBaseConfig,
-} from "../generated/openapi/typescript-axios";
-import {
- WatchBlocksV1,
- IrohaQuery,
-} from "../generated/openapi/typescript-axios";
-
-import {
- IrohaTransactionWrapper,
- IIrohaTransactionWrapperOptions,
-} from "../iroha-transaction-wrapper";
-export interface IIrohaSocketIOEndpoint {
- logLevel?: LogLevelDesc;
- socket: SocketIoSocket;
-}
-
-export class IrohaSocketIOEndpoint {
- public static readonly CLASS_NAME = "IrohaSocketIOEndpoint";
-
- private readonly log: Logger;
- private readonly socket: SocketIoSocket;
- private transaction: IrohaTransactionWrapper;
- private currentBlockHeight: number;
- private monitorModeEnabled: boolean;
- private monitoringInterval: any;
-
- public get className(): string {
- return IrohaSocketIOEndpoint.CLASS_NAME;
- }
-
- constructor(public readonly options: IIrohaSocketIOEndpoint) {
- const fnTag = `${this.className}#constructor()`;
-
- Checks.truthy(options, `${fnTag} arg options`);
- Checks.truthy(options.socket, `${fnTag} arg options.socket`);
-
- this.socket = options.socket;
-
- const level = this.options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
-
- const irohaOptions: IIrohaTransactionWrapperOptions = { logLevel: level };
- this.transaction = new IrohaTransactionWrapper(irohaOptions);
- this.currentBlockHeight = 1;
- this.monitorModeEnabled = false;
- }
-
- private createRequestBody(
- config: IrohaBaseConfig,
- methodName: string,
- params: Array,
- ): RunTransactionRequestV1 {
- if (this.monitorModeEnabled === true) {
- config.monitorModeEnabled = this.monitorModeEnabled;
- }
- const requestBody = {
- commandName: methodName,
- params: params,
- baseConfig: config,
- };
- return requestBody;
- }
-
- private isLastBlockDetected(irohaResponse: unknown) {
- const irohaResponseStr = JSON.stringify(irohaResponse).replace(/\\/g, "");
- const responseMatch = irohaResponseStr.match(/Reason: ({.*?})/);
- if (!responseMatch || !responseMatch[1]) {
- this.log.debug(
- "Could not match error reason in response:",
- irohaResponseStr,
- );
- return false;
- }
-
- const responseObject = JSON.parse(responseMatch[1]);
- if (!responseObject) {
- this.log.debug(
- "Could not parse error object in response:",
- irohaResponseStr,
- );
- return false;
- }
-
- if (responseObject.reason === 1 && responseObject.errorCode === 3) {
- this.log.info(`Initial max block height is: ${this.currentBlockHeight}`);
- return true;
- } else {
- throw responseObject;
- }
- }
-
- private async getInitialMaxBlockHeight(requestData: any): Promise {
- this.log.debug("Checking max block height...");
- const methodName: string = IrohaQuery.GetBlock;
-
- let args: Array;
- let requestBody: RunTransactionRequestV1;
-
- try {
- while (true) {
- args = [this.currentBlockHeight];
-
- requestBody = this.createRequestBody(requestData, methodName, args);
- this.log.debug(`Iroha requestBody: ${requestBody}`);
- const response = await this.transaction.transact(requestBody);
- if (this.isLastBlockDetected(response.transactionReceipt)) {
- break;
- }
- this.currentBlockHeight++;
- }
- } catch (error) {
- if (!this.isLastBlockDetected(error)) {
- throw error;
- }
- }
- }
-
- private async monitoringRoutine(baseConfig: any) {
- try {
- const args = [this.currentBlockHeight];
- const methodName: string = IrohaQuery.GetBlock;
- this.log.debug(`Current block: ${this.currentBlockHeight}`);
-
- const requestBody = this.createRequestBody(baseConfig, methodName, args);
- const response = await this.transaction.transact(requestBody);
-
- if (this.isLastBlockDetected(response.transactionReceipt)) {
- this.log.debug("Waiting for new blocks...");
- } else {
- this.log.debug(`New block found`);
- const transactionReceipt = response.transactionReceipt;
- const next = { transactionReceipt };
- this.socket.emit(WatchBlocksV1.Next, next);
- this.currentBlockHeight++;
- }
- } catch (error) {
- if (this.isLastBlockDetected(error)) {
- this.log.debug("Waiting for new blocks...");
- } else {
- throw error;
- }
- }
- }
-
- public async startMonitor(monitorOptions: any): Promise {
- this.log.debug(`${WatchBlocksV1.Subscribe} => ${this.socket.id}`);
- this.log.info(`Starting monitoring blocks...`);
-
- this.monitorModeEnabled = true;
- await this.getInitialMaxBlockHeight(monitorOptions.baseConfig);
-
- this.monitoringInterval = setInterval(() => {
- this.monitoringRoutine(monitorOptions.baseConfig);
- }, monitorOptions.pollTime);
- }
-
- private async validateMethodName(methodName: string): Promise {
- let isValidMethod = false;
-
- if (Object.values(IrohaQuery as any).includes(methodName)) {
- this.log.debug(`Method name: ${methodName} (IrohaQuery) is valid`);
- isValidMethod = true;
- }
- if (Object.values(IrohaCommand as any).includes(methodName)) {
- this.log.debug(`Method name: ${methodName} (IrohaCommand) is valid`);
- isValidMethod = true;
- }
- return isValidMethod;
- }
-
- public async stopMonitor(): Promise {
- this.log.info(`Stopping monitor...`);
- this.monitorModeEnabled = false;
- clearInterval(this.monitoringInterval);
- }
-
- public async sendRequest(requestData: any, async: boolean) {
- this.log.debug(`Inside ##sendRequest(), async = ${async}`);
- this.log.debug(`requestData: ${JSON.stringify(requestData, null, 4)}`);
-
- this.log.debug(requestData.methodName);
- this.log.debug(requestData.args);
- this.log.debug(requestData.baseConfig);
-
- if ((await this.validateMethodName(requestData.methodName)) === true) {
- const requestBody = this.createRequestBody(
- requestData.baseConfig,
- requestData.methodName,
- requestData.args,
- );
-
- const response = await this.transaction.transact(requestBody);
- this.log.debug(response);
- if (async) {
- return response;
- } else {
- try {
- this.socket.emit("response", response.transactionReceipt);
- } catch (err: unknown) {
- this.socket.emit("error", err);
- }
- }
- } else {
- const error = `Unrecognized method name: ${requestData.methodName}`;
- this.log.debug(error);
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/run-transaction-endpoint.ts b/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/run-transaction-endpoint.ts
deleted file mode 100644
index 3de6059ebd..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/main/typescript/web-services/run-transaction-endpoint.ts
+++ /dev/null
@@ -1,119 +0,0 @@
-import type { Express, Request, Response } from "express";
-
-import {
- Logger,
- Checks,
- LogLevelDesc,
- LoggerProvider,
- IAsyncProvider,
- Http405NotAllowedError,
-} from "@hyperledger/cactus-common";
-import {
- IEndpointAuthzOptions,
- IExpressRequestHandler,
- IWebServiceEndpoint,
-} from "@hyperledger/cactus-core-api";
-import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";
-
-import { PluginLedgerConnectorIroha } from "../plugin-ledger-connector-iroha";
-
-import OAS from "../../json/openapi.json";
-
-export interface IRunTransactionEndpointOptions {
- logLevel?: LogLevelDesc;
- connector: PluginLedgerConnectorIroha;
-}
-
-export class RunTransactionEndpoint implements IWebServiceEndpoint {
- public static readonly CLASS_NAME = "RunTransactionEndpoint";
-
- private readonly log: Logger;
-
- public get className(): string {
- return RunTransactionEndpoint.CLASS_NAME;
- }
-
- constructor(public readonly options: IRunTransactionEndpointOptions) {
- const fnTag = `${this.className}#constructor()`;
- Checks.truthy(options, `${fnTag} arg options`);
- Checks.truthy(options.connector, `${fnTag} arg options.connector`);
-
- const level = this.options.logLevel || "INFO";
- const label = this.className;
- this.log = LoggerProvider.getOrCreate({ level, label });
- }
-
- public getOasPath() {
- return OAS.paths[
- "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha/run-transaction"
- ];
- }
-
- public getPath(): string {
- const apiPath = this.getOasPath();
- return apiPath.post["x-hyperledger-cacti"].http.path;
- }
-
- public getVerbLowerCase(): string {
- const apiPath = this.getOasPath();
- return apiPath.post["x-hyperledger-cacti"].http.verbLowerCase;
- }
-
- public getOperationId(): string {
- return this.getOasPath().post.operationId;
- }
-
- getAuthorizationOptionsProvider(): IAsyncProvider {
- // TODO: make this an injectable dependency in the constructor
- return {
- get: async () => ({
- isProtected: true,
- requiredRoles: [],
- }),
- };
- }
-
- public async registerExpress(
- expressApp: Express,
- ): Promise {
- await registerWebServiceEndpoint(expressApp, this);
- return this;
- }
-
- public getExpressRequestHandler(): IExpressRequestHandler {
- return this.handleRequest.bind(this);
- }
-
- public async handleRequest(req: Request, res: Response): Promise {
- const reqTag = `${this.getVerbLowerCase()} - ${this.getPath()}`;
- this.log.debug(reqTag);
- const reqBody = req.body;
- try {
- const resBody = await this.options.connector.transact(reqBody);
- res.json(resBody);
- } catch (ex) {
- if (ex instanceof Http405NotAllowedError) {
- this.log.debug("Sending back HTTP405 Method Not Allowed error.");
- res.status(405);
- res.json(ex);
- return;
- }
- /**
- * An example output of the error message looks like:
- * "Error: Error: Command response error: expected=COMMITTED, actual=REJECTED"
- * @see https://iroha.readthedocs.io/en/main/develop/api/commands.html?highlight=CallEngine#id18
- */
- if (ex.message.includes("Error: Command response error")) {
- this.log.debug("Sending back HTTP400 Bad Request error.");
- res.status(400);
- res.json(ex);
- return;
- }
- this.log.error(`Crash while serving ${reqTag}`, ex);
- res.status(500).json({
- message: "Internal Server Error",
- error: ex?.stack || ex?.message,
- });
- }
- }
-}
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/api-surface.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/api-surface.test.ts
deleted file mode 100644
index 34aba3a0ae..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/api-surface.test.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import * as apiSurface from "../../../main/typescript/public-api";
-import "jest-extended";
-
-test("Library can be loaded", async () => {
- expect(apiSurface).toBeTruthy();
-});
diff --git a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/generate-and-send-signed-transaction.test.ts b/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/generate-and-send-signed-transaction.test.ts
deleted file mode 100644
index 77c8041455..0000000000
--- a/packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/integration/generate-and-send-signed-transaction.test.ts
+++ /dev/null
@@ -1,410 +0,0 @@
-/**
- * Test sending transactions signed on the BLP (client) side.
- * No private keys are shared with the connector in this scenario.
- * Test suite contains simple sanity check of regular transaction call as well.
- */
-
-//////////////////////////////////
-// Constants
-//////////////////////////////////
-
-import { IROHA_TEST_LEDGER_DEFAULT_OPTIONS } from "@hyperledger/cactus-test-tooling";
-
-// Ledger settings
-const ledgerImageName = "ghcr.io/hyperledger/cactus-iroha-all-in-one";
-const ledgerImageVersion = IROHA_TEST_LEDGER_DEFAULT_OPTIONS.imageVersion;
-const postgresImageName = "postgres";
-const postgresImageVersion = "9.5-alpine";
-
-// Log settings
-const testLogLevel: LogLevelDesc = "info"; // default: info
-const sutLogLevel: LogLevelDesc = "info"; // default: info
-
-import {
- PostgresTestContainer,
- IrohaTestLedger,
- pruneDockerAllIfGithubAction,
-} from "@hyperledger/cactus-test-tooling";
-
-import {
- LogLevelDesc,
- LoggerProvider,
- Logger,
- Servers,
-} from "@hyperledger/cactus-common";
-
-import { PluginRegistry } from "@hyperledger/cactus-core";
-
-import { PluginImportType, Configuration } from "@hyperledger/cactus-core-api";
-
-import http from "http";
-import express from "express";
-import bodyParser from "body-parser";
-import { AddressInfo } from "net";
-import { v4 as uuidv4 } from "uuid";
-import { v4 as internalIpV4 } from "internal-ip";
-import "jest-extended";
-
-import cryptoHelper from "iroha-helpers/lib/cryptoHelper";
-
-import {
- PluginLedgerConnectorIroha,
- DefaultApi as IrohaApi,
- PluginFactoryLedgerConnector,
- signIrohaTransaction,
-} from "../../../main/typescript/public-api";
-
-import {
- IrohaCommand,
- IrohaQuery,
-} from "../../../main/typescript/generated/openapi/typescript-axios";
-
-// Logger setup
-const log: Logger = LoggerProvider.getOrCreate({
- label: "generate-and-send-signed-transaction.test",
- level: testLogLevel,
-});
-
-/**
- * Main test suite
- */
-describe("Generate and send signed transaction tests", () => {
- let postgresContainer: PostgresTestContainer;
- let adminKeyPair: {
- publicKey: string;
- privateKey: string;
- };
- let irohaLedger: IrohaTestLedger;
- let irohaConnector: PluginLedgerConnectorIroha;
- let irohaLedgerHost: string;
- let irohaLedgerPort: number;
- let irohaAdminID: string;
- let connectorServer: http.Server;
- let apiClient: IrohaApi;
-
- //////////////////////////////////
- // Environment Setup
- //////////////////////////////////
-
- beforeAll(async () => {
- log.info("Prune Docker...");
- await pruneDockerAllIfGithubAction({ logLevel: testLogLevel });
-
- log.info("Run PostgresTestContainer...");
- postgresContainer = new PostgresTestContainer({
- imageName: postgresImageName,
- imageVersion: postgresImageVersion,
- logLevel: testLogLevel,
- });
- await postgresContainer.start();
- const postgresHost = (await internalIpV4()) as string;
- const postgresPort = await postgresContainer.getPostgresPort();
- expect(postgresHost).toBeTruthy();
- expect(postgresPort).toBeTruthy();
- log.info(`Postgres running at ${postgresHost}:${postgresPort}`);
-
- log.info("Generate key pairs...");
- adminKeyPair = cryptoHelper.generateKeyPair();
- const nodeKeyPair = cryptoHelper.generateKeyPair();
-
- log.info("Run IrohaTestLedger...");
- irohaLedger = new IrohaTestLedger({
- imageName: ledgerImageName,
- imageVersion: ledgerImageVersion,
- adminPriv: adminKeyPair.privateKey,
- adminPub: adminKeyPair.publicKey,
- nodePriv: nodeKeyPair.privateKey,
- nodePub: nodeKeyPair.publicKey,
- postgresHost: postgresHost,
- postgresPort: postgresPort,
- logLevel: testLogLevel,
- });
- await irohaLedger.start();
- irohaLedgerHost = (await internalIpV4()) as string;
- expect(irohaLedgerHost).toBeTruthy();
- irohaLedgerPort = await irohaLedger.getRpcToriiPort();
- expect(irohaLedgerPort).toBeTruthy();
- const rpcToriiPortHost = await irohaLedger.getRpcToriiPortHost();
- expect(rpcToriiPortHost).toBeTruthy();
- const admin = irohaLedger.getDefaultAdminAccount();
- expect(admin).toBeTruthy();
- const domain = irohaLedger.getDefaultDomain();
- expect(domain).toBeTruthy();
- irohaAdminID = `${admin}@${domain}`;
- log.info(
- "IrohaTestLedger RPC host:",
- rpcToriiPortHost,
- "irohaAdminID:",
- irohaAdminID,
- );
-
- log.info("Create iroha connector...");
- const expressApp = express();
- expressApp.use(bodyParser.json({ limit: "250mb" }));
- connectorServer = http.createServer(expressApp);
- const listenOptions = {
- hostname: "127.0.0.1",
- port: 0,
- server: connectorServer,
- };
- const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo;
- const { address, port } = addressInfo;
-
- const factory = new PluginFactoryLedgerConnector({
- pluginImportType: PluginImportType.Local,
- });
-
- irohaConnector = await factory.create({
- rpcToriiPortHost,
- instanceId: uuidv4(),
- pluginRegistry: new PluginRegistry(),
- logLevel: sutLogLevel,
- });
- await irohaConnector.getOrCreateWebServices();
- await irohaConnector.registerWebServices(expressApp);
- log.info(`Iroha connector is running at ${address}:${port}`);
-
- log.info("Create iroha ApiClient...");
- const apiHost = `http://${address}:${port}`;
- const apiConfig = new Configuration({ basePath: apiHost });
- apiClient = new IrohaApi(apiConfig);
- });
-
- afterAll(async () => {
- log.info("FINISHING THE TESTS");
-
- if (connectorServer) {
- log.info("Stop the iroha connector...");
- await Servers.shutdown(connectorServer);
- }
-
- if (irohaLedger) {
- log.info("Stop iroha ledger...");
- await irohaLedger.stop();
- }
-
- if (postgresContainer) {
- log.info("Stop iroha postgres container...");
- await postgresContainer.stop();
- }
-
- log.info("Prune Docker...");
- await pruneDockerAllIfGithubAction({ logLevel: testLogLevel });
- });
-
- //////////////////////////////////
- // Test Helpers
- //////////////////////////////////
-
- /**
- * Read iroha account details and check if valid response was received.
- * @param accountID account to fetch.
- * @returns getAccount command response.
- */
- async function getAccountInfo(accountID: string) {
- log.debug("Get account info with ID", accountID);
-
- const getAccReq = {
- commandName: IrohaQuery.GetAccount,
- baseConfig: {
- irohaHost: irohaLedgerHost,
- irohaPort: irohaLedgerPort,
- creatorAccountId: irohaAdminID,
- privKey: [adminKeyPair.privateKey],
- quorum: 1,
- timeoutLimit: 5000,
- tls: false,
- },
- params: [accountID],
- };
-
- const getAccResponse = await apiClient.runTransactionV1(getAccReq);
- expect(getAccResponse).toBeTruthy();
- expect(getAccResponse.data).toBeTruthy();
- expect(getAccResponse.status).toEqual(200);
-
- return getAccResponse;
- }
-
- //////////////////////////////////
- // Tests
- //////////////////////////////////
-
- /**
- * Check if creating an account with regular transaction works well.
- * This test sends private key to the connector to sign the transaction,
- * and then reads new account details to confirm it was created.
- */
- test("Sanity check if regular create account transaction works", async () => {
- const username = "usersanity" + uuidv4().substring(0, 5);
- const defaultDomain = irohaLedger.getDefaultDomain();
- const userKeyPair = cryptoHelper.generateKeyPair();
- const userID = `${username}@${defaultDomain}`;
-
- // 1. Create
- log.debug("Create user with ID", userID);
- const createAccReq = {
- commandName: IrohaCommand.CreateAccount,
- baseConfig: {
- irohaHost: irohaLedgerHost,
- irohaPort: irohaLedgerPort,
- creatorAccountId: irohaAdminID,
- privKey: [adminKeyPair.privateKey],
- quorum: 1,
- timeoutLimit: 5000,
- tls: false,
- },
- params: [username, defaultDomain, userKeyPair.publicKey],
- };
- const createAccResponse = await apiClient.runTransactionV1(createAccReq);
- expect(createAccResponse).toBeTruthy();
- expect(createAccResponse.data).toBeTruthy();
- expect(createAccResponse.status).toEqual(200);
- expect(createAccResponse.data.transactionReceipt.status[0]).toEqual(
- "COMMITTED",
- );
-
- // 2. Confirm
- const getAccResponse = await getAccountInfo(userID);
- expect(getAccResponse.data.transactionReceipt).toEqual({
- accountId: userID,
- domainId: defaultDomain,
- quorum: 1,
- jsonData: "{}",
- });
- });
-
- /**
- * Create new account without sharing the private key with the connector.
- * This test will first generate the unsigned transaction, use util function from connector package
- * to sign the transaction, and finally send the signed transaction.
- * Private key is not shared with the connector.
- * New account details are read to confirm it was created and committed correctly.
- */
- test("Sign transaction on the client (BLP) side", async () => {
- const username = "user" + uuidv4().substring(0, 5);
- const defaultDomain = irohaLedger.getDefaultDomain();
- const userKeyPair = cryptoHelper.generateKeyPair();
- const userID = `${username}@${defaultDomain}`;
-
- // Generate transaction
- log.info("Call generateTransactionV1 to get unsigned transaction.");
- const genTxResponse = await apiClient.generateTransactionV1({
- commandName: IrohaCommand.CreateAccount,
- commandParams: {
- accountName: username,
- domainId: defaultDomain,
- publicKey: userKeyPair.publicKey,
- },
- creatorAccountId: irohaAdminID,
- quorum: 1,
- });
- expect(genTxResponse).toBeTruthy();
- expect(genTxResponse.data).toBeTruthy();
- expect(genTxResponse.status).toEqual(200);
-
- const genTxResponseDataBuffer = Buffer.from(genTxResponse.data, "base64");
- const unsignedTransaction = Uint8Array.from(genTxResponseDataBuffer);
- expect(unsignedTransaction).toBeTruthy();
- log.info("Received unsigned transcation");
- log.debug("unsignedTransaction:", unsignedTransaction);
-
- // Sign
- const signedTransaction = signIrohaTransaction(
- unsignedTransaction,
- adminKeyPair.privateKey,
- );
- expect(signedTransaction).toBeTruthy();
- log.info("Transaction signed with local private key");
- log.debug("signedTx:", signedTransaction);
-
- const signedTxB64 = Buffer.from(signedTransaction).toString("base64");
-
- // Send
- const sendTransactionResponse = await apiClient.runTransactionV1({
- signedTransaction: signedTxB64,
- baseConfig: {
- irohaHost: irohaLedgerHost,
- irohaPort: irohaLedgerPort,
- timeoutLimit: 5000,
- tls: false,
- },
- });
- expect(sendTransactionResponse).toBeTruthy();
- expect(sendTransactionResponse.status).toEqual(200);
- expect(sendTransactionResponse.data).toBeTruthy();
- expect(sendTransactionResponse.data.transactionReceipt).toBeTruthy();
- expect(sendTransactionResponse.data.transactionReceipt.txHash).toBeTruthy();
- expect(sendTransactionResponse.data.transactionReceipt.status[0]).toEqual(
- "COMMITTED",
- );
-
- // 3. Confirm
- const getAccResponse = await getAccountInfo(userID);
- expect(getAccResponse.data.transactionReceipt).toEqual({
- accountId: userID,
- domainId: defaultDomain,
- quorum: 1,
- jsonData: "{}",
- });
- });
-
- /**
- * Check if exceptions thrown by generateTransactionV1 are properly serialized
- * and sanitized, so that response message doesn't contain any malicious data.
- */
- test("generateTransactionV1 error responses check", async () => {
- const username = "user" + uuidv4().substring(0, 5);
- const defaultDomain = irohaLedger.getDefaultDomain();
- const userKeyPair = cryptoHelper.generateKeyPair();
-
- // Bad Request Error
- try {
- log.info(
- "Call generateTransactionV1 with invalid command name - should fail.",
- );
- await apiClient.generateTransactionV1({
- commandName:
- "MaliciousError " as any,
- commandParams: {
- accountName: username,
- domainId: defaultDomain,
- publicKey: userKeyPair.publicKey,
- },
- creatorAccountId: irohaAdminID,
- quorum: 1,
- });
- expect(true).toBeFalse(); // Should always fail
- } catch (error: any) {
- const errorResponse = error.response;
- expect(errorResponse).toBeTruthy();
- expect(errorResponse.status).toEqual(400);
- expect(errorResponse.data).toBeTruthy();
- expect(errorResponse.data.message).toBeTruthy();
- expect(errorResponse.data.error).toBeTruthy();
- // HTML should be escaped from the response message
- expect(errorResponse.data.message).not.toContain("