diff --git a/.cspell.json b/.cspell.json index 764005c2c6..a80eac2447 100644 --- a/.cspell.json +++ b/.cspell.json @@ -261,6 +261,18 @@ ,"adress" ,"NFToken" ,"NFT" + ,"FabricProto" + ,"bnum" + ,"Requestby" + ,"ecies" + ,"ECIESKDF" + ,"kbuf" + ,"sjcl" + ,"ECIES" + ,"driverdbs" + ,"driverdb" + ,"fabproto" + ,"unsubscription" ], "dictionaries": [ "typescript,node,npm,go,rust" diff --git a/.github/workflows/ci_weaver.yaml b/.github/workflows/ci_weaver.yaml index 5dba3cc52b..7e338da35e 100644 --- a/.github/workflows/ci_weaver.yaml +++ b/.github/workflows/ci_weaver.yaml @@ -27,7 +27,7 @@ jobs: asset-transfer: with: run_all: $RUN_ALL - uses: ./.github/workflows/test_weaver-asset-transfer.yaml + uses: ./.github/workflows/test_weaver-asset-transfer.yaml ./.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml relay: with: run_all: $RUN_ALL @@ -47,7 +47,7 @@ jobs: data-sharing: with: run_all: $RUN_ALL - uses: ./.github/workflows/test_weaver-data-sharing.yaml + uses: ./.github/workflows/test_weaver-data-sharing.yaml ./.github/workflows/test_weaver-data-sharing-fabric-connector.yaml node-pkgs: with: run_all: $RUN_ALL diff --git a/.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml b/.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml new file mode 100644 index 0000000000..fff9963eff --- /dev/null +++ b/.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml @@ -0,0 +1,725 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: CC-BY-4.0 + +# This is a basic workflow to help you get started with Actions + +name: Test Asset Transfer Using Fabric Connector as a Fabric Driver + +env: + NODEJS_VERSION: v22.18.0 + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + workflow_call: + inputs: + run_all: + required: true + type: string + +concurrency: + group: asset-transfer-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + check_code_changed: + outputs: + status: ${{ steps.changes.outputs.weaver_code_changed }} + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 #v2.11.1 + id: changes + with: + filters: | + weaver_code_changed: + - './weaver/**' + - '.github/workflows/test_weaver-asset-transfer.yaml' + - './packages/cactus-plugin-ledger-connector-fabric/**' + + asset-transfer-local-fabric-connector: + needs: check_code_changed + if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true' + # if: ${{ false }} + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + + - name: Set up JDK 17 + uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 #v3.11.0 + with: + java-version: '17' + distribution: 'adopt' + + - name: Set up Go + uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 #v4.0.0 + with: + go-version: '1.20.2' + + - name: Use Node.js ${{ env.NODEJS_VERSION }} + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b #v4.0.3 + with: + node-version: ${{ env.NODEJS_VERSION }} + + - name: Install RUST Toolchain minimal stable with clippy and rustfmt + uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + + - name: Get Latest Relay Dependencies + run: | + make protos-local + cargo update -p nom + cargo update -p lexical-core + working-directory: weaver/core/relay + + - name: Use Protoc 3.15 + run: | + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip + unzip protoc-3.15.6-linux-x86_64.zip -d protoc + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4.0 + + # PROTOS + - name: Build GO Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-go + + # PROTOS + - name: Build JS Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-js + + - name: Build Java Protos + run: make build + working-directory: weaver/common/protos-java-kt + + # Build Dependencies + - name: Build Corda Interop App + run: make build-local + working-directory: weaver/core/network/corda-interop-app + + - name: Build Corda Interop SDK + run: make build + working-directory: weaver/sdks/corda + + - name: Build Corda SimpleApplication + run: make build-local + working-directory: weaver/samples/corda/corda-simple-application + + - name: Build Fabric Interop SDK + run: make build-local + working-directory: weaver/sdks/fabric/interoperation-node-sdk + + - name: Build Fabric CLI + run: make build-local + working-directory: weaver/samples/fabric/fabric-cli + + - name: Build Relay + run: make + working-directory: weaver/core/relay + + - name: Build Fabric Driver + run: make build-local + working-directory: weaver/core/drivers/fabric-driver + + - name: Build IIN Agent + run: make build-local + working-directory: weaver/core/identity-management/iin-agent + + - name: Build Corda Driver + run: make build-local + working-directory: weaver/core/drivers/corda-driver + + # CORDA NETWORK + - name: Start Corda Network + run: make start-local &> corda-net.out & + working-directory: weaver/tests/network-setups/corda + + # FABRIC NETWORK + + - name: Start Fabric Network + run: make start-interop-local CHAINCODE_NAME=simpleassettransfer + working-directory: weaver/tests/network-setups/fabric/dev + + - name: Corda Network logs + run: | + cat tests/network-setups/corda/corda-net.out + docker logs corda_partya_1 + docker logs corda_network2_partya_1 + working-directory: weaver + + # RELAY + - name: Start Relay for network1 + run: RELAY_CONFIG=config/Fabric_Relay.toml cargo run --bin server &> relay-n1.out & + working-directory: weaver/core/relay + + - name: Start Relay for network2 + run: RELAY_CONFIG=config/Fabric_Relay2.toml cargo run --bin server &> relay-n2.out & + working-directory: weaver/core/relay + + - name: Start Relay for Corda_Network + run: RELAY_CONFIG=config/Corda_Relay.toml cargo run --bin server &> relay-corda.out & + working-directory: weaver/core/relay + + - name: Start Relay for Corda_Network2 + run: RELAY_CONFIG=config/Corda_Relay2.toml cargo run --bin server &> relay-corda2.out & + working-directory: weaver/core/relay + + # FABRIC DRIVER + - name: Setup Fabric Driver .env + run: | + cp .env.template .env + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network1/peerOrganizations/org1.network1.com/connection-org1.json + sed -i "s#path_to_connection_profile#${CCP_PATH}#g" .env + working-directory: packages/cactus-plugin-ledger-connector-fabric + + - name: Start Fabric Driver for network1 + run: yarn start-fabric-weaver-driver &> fdriver-n1.out & + working-directory: packages/cactus-plugin-ledger-connector-fabric + + - name: Start Fabric Driver for network2 + run: CONNECTION_PROFILE=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network2/peerOrganizations/org1.network2.com/connection-org1.json NETWORK_NAME=network2 RELAY_ENDPOINT=localhost:9083 DRIVER_ENDPOINT=localhost:9095 yarn start-fabric-weaver-driver &> fdriver-n2.out & + working-directory: packages/cactus-plugin-ledger-connector-fabric + + # IIN AGENT + - name: Setup Fabric IIN Config + run: | + # FABRIC CONFIG + cp src/fabric-ledger/config.json.template src/fabric-ledger/config-n1.json + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network1/peerOrganizations/org1.network1.com/connection-org1.json + sed -i "s##${CCP_PATH}#g" src/fabric-ledger/config-n1.json + cat src/fabric-ledger/config-n1.json + cp src/fabric-ledger/config.json.template src/fabric-ledger/config-n2.json + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network2/peerOrganizations/org1.network2.com/connection-org1.json + sed -i "s##${CCP_PATH}#g" src/fabric-ledger/config-n2.json + cat src/fabric-ledger/config-n2.json + # DNS CONFIG + sed -i "s#iin-agent-Org1MSP-network1#localhost#g" docker-testnet/configs/dnsconfig.json + sed -i "s#iin-agent-Org1MSP-network2#localhost#g" docker-testnet/configs/dnsconfig.json + cat docker-testnet/configs/dnsconfig.json + working-directory: weaver/core/identity-management/iin-agent + + - name: Setup Fabric IIN Env + run: | + cp .env.template .env + sed -i "s##Org1MSP#g" .env + sed -i "s#^DLT_TYPE=.*#DLT_TYPE=fabric#g" .env + sed -i "s##interop#g" .env + sed -i "s#^DNS_CONFIG_PATH=#DNS_CONFIG_PATH=./docker-testnet/configs/dnsconfig.json#g" .env + sed -i "s#^SECURITY_DOMAIN_CONFIG_PATH=#SECURITY_DOMAIN_CONFIG_PATH=./docker-testnet/configs/security-domain-config.json#g" .env + sed -i "s#^CONFIG_PATH=#CONFIG_PATH=./src/fabric-ledger/config-n1.json#g" .env + sed -i "s#^AUTO_SYNC=#AUTO_SYNC=false#g" .env + cat .env + working-directory: weaver/core/identity-management/iin-agent + + - name: Start Fabric IIN Agent for network1 + run: npm run dev &> iinagent-n1.out & + working-directory: weaver/core/identity-management/iin-agent + + - name: Start Fabric IIN Agent for network2 + run: IIN_AGENT_ENDPOINT=localhost:9501 SECURITY_DOMAIN=network2 CONFIG_PATH=./src/fabric-ledger/config-n2.json npm run dev &> iinagent-n2.out & + working-directory: weaver/core/identity-management/iin-agent + + # CORDA DRIVER + - name: Start Corda_Network Driver + run: ./build/install/driver-corda/bin/driver-corda &> corda-driver.out & + working-directory: weaver/core/drivers/corda-driver + + - name: Start Corda_Network2 Driver + run: DRIVER_PORT=9098 ./build/install/driver-corda/bin/driver-corda &> corda2-driver.out & + working-directory: weaver/core/drivers/corda-driver + + # FABRIC CLI + - name: Setup Fabric CLI ENV + run: | + echo ${GITHUB_WORKSPACE} + cp .env.template .env + ./bin/fabric-cli env set-file ./.env + ./bin/fabric-cli env set MEMBER_CREDENTIAL_FOLDER ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/src/data/credentials + ./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/config.json + ./bin/fabric-cli env set DEFAULT_APPLICATION_CHAINCODE simpleassettransfer + ./bin/fabric-cli env set REMOTE_CONFIG_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/remote-network-config.json + ./bin/fabric-cli env set CHAINCODE_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/chaincode.json + cat .env + working-directory: weaver/samples/fabric/fabric-cli + + - name: Setup Fabric CLI Config + run: | + echo ${GITHUB_WORKSPACE} + cp config.template.json config.json + sed -i "s##${GITHUB_WORKSPACE}/weaver#g" config.json + ###### Change line number in following commands if config is modified ##### + ./bin/fabric-cli config set network2 aclPolicyPrincipalType ca + ./bin/fabric-cli config set network1 chaincode simpleassettransfer + ./bin/fabric-cli config set network2 chaincode simpleassettransfer + cp chaincode.json.template chaincode.json + cp remote-network-config.json.template remote-network-config.json + working-directory: weaver/samples/fabric/fabric-cli + + + - name: Fabric CLI Init + run: | + ./bin/fabric-cli configure create all --local-network=network1 + ./bin/fabric-cli configure create all --local-network=network2 + ./bin/fabric-cli configure network --local-network=network1 + ./bin/fabric-cli configure network --local-network=network2 + ./scripts/initAssetsForTransfer.sh + working-directory: weaver/samples/fabric/fabric-cli + + - name: Fabric Sync Membership using IIN Agent + run: | + ./bin/fabric-cli configure membership --local-network=network1 --target-network=network2 --iin-agent-endpoint=localhost:9500 + sleep 10 + tail -10 ../../../core/identity-management/iin-agent/iinagent-n1.out + ./bin/fabric-cli configure membership --local-network=network2 --target-network=network1 --iin-agent-endpoint=localhost:9501 + sleep 10 + tail -10 ../../../core/identity-management/iin-agent/iinagent-n2.out + working-directory: weaver/samples/fabric/fabric-cli + + # CORDA CLIENT + - name: Corda CLI Setup + run: | + cp remote-network-config.json.template remote-network-config.json + working-directory: weaver/samples/corda/corda-simple-application/clients/src/main/resources/config + + - name: Corda CLI Initialize Vault + run: make initialise-vault-asset-transfer + working-directory: weaver/samples/corda/corda-simple-application + + - name: Asset Transfer Corda Client Tests + run: | + COUNT=0 + TOTAL=9 + + # Issue t1:5 tokens to partyA + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients issue-asset-state 5 t1 1> tmp.out + cat tmp.out | grep "AssetState(quantity=5, tokenType=t1, owner=O=PartyA" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # CORDA2-CORDA + # Pledge Asset + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer pledge-asset --fungible --timeout="3600" --import-network-id='Corda_Network2' --recipient='O=PartyA, L=London, C=GB' --param='t1:5' 1> tmp.out + cat tmp.out | grep "AssetPledgeState created with pledge-id" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + PID=$(cat tmp.out | grep "AssetPledgeState created with pledge-id " | awk -F "'" '{print $2}') + + # Is Asset Pledged + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer is-asset-pledged -pid $PID 1> tmp.out + cat tmp.out | grep "Is asset pledged for transfer response: true" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # Claim Remote Asset + NETWORK_NAME='Corda_Network2' CORDA_PORT=30006 ./clients/build/install/clients/bin/clients transfer claim-remote-asset --pledge-id=$PID --locker='O=PartyA, L=London, C=GB' --transfer-category='token.corda' --export-network-id='Corda_Network' --param='t1:5' --import-relay-address='localhost:9082' 1> tmp.out + cat tmp.out | grep "Pledged asset claim response: Right(b=SignedTransaction(id=" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients get-asset-states-by-type t1 1> tmp.out + cat tmp.out | grep "\[\]" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + CORDA_PORT=30006 ./clients/build/install/clients/bin/clients get-asset-states-by-type t1 1> tmp.out + cat tmp.out | grep "AssetState(quantity=5, tokenType=t1, owner=O=PartyA, L=London, C=GB, " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # CORDA-CORDA2 + + # Issue and Pledge t2:5 tokens + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients issue-asset-state 5 t2 1> tmp.out + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer pledge-asset --fungible --timeout="20" --import-network-id='Corda_Network2' --recipient='O=PartyA, L=London, C=GB' --param='t2:5' 1> tmp.out + PID=$(cat tmp.out | grep "AssetPledgeState created with pledge-id " | awk -F "'" '{print $2}') + sleep 20 + + # Is Asset Pledged + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer is-asset-pledged -pid $PID 1> tmp.out + cat tmp.out | grep "Is asset pledged for transfer response: false" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + NETWORK_NAME=Corda_Network CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer reclaim-pledged-asset --pledge-id=$PID --export-relay-address='localhost:9081' --transfer-category='token.corda' --import-network-id='Corda_Network2' --param='t2:5' 1> tmp.out + cat tmp.out | grep "Pledged Asset Reclaim Response: Right(b=SignedTransaction(id=" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients get-asset-states-by-type t2 1> tmp.out + cat tmp.out | grep "AssetState(quantity=5, tokenType=t2, owner=O=PartyA, L=London, C=GB, " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/corda/corda-simple-application + + # FABRIC CLI + - name: Asset Transfer Fabric CLI Non-Fungible Tests + run: | + COUNT=0 + TOTAL=8 + + # FABRIC2 - FABRIC1 + ./bin/fabric-cli asset transfer pledge --source-network=network1 --dest-network=network2 --recipient=bob --expiry-secs=3600 --type=bond --ref=a03 --data-file=src/data/assetsForTransfer.json &> tmp.out + tail -n 1 tmp.out | grep "Asset pledged with ID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + + # FABRIC1 - FABRIC2 + ./bin/fabric-cli asset transfer claim --source-network=network1 --dest-network=network2 --user=bob --owner=alice --type=bond.fabric --pledge-id=$CID --param=bond01:a03 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ClaimRemoteAsset. With Args: $CID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer ReadAsset '["bond01","a03"]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Error: the asset a03 does not exist" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=bob mychannel simpleassettransfer ReadAsset '["bond01","a03"]' --local-network=network2 &> tmp.out + #tail -n 1 tmp.out | grep "Result from network query: {\"type\":\"bond01\",\"id\":\"a03\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | tr '\n' ' ' | grep "Result from network query: { \"type\": \"bond01\", \"id\": \"a03\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli asset transfer pledge --source-network=network1 --dest-network=network2 --recipient=bob --expiry-secs=20 --type=bond --ref=a04 --data-file=src/data/assetsForTransfer.json &> tmp.out + cat tmp.out + + CID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + sleep 20 + + ./bin/fabric-cli asset transfer claim --source-network=network1 --dest-network=network2 --user=bob --owner=alice --type=bond.fabric --pledge-id=$CID --param=bond01:a04 &> tmp.out + tail -n 1 tmp.out | grep "cannot claim asset with pledgeId $CID as the expiry time has elapsed" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli asset transfer reclaim --source-network=network1 --user=alice --type=bond.fabric --pledge-id=$CID --param=bond01:a04 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ReclaimAsset. With Args: $CID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer ReadAsset '["bond01","a04"]' --local-network=network1 &> tmp.out + #tail -n 1 tmp.out | grep "Result from network query: {\"type\":\"bond01\",\"id\":\"a04\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out | tr '\n' ' ' | grep "Result from network query: { \"type\": \"bond01\", \"id\": \"a04\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=bob mychannel simpleassettransfer ReadAsset '["bond01","a04"]' --local-network=network2 &> tmp.out + tail -n 2 tmp.out | grep "Error: the asset a04 does not exist" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/fabric/fabric-cli + + # FABRIC CLI + - name: Asset Transfer Fabric CLI Fungible Tests + run: | + COUNT=0 + TOTAL=8 + + # FABRIC2 - FABRIC1 + ./bin/fabric-cli asset transfer pledge --source-network=network1 --dest-network=network2 --recipient=bob --expiry-secs=3600 --type=token --units=50 --owner=alice --data-file=src/data/tokensForTransfer.json &> tmp.out + tail -n 1 tmp.out | grep "Asset pledged with ID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + + # FABRIC1 - FABRIC2 + ./bin/fabric-cli asset transfer claim --source-network=network1 --dest-network=network2 --user=bob --owner=alice --type=token.fabric --pledge-id=$CID --param=token1:50 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ClaimRemoteTokenAsset. With Args: $CID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9950\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=bob mychannel simpleassettransfer GetMyWallet '[]' --local-network=network2 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"50\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli asset transfer pledge --source-network=network1 --dest-network=network2 --recipient=bob --expiry-secs=20 --type=token --units=100 --owner=alice --data-file=src/data/tokensForTransfer.json &> tmp.out + cat tmp.out + + CID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + sleep 20 + + ./bin/fabric-cli asset transfer claim --source-network=network1 --dest-network=network2 --user=bob --owner=alice --type=token.fabric --pledge-id=$CID --param=token1:100 &> tmp.out + tail -n 1 tmp.out | grep "cannot claim asset with pledgeId $CID as the expiry time has elapsed" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli asset transfer reclaim --source-network=network1 --user=alice --type=token.fabric --pledge-id=$CID --param=token1:100 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ReclaimTokenAsset. With Args: $CID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9950\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=bob mychannel simpleassettransfer GetMyWallet '[]' --local-network=network2 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"50\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/fabric/fabric-cli + + + # CORDA - FABRIC + - name: Corda - Fabric Asset Transfer test 1 - Pledge + run: | + COUNT=0 + TOTAL=2 + + # CORDA - FABRIC1 + # Issue and Pledge token1:5 tokens to partyA + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients issue-asset-state 5 token1 1> tmp.out + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer pledge-asset --fungible --timeout="3600" --import-network-id='network1' --recipient='alice' --param='token1:5' 1> tmp.out + cat tmp.out | grep "AssetPledgeState created with pledge-id" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + PID=$(cat tmp.out | grep "AssetPledgeState created with pledge-id " | awk -F "'" '{print $2}') + + # Is Asset Pledged + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer is-asset-pledged -pid $PID 1> tmp.out + cat tmp.out | grep "Is asset pledged for transfer response: true" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + echo "CF_PID=$PID" >> $GITHUB_ENV + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/corda/corda-simple-application + + - name: Corda - Fabric Asset Transfer test 2 - Claim + run: | + COUNT=0 + TOTAL=3 + + PID=${{ env.CF_PID }} + + # CORDA - FABRIC1 + # Claim in Fabric (pledged in Corda) + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9950\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli asset transfer claim --source-network='Corda_Network' --dest-network=network1 --user='alice' --owner='O=PartyA, L=London, C=GB' --type='token.corda' --pledge-id=$PID --param=token1:5 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ClaimRemoteTokenAsset. With Args: $PID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9955\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/fabric/fabric-cli + + - name: Corda - Fabric Asset Transfer test 3 - Reclaim + run: | + COUNT=0 + TOTAL=3 + + # CORDA - FABRIC1 + # Issue and Pledge token1:10 tokens to partyA + NETWORK_NAME='Corda_Network' CORDA_PORT=10006 ./clients/build/install/clients/bin/clients issue-asset-state 10 token1 1> tmp.out + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer pledge-asset --fungible --timeout="20" --import-network-id='network1' --recipient='alice' --param='token1:10' 1> tmp.out + sleep 20 + + PID=$(cat tmp.out | grep "AssetPledgeState created with pledge-id " | awk -F "'" '{print $2}') + + # Is Asset Pledged + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer is-asset-pledged -pid $PID 1> tmp.out + cat tmp.out | grep "Is asset pledged for transfer response: false" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + NETWORK_NAME=Corda_Network CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer reclaim-pledged-asset --pledge-id=$PID --export-relay-address='localhost:9081' --transfer-category='token.fabric' --import-network-id='network1' --param='token1:10' 1> tmp.out + cat tmp.out | grep "Pledged Asset Reclaim Response: Right(b=SignedTransaction(id=" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients get-asset-states-by-type token1 1> tmp.out + cat tmp.out | grep "AssetState(quantity=10, tokenType=token1, owner=O=PartyA, L=London, C=GB, " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/corda/corda-simple-application + + - name: Fabric - Corda Asset Transfer test 1 - Pledge + run: | + COUNT=0 + TOTAL=1 + + ./bin/fabric-cli asset transfer pledge --source-network='network1' --dest-network='Corda_Network' --recipient='O=PartyA, L=London, C=GB' --expiry-secs=3600 --type='token' --units=50 --owner=alice --data-file=src/data/tokensForTransfer.json &> tmp.out + + PID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9905\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + sleep 30 + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + echo "FC_PID=$PID" >> $GITHUB_ENV + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/fabric/fabric-cli + + - name: Fabric - Corda Asset Transfer test 2 - Claim + run: | + COUNT=0 + TOTAL=2 + + PID=${{ env.FC_PID }} + + # FABRIC - CORDA + # Claim Remote Asset + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients transfer claim-remote-asset --pledge-id=$PID --locker='alice' --transfer-category='token.fabric' --export-network-id='network1' --param='token1:50' --import-relay-address='localhost:9082' 1> tmp.out + cat tmp.out | grep "Pledged asset claim response: Right(b=SignedTransaction(id=" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + CORDA_PORT=10006 ./clients/build/install/clients/bin/clients get-asset-states-by-type token1 1> tmp.out + cat tmp.out | grep "AssetState(quantity=50, tokenType=token1, owner=O=PartyA, L=London, C=GB, " && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/corda/corda-simple-application + + - name: Fabric - Corda Asset Transfer test 3 - Reclaim + run: | + COUNT=0 + TOTAL=3 + + ./bin/fabric-cli asset transfer pledge --source-network='network1' --dest-network='Corda_Network' --recipient='O=PartyA, L=London, C=GB' --expiry-secs=30 --type='token' --units=50 --owner=alice --data-file=src/data/tokensForTransfer.json &> tmp.out + PID=$(cat tmp.out | grep "Asset pledged with ID " | sed -e 's/Asset pledged with ID //') + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9855\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + sleep 30 + + ./bin/fabric-cli asset transfer reclaim --source-network='network1' --user='alice' --type='token.corda' --pledge-id=$PID --param=token1:50 &> tmp.out + tail -n 1 tmp.out | grep "Called Function ReclaimTokenAsset. With Args: $PID" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query --user=alice mychannel simpleassettransfer GetMyWallet '[]' --local-network=network1 &> tmp.out + tail -n 2 tmp.out | grep "Result from network query: token1=\"9905\"" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + + working-directory: weaver/samples/fabric/fabric-cli + + - if: failure() + name: DEBUG Logs - corda partya + run: docker logs corda_partya_1 + + - if: failure() + name: DEBUG Logs - corda network2 partya + run: docker logs corda_network2_partya_1 + + - if: failure() + name: DEBUG Logs - fabric n1 relay + run: cat weaver/core/relay/relay-n1.out + + - if: failure() + name: DEBUG Logs - fabric n2 relay + run: cat weaver/core/relay/relay-n2.out + + - if: failure() + name: DEBUG Logs - corda relay + run: cat weaver/core/relay/relay-corda.out + + - if: failure() + name: DEBUG Logs - corda2 relay + run: cat weaver/core/relay/relay-corda2.out + + - if: failure() + name: DEBUG Logs - fabric n1 driver + run: cat weaver/core/drivers/fabric-driver/fdriver-n1.out + + - if: failure() + name: DEBUG Logs - fabric n2 driver + run: cat weaver/core/drivers/fabric-driver/fdriver-n2.out + + - if: failure() + name: DEBUG Logs - corda driver + run: cat weaver/core/drivers/corda-driver/corda-driver.out + + - if: failure() + name: DEBUG Logs - corda2 driver + run: cat weaver/core/drivers/corda-driver/corda2-driver.out + + - if: failure() + name: DEBUG Logs - iin agent n1 org1 + run: cat weaver/core/identity-management/iin-agent/iinagent-n1.out + + - if: failure() + name: DEBUG Logs - iin agent n2 org1 + run: cat weaver/core/identity-management/iin-agent/iinagent-n2.out diff --git a/.github/workflows/test_weaver-data-sharing-fabric-connector.yaml b/.github/workflows/test_weaver-data-sharing-fabric-connector.yaml new file mode 100644 index 0000000000..ca78723443 --- /dev/null +++ b/.github/workflows/test_weaver-data-sharing-fabric-connector.yaml @@ -0,0 +1,465 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: CC-BY-4.0 + +# This is a basic workflow to help you get started with Actions + +name: Test Data Sharing Using Fabric Connector as a Fabric Driver + +env: + NODEJS_VERSION: v22.18.0 + +# Controls when the workflow will run +on: + workflow_call: + inputs: + run_all: + required: true + type: string + + +concurrency: + group: data-sharing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + check_code_changed: + outputs: + status: ${{ steps.changes.outputs.weaver_code_changed }} + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 #v2.11.1 + id: changes + with: + filters: | + weaver_code_changed: + - './weaver/**' + - '.github/workflows/test_weaver-data-sharing-fabric-connector.yaml' + - './packages/cactus-plugin-ledger-connector-fabric/**' + + data-sharing-local-fabric-connector: + needs: check_code_changed + if: inputs.run_all == 'true' || needs.check_code_changed.outputs.status == 'true' + env: + CONFIGURE_DISABLED: false + # if: ${{ false }} + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 #v2.11.1 + id: changes + with: + filters: | + weaver_code_changed: + - './weaver/**' + - '.github/workflows/test_weaver-data-sharing.yaml' + + - name: Set up JDK 17 + uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 #v3.11.0 + with: + java-version: '17' + distribution: 'adopt' + + - name: Set up Go + uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 #v4.0.0 + with: + go-version: '1.20.2' + + - name: Use Node.js ${{ env.NODEJS_VERSION }} + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b #v4.0.3 + with: + node-version: ${{ env.NODEJS_VERSION }} + + - name: Install RUST Toolchain minimal stable with clippy and rustfmt + uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f #v1.0.6 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + + - name: Get Latest Relay Dependencies + run: | + make protos-local + cargo update -p nom + cargo update -p lexical-core + working-directory: weaver/core/relay + + - name: Use Protoc 3.15 + run: | + curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip + unzip protoc-3.15.6-linux-x86_64.zip -d protoc + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4.0 + + # PROTOS + - name: Build GO Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-go + + # PROTOS + - name: Build JS Protos + run: | + export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" + make build + working-directory: weaver/common/protos-js + + - name: Build Java Protos + run: make build + working-directory: weaver/common/protos-java-kt + + # Build Dependencies + - name: Build Corda Interop App + run: make build-local + working-directory: weaver/core/network/corda-interop-app + + - name: Build Corda Interop SDK + run: make build + working-directory: weaver/sdks/corda + + - name: Build Corda SimpleApplication + run: make build-local + working-directory: weaver/samples/corda/corda-simple-application + + - name: Build Fabric Interop SDK + run: make build-local + working-directory: weaver/sdks/fabric/interoperation-node-sdk + + - name: Build Fabric CLI + run: make build-local + working-directory: weaver/samples/fabric/fabric-cli + + - name: Build Relay + run: make + working-directory: weaver/core/relay + + - name: Build Corda Driver + run: make build-local + working-directory: weaver/core/drivers/corda-driver + + - name: Build IIN Agent + run: make build-local + working-directory: weaver/core/identity-management/iin-agent + + # CORDA NETWORK + - name: Start Corda Network + run: make start-local &> corda-net.out & + working-directory: weaver/tests/network-setups/corda + + # FABRIC NETWORK + + - name: Start Fabric Network + run: make start-interop-local + working-directory: weaver/tests/network-setups/fabric/dev + + - name: Corda Network logs + run: | + cat tests/network-setups/corda/corda-net.out + docker logs corda_partya_1 + working-directory: weaver + + # RELAY + - name: Start Relay for network1 + run: RELAY_CONFIG=config/Fabric_Relay.toml cargo run --bin server &> relay-n1.out & + working-directory: weaver/core/relay + + - name: Start Relay for network2 + run: RELAY_CONFIG=config/Fabric_Relay2.toml cargo run --bin server &> relay-n2.out & + working-directory: weaver/core/relay + + - name: Start Relay for Corda_Network + run: RELAY_CONFIG=config/Corda_Relay.toml cargo run --bin server &> relay-corda.out & + working-directory: weaver/core/relay + + - name: Start Relay for Corda_Network2 + run: RELAY_CONFIG=config/Corda_Relay2.toml cargo run --bin server &> relay-corda2.out & + working-directory: weaver/core/relay + + # FABRIC DRIVER + - name: Setup Fabric Driver .env + run: | + cp .env.template .env + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network1/peerOrganizations/org1.network1.com/connection-org1.json + sed -i "s#path_to_connection_profile#${CCP_PATH}#g" .env + working-directory: packages/cactus-plugin-ledger-connector-fabric + + - name: Start Fabric Driver for network1 + run: yarn start-fabric-weaver-driver &> fdriver-n1.out & + working-directory: packages/cactus-plugin-ledger-connector-fabric + + - name: Start Fabric Driver for network2 + run: CONNECTION_PROFILE=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network2/peerOrganizations/org1.network2.com/connection-org1.json NETWORK_NAME=network2 RELAY_ENDPOINT=localhost:9083 DRIVER_ENDPOINT=localhost:9095 yarn start-fabric-weaver-driver &> fdriver-n2.out & + working-directory: packages/cactus-plugin-ledger-connector-fabric + + # IIN AGENT + - name: Setup Fabric IIN Config + run: | + # FABRIC CONFIG + cp src/fabric-ledger/config.json.template src/fabric-ledger/config-n1.json + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network1/peerOrganizations/org1.network1.com/connection-org1.json + sed -i "s##${CCP_PATH}#g" src/fabric-ledger/config-n1.json + cat src/fabric-ledger/config-n1.json + cp src/fabric-ledger/config.json.template src/fabric-ledger/config-n2.json + CCP_PATH=${GITHUB_WORKSPACE}/weaver/tests/network-setups/fabric/shared/network2/peerOrganizations/org1.network2.com/connection-org1.json + sed -i "s##${CCP_PATH}#g" src/fabric-ledger/config-n2.json + cat src/fabric-ledger/config-n2.json + # DNS CONFIG + sed -i "s#iin-agent-Org1MSP-network1#localhost#g" docker-testnet/configs/dnsconfig.json + sed -i "s#iin-agent-Org1MSP-network2#localhost#g" docker-testnet/configs/dnsconfig.json + cat docker-testnet/configs/dnsconfig.json + working-directory: weaver/core/identity-management/iin-agent + + - name: Setup Fabric IIN Env + run: | + cp .env.template .env + sed -i "s##Org1MSP#g" .env + sed -i "s#^DLT_TYPE=.*#DLT_TYPE=fabric#g" .env + sed -i "s##interop#g" .env + sed -i "s#^DNS_CONFIG_PATH=#DNS_CONFIG_PATH=./docker-testnet/configs/dnsconfig.json#g" .env + sed -i "s#^SECURITY_DOMAIN_CONFIG_PATH=#SECURITY_DOMAIN_CONFIG_PATH=./docker-testnet/configs/security-domain-config.json#g" .env + sed -i "s#^CONFIG_PATH=#CONFIG_PATH=./src/fabric-ledger/config-n1.json#g" .env + sed -i "s#^AUTO_SYNC=#AUTO_SYNC=false#g" .env + cat .env + working-directory: weaver/core/identity-management/iin-agent + + - name: Start Fabric IIN Agent for network1 + run: npm run dev &> iinagent-n1.out & + working-directory: weaver/core/identity-management/iin-agent + + - name: Start Fabric IIN Agent for network2 + run: IIN_AGENT_ENDPOINT=localhost:9501 SECURITY_DOMAIN=network2 CONFIG_PATH=./src/fabric-ledger/config-n2.json npm run dev &> iinagent-n2.out & + working-directory: weaver/core/identity-management/iin-agent + + # CORDA DRIVER + - name: Start Corda_Network Driver + run: ./build/install/driver-corda/bin/driver-corda &> corda-driver.out & + working-directory: weaver/core/drivers/corda-driver + + - name: Start Corda_Network2 Driver + run: DRIVER_PORT=9098 ./build/install/driver-corda/bin/driver-corda &> corda2-driver.out & + working-directory: weaver/core/drivers/corda-driver + + # FABRIC CLI + - name: Setup Fabric CLI Config + run: | + echo ${GITHUB_WORKSPACE} + cp config.template.json config.json + sed -i "s##${GITHUB_WORKSPACE}/weaver#g" config.json + working-directory: weaver/samples/fabric/fabric-cli + - name: Setup Fabric CLI ENV + run: | + echo ${GITHUB_WORKSPACE} + cp .env.template .env + sed -i "s/CHAINCODE_PATH=.*/CHAINCODE_PATH=\.\/chaincode\.json/g" .env + ./bin/fabric-cli env set MEMBER_CREDENTIAL_FOLDER ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/src/data/credentials + ./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/config.json + cat .env + cp chaincode.json.template chaincode.json + working-directory: weaver/samples/fabric/fabric-cli + + - name: Fabric CLI Configure ALL + run: ./bin/fabric-cli configure all network1 network2 + working-directory: weaver/samples/fabric/fabric-cli + + - name: Fabric Sync Membership using IIN Agent + run: | + ./bin/fabric-cli configure membership --local-network=network1 --target-network=network2 --iin-agent-endpoint=localhost:9500 + sleep 10 + tail -5 ../../../core/identity-management/iin-agent/iinagent-n1.out + ./bin/fabric-cli configure membership --local-network=network2 --target-network=network1 --iin-agent-endpoint=localhost:9501 + sleep 10 + tail -5 ../../../core/identity-management/iin-agent/iinagent-n2.out + working-directory: weaver/samples/fabric/fabric-cli + + # CORDA CLIENT + - name: Corda CLI Initialize Vault + run: make initialise-vault + working-directory: weaver/samples/corda/corda-simple-application + + - name: Data Transfer Corda Client Tests + run: | + COUNT=0 + TOTAL=8 + + # CORDA-CORDA2 + ./clients/build/install/clients/bin/clients request-state --wkey=H localhost:9081 localhost:9082/Corda_Network2/localhost:30006#com.cordaSimpleApplication.flow.GetStateByKey:H 1> tmp.out + cat tmp.out | grep "SimpleState(key=H, value=\[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./clients/build/install/clients/bin/clients get-state H 1> tmp.out + cat tmp.out | grep "SimpleState(key=H, value=\[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # CORDA2-CORDA + + NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients request-state --wkey=C localhost:9082 localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:C 1> tmp.out + cat tmp.out | grep "SimpleState(key=C, value=\[SimpleState(key=C, value=6" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + NETWORK_NAME=Corda_Network2 CORDA_PORT=30006 ./clients/build/install/clients/bin/clients get-state C 1> tmp.out + cat tmp.out | grep "SimpleState(key=C, value=\[SimpleState(key=C, value=6" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # CORDA - FABRIC1 + ./clients/build/install/clients/bin/clients request-state --wkey=a localhost:9081 localhost:9080/network1/mychannel:simplestate:Read:a 1> tmp.out + cat tmp.out | grep "SimpleState(key=a, value=Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./clients/build/install/clients/bin/clients get-state a 1> tmp.out + cat tmp.out | grep "SimpleState(key=a, value=Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # CORDA - FABRIC2 + ./clients/build/install/clients/bin/clients request-state --wkey=Arcturus localhost:9081 localhost:9083/network2/mychannel:simplestate:Read:Arcturus 1> tmp.out + cat tmp.out | grep "SimpleState(key=Arcturus, value=17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./clients/build/install/clients/bin/clients get-state Arcturus 1> tmp.out + cat tmp.out | grep "SimpleState(key=Arcturus, value=17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/corda/corda-simple-application + + # FABRIC CLI + - name: Data Transfer Fabric CLI Tests + run: | + COUNT=0 + TOTAL=12 + + # FABRIC2 - FABRIC1 + cp chaincode.json.template chaincode.json + ./bin/fabric-cli interop --local-network=network2 --requesting-org=Org1MSP localhost:9080/network1/mychannel:simplestate:Read:a &> tmp.out + tail -n 1 tmp.out | grep "Args: a, Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["a"]' --local-network=network2 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: Arcturus" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # FABRIC2 - FABRIC1 - CONFIDENTIAL + sed -i "s/\"args\"\: \[\"a\"/\"args\"\: \[\"b\"/g" chaincode.json + ./bin/fabric-cli interop --local-network=network2 --requesting-org=Org1MSP --e2e-confidentiality=true localhost:9080/network1/mychannel:simplestate:Read:b &> tmp.out + tail -n 1 tmp.out | grep "Args: b, Betelgeuse" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["b"]' --local-network=network2 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: Betelgeuse" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # FABRIC1 - FABRIC2 + sed -i "s/\"args\"\: \[\"b\"/\"args\"\: \[\"Arcturus\"/g" chaincode.json + ./bin/fabric-cli interop --local-network=network1 --requesting-org=Org1MSP localhost:9083/network2/mychannel:simplestate:Read:Arcturus &> tmp.out + tail -n 1 tmp.out | grep "Args: Arcturus, 17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["Arcturus"]' --local-network=network1 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: 17.671" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # FABRIC1 - FABRIC2 - CONFIDENTIAL + sed -i "s/\"args\"\: \[\"Arcturus\"/\"args\"\: \[\"Betelgeuse\"/g" chaincode.json + ./bin/fabric-cli interop --local-network=network1 --requesting-org=Org1MSP --e2e-confidentiality=true localhost:9083/network2/mychannel:simplestate:Read:Betelgeuse &> tmp.out + tail -n 1 tmp.out | grep "Args: Betelgeuse, 617.1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["Betelgeuse"]' --local-network=network1 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: 617.1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # FABRIC1 - CORDA + cp chaincode.json.template chaincode.json + sed -i "s/\"args\"\: \[\"a\"/\"args\"\: \[\"H\"/g" chaincode.json + ./bin/fabric-cli interop --local-network=network1 --sign=true --requesting-org=Org1MSP localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:H --debug=true &> tmp.out + tail -n 1 tmp.out | grep "Args: H, \[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["H"]' --local-network=network1 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: \[SimpleState(key=H, value=1" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + # FABRIC2 - CORDA + cp chaincode.json.template chaincode.json + sed -i "s/\"args\"\: \[\"a\"/\"args\"\: \[\"C\"/g" chaincode.json + ./bin/fabric-cli interop --local-network=network2 --sign=true --requesting-org=Org1MSP localhost:9081/Corda_Network/localhost:10006#com.cordaSimpleApplication.flow.GetStateByKey:C --debug=true --debug=true &> tmp.out + tail -n 1 tmp.out | grep "Args: C, \[SimpleState(key=C, value=6" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + ./bin/fabric-cli chaincode query mychannel simplestate read '["C"]' --local-network=network2 &> tmp.out + tail -n 1 tmp.out | grep "Result from network query: \[SimpleState(key=C, value=6" && COUNT=$(( COUNT + 1 )) && echo "PASS" + cat tmp.out + + + # RESULT + echo "Passed $COUNT/$TOTAL Tests." + + if [ $COUNT == $TOTAL ]; then + exit 0 + else + exit 1 + fi + working-directory: weaver/samples/fabric/fabric-cli + + - if: failure() + name: DEBUG Logs - corda partya + run: docker logs corda_partya_1 + + - if: failure() + name: DEBUG Logs - corda network2 partya + run: docker logs corda_network2_partya_1 + + - if: failure() + name: DEBUG Logs - fabric n1 relay + run: cat weaver/core/relay/relay-n1.out + + - if: failure() + name: DEBUG Logs - fabric n2 relay + run: cat weaver/core/relay/relay-n2.out + + - if: failure() + name: DEBUG Logs - corda relay + run: cat weaver/core/relay/relay-corda.out + + - if: failure() + name: DEBUG Logs - corda2 relay + run: cat weaver/core/relay/relay-corda2.out + + - if: failure() + name: DEBUG Logs - fabric n1 driver + run: cat weaver/core/drivers/fabric-driver/fdriver-n1.out + + - if: failure() + name: DEBUG Logs - fabric n2 driver + run: cat weaver/core/drivers/fabric-driver/fdriver-n2.out + + - if: failure() + name: DEBUG Logs - corda driver + run: cat weaver/core/drivers/corda-driver/corda-driver.out + + - if: failure() + name: DEBUG Logs - corda2 driver + run: cat weaver/core/drivers/corda-driver/corda2-driver.out + + - if: failure() + name: DEBUG Logs - iin agent n1 org1 + run: cat weaver/core/identity-management/iin-agent/iinagent-n1.out + + - if: failure() + name: DEBUG Logs - iin agent n2 org1 + run: cat weaver/core/identity-management/iin-agent/iinagent-n2.out diff --git a/packages/cactus-plugin-ledger-connector-fabric/.env.template b/packages/cactus-plugin-ledger-connector-fabric/.env.template new file mode 100644 index 0000000000..6485969c1d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/.env.template @@ -0,0 +1,19 @@ +CONNECTION_PROFILE=path_to_connection_profile +RELAY_ENDPOINT=localhost:9080 +RELAY_TLS=false +RELAY_TLSCA_CERT_PATH=path_to_tls_ca_cert_pem_for_relay +DRIVER_ENDPOINT=localhost:9090 +DRIVER_TLS=false +DRIVER_TLS_CERT_PATH=path_to_tls_cert_pem_for_driver +DRIVER_TLS_KEY_PATH=path_to_tls_key_pem_for_driver +NETWORK_NAME=network1 +DRIVER_CONFIG= +INTEROP_CHAINCODE=interop +MOCK=false +DB_PATH=driverdbs +WALLET_PATH= +DEBUG=true +LEVELDB_LOCKED_MAX_RETRIES= +LEVELDB_LOCKED_RETRY_BACKOFF_MSEC= +ENABLE_MONITOR=false +MONITOR_SYNC_PERIOD= \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-fabric/.gitignore b/packages/cactus-plugin-ledger-connector-fabric/.gitignore new file mode 100644 index 0000000000..81ae497ffa --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/.gitignore @@ -0,0 +1,6 @@ +.env +wallet-network1/*.id +!wallet-network1/relay.id +wallet-network2/*.id +!wallet-network2/relay.id +driverdbs \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-fabric/README.md b/packages/cactus-plugin-ledger-connector-fabric/README.md index 8395cea592..408df752e1 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/README.md @@ -29,9 +29,14 @@ - [4.3.1. response.type.ts](#431-responsetypets) - [4.3.2. data-fetcher.ts](#432-data-fetcherts) - [4.3.3. metrics.ts](#433-metricsts) -- [5. Contributing](#5-contributing) -- [6. License](#6-license) -- [7. Acknowledgments](#7-acknowledgments) +- [5. Deploying Fabric Driver for Weaver](#5-deploying-fabric-driver-for-weaver) + - [5.1 Setup](#51-setup) + - [5.1.1 Enabling TLS](#511-enabling-tls) + - [5.1.2 Environment variables](#512-environment-variables) + - [5.2 Running](#52-running) +- [6. Contributing](#6-contributing) +- [7. License](#7-license) +- [8. Acknowledgments](#8-acknowledgments) ## 1. Usage @@ -688,14 +693,67 @@ This file contains functions encasing the logic to process the data points #### 4.3.3. metrics.ts This file lists all the prometheus metrics and what they are used for. -## 5. Contributing +## 5. Deploying Fabric Driver for Weaver +### 5.1 Setup + +Create a `.env` file using `.env.template` as the base and setting suitable environment variable values (see [here](#512-environment-variables)) and `config.json` files need to be checked and updated to match the network and relay that it will be connecting to. +The .env contains information related to the network and relay. The config.json contains information about the ca admin, user and its org, that is used when connecting to the network. + +#### 5.1.1 Enabling TLS + +If the relay is TLS-enabled, set the following values in the `.env`: +``` +RELAY_TLS=true +RELAY_TLSCA_CERT_PATH=path_to_tls_ca_cert_pem_for_relay +``` +- `path_to_tls_ca_cert_pem_for_relay` should be set to CA certificate file path + +To enforce secure communication over TLS with your driver, set the following values in the `.env`: +``` +DRIVER_TLS=true +DRIVER_TLS_CERT_PATH=path_to_tls_cert_pem_for_driver +DRIVER_TLS_KEY_PATH=path_to_tls_key_pem_for_driver +``` +- `path_to_tls_cert_pem_for_driver` should be set to driver's TLS certificate file path +- `path_to_tls_key_pem_for_driver` should be set to driver's TLS private key file path + +#### 5.1.2 Environment variables + +The connection profile is required to set up the required material to communicate with the network. This should be supplied with the `CONNECTION_PROFILE` environment variable (ex: CONNECTION_PROFILE=path/to/con_profile.json) + +`:` for connecting relay: `RELAY_ENDPOINT` (ex: RELAY_ENDPOINT=localhost:9081 ) + +Boolean for when to use mocked fabric communication: `MOCK` (ex: MOCK=true) + +`:` for the driver to be run on: `DRIVER_ENDPOINT` (ex: DRIVER_ENDPOINT=localhost:9093) (Not required for docker) + +Can pass in a variable 'local' for working with fabric and docker: `local` (ex: local=false) + +Can pass in a config file for the driver to be run with: `DRIVER_CONFIG` (ex: DRIVER_CONFIG=./config.json) + +`INTEROP_CHAINCODE` stores the name of the interop chaincode installed. + +`DB_PATH` stores the path hosting the database files containing the event subscription information. + +`WALLET_PATH` stores the path hosting the user wallets to access a network. + +NOTE: When specifying ensure that they match the config that the relay is using. + +### 5.2 Running +Running the server: `yarn start-fabric-weaver-driver` + +Note: Can also be run in mocked mode by setting environment variable `MOCK=true` + + + +## 6. Contributing We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do! Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. -## 6. License +## 7. License This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file. -## 7. Acknowledgments +## 8. Acknowledgments diff --git a/packages/cactus-plugin-ledger-connector-fabric/config.json b/packages/cactus-plugin-ledger-connector-fabric/config.json new file mode 100644 index 0000000000..c9173edfb4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/config.json @@ -0,0 +1,14 @@ +{ + "admin":{ + "name":"admin", + "secret":"adminpw" + }, + "relay": { + "name":"relay", + "affiliation":"org1.department1", + "role": "client", + "attrs": [{ "name": "relay", "value": "true", "ecert": true }] + }, + "mspId":"Org1MSP", + "caUrl":"" +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-fabric/package.json b/packages/cactus-plugin-ledger-connector-fabric/package.json index d204c359e2..f8390436dc 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/package.json +++ b/packages/cactus-plugin-ledger-connector-fabric/package.json @@ -33,6 +33,11 @@ "name": "Peter Somogyvari", "email": "peter.somogyvari@accenture.com", "url": "https://accenture.com" + }, + { + "name": "Carlos Amaro", + "email": "carlosrscamaro@tecnico.ulisboa.pt", + "url": "https://accenture.com" } ], "main": "dist/lib/main/typescript/index.js", @@ -43,6 +48,7 @@ "dist/*" ], "scripts": { + "start-fabric-weaver-driver": "node ./dist/lib/main/typescript/plugin-ledger-connector-fabric-cli.js", "codegen": "yarn run --top-level run-s 'codegen:*'", "codegen:openapi": "npm run generate-sdk", "generate-sdk": "run-p 'generate-sdk:*'", @@ -56,14 +62,22 @@ "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" }, "dependencies": { + "@bufbuild/protobuf": "2.2.2", + "@connectrpc/connect": "2.0.0", + "@connectrpc/connect-express": "2.0.0", + "@connectrpc/connect-node": "2.0.0", + "@connectrpc/protoc-gen-connect-es": "1.6.1", "@fidm/x509": "1.2.1", + "@hyperledger/cacti-weaver-protos-js": "2.1.0", "@hyperledger/cactus-common": "2.1.0", "@hyperledger/cactus-core": "2.1.0", "@hyperledger/cactus-core-api": "2.1.0", + "@hyperledger/cactus-plugin-keychain-memory": "2.1.0", "axios": "1.8.4", "bl": "6.1.0", "bn.js": "4.12.0", "dockerode": "3.3.0", + "dotenv": "17.2.3", "elliptic": "6.6.1", "express": "5.1.0", "fabric-ca-client": "2.5.0-snapshot.23", @@ -72,11 +86,14 @@ "fabric-protos": "2.5.0-snapshot.23", "fast-safe-stringify": "2.1.1", "form-data": "4.0.0", + "google-protobuf": "3.21.2", "http-errors": "2.0.0", "http-status-codes": "2.1.4", + "http2": "^3.3.7", "joi": "17.13.3", "json5": "2.2.3", "jsrsasign": "11.0.0", + "level": "8.0.0", "lodash": "4.17.21", "long": "5.2.3", "multer": "1.4.5-lts.1", @@ -99,6 +116,10 @@ "ws-identity-client": "1.0.2" }, "devDependencies": { + "@bufbuild/buf": "1.47.2", + "@bufbuild/protoc-gen-es": "2.2.2", + "@grpc/grpc-js": "1.13.3", + "@grpc/proto-loader": "0.7.13", "@hyperledger/cactus-plugin-keychain-memory": "2.1.0", "@hyperledger/cactus-test-tooling": "2.1.0", "@types/bn.js": "5.1.0", @@ -107,6 +128,7 @@ "@types/elliptic": "6.4.16", "@types/express": "5.0.1", "@types/fs-extra": "11.0.4", + "@types/google-protobuf": "3.15.12", "@types/http-errors": "2.0.4", "@types/jsrsasign": "8.0.13", "@types/lodash": "4.14.172", @@ -118,7 +140,9 @@ "@types/uuid": "10.0.0", "body-parser": "1.20.3", "fs-extra": "11.2.0", + "grpc_tools_node_protoc_ts": "5.3.3", "internal-ip": "6.2.0", + "protobufjs": "7.2.5", "socket.io": "4.6.2", "ws-wallet": "1.1.5" }, diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES index c4b4d3fef5..178ff38efb 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/.openapi-generator/FILES @@ -22,11 +22,15 @@ model_deploy_contract_v1_request_constructor_args.go model_deploy_contract_v1_response.go model_deployment_target_org_fabric2x.go model_deployment_target_organization.go +model_endorsed_proposal_response.go +model_endorsement.go model_error_exception_response_v1.go +model_event_type.go model_fabric_certificate_identity_v1.go model_fabric_contract_invocation_type.go model_fabric_signing_credential.go model_fabric_signing_credential_type.go +model_fabric_view.go model_fabric_x509_certificate_v1.go model_file_base64.go model_full_block_transaction_action_v1.go @@ -53,8 +57,13 @@ model_get_discovery_results_response_v1_orderers_value_endpoints_inner.go model_get_discovery_results_response_v1_peers_by_msp_value.go model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner.go model_get_discovery_results_response_v1_peers_by_msp_value_peers_inner_chaincodes_inner.go +model_get_latest_block_number_request_v1.go +model_get_latest_block_number_response_v1.go model_get_transaction_receipt_response.go +model_proposal_response_payload.go model_run_delegated_sign_transaction_request.go +model_run_invoke_request.go +model_run_invoke_response.go model_run_transaction_request.go model_run_transaction_response.go model_run_transaction_response_type.go diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md index 3a8ff4a5bb..fa18c5b468 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/README.md @@ -81,6 +81,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**GetBlockV1**](docs/DefaultApi.md#getblockv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**GetChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info. *DefaultApi* | [**GetDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service). +*DefaultApi* | [**GetLatestBlockNumberV1**](docs/DefaultApi.md#getlatestblocknumberv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number | Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**GetPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics *DefaultApi* | [**GetTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger. *DefaultApi* | [**RunDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback. @@ -105,11 +106,15 @@ Class | Method | HTTP request | Description - [DeployContractV1Response](docs/DeployContractV1Response.md) - [DeploymentTargetOrgFabric2x](docs/DeploymentTargetOrgFabric2x.md) - [DeploymentTargetOrganization](docs/DeploymentTargetOrganization.md) + - [EndorsedProposalResponse](docs/EndorsedProposalResponse.md) + - [Endorsement](docs/Endorsement.md) - [ErrorExceptionResponseV1](docs/ErrorExceptionResponseV1.md) + - [EventType](docs/EventType.md) - [FabricCertificateIdentityV1](docs/FabricCertificateIdentityV1.md) - [FabricContractInvocationType](docs/FabricContractInvocationType.md) - [FabricSigningCredential](docs/FabricSigningCredential.md) - [FabricSigningCredentialType](docs/FabricSigningCredentialType.md) + - [FabricView](docs/FabricView.md) - [FabricX509CertificateV1](docs/FabricX509CertificateV1.md) - [FileBase64](docs/FileBase64.md) - [FullBlockTransactionActionV1](docs/FullBlockTransactionActionV1.md) @@ -136,8 +141,13 @@ Class | Method | HTTP request | Description - [GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md) - [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md) - [GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md) + - [GetLatestBlockNumberRequestV1](docs/GetLatestBlockNumberRequestV1.md) + - [GetLatestBlockNumberResponseV1](docs/GetLatestBlockNumberResponseV1.md) - [GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md) + - [ProposalResponsePayload](docs/ProposalResponsePayload.md) - [RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md) + - [RunInvokeRequest](docs/RunInvokeRequest.md) + - [RunInvokeResponse](docs/RunInvokeResponse.md) - [RunTransactionRequest](docs/RunTransactionRequest.md) - [RunTransactionResponse](docs/RunTransactionResponse.md) - [RunTransactionResponseType](docs/RunTransactionResponseType.md) diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml index c69622d73f..cc4c31621c 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api/openapi.yaml @@ -149,6 +149,34 @@ paths: http: verbLowerCase: post path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number: + post: + operationId: getLatestBlockNumberV1 + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetLatestBlockNumberRequestV1' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GetLatestBlockNumberResponseV1' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorExceptionResponseV1' + description: Internal Server Error + summary: Get block number from the channel using one of selectors from the input. + Works only on Fabric 2.x. + x-hyperledger-cacti: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info: post: operationId: getChainInfoV1 @@ -441,6 +469,13 @@ components: - node - java type: string + EventType: + description: Type of event to listen supported by Hyperledger Fabric + enum: + - Contract + - Block + - Commit + type: string ConnectionProfile: additionalProperties: true example: @@ -655,6 +690,99 @@ components: - stderr - stdout type: object + FabricView: + properties: + endorsedProposalResponses: + items: + $ref: '#/components/schemas/EndorsedProposalResponse' + minItems: 1 + nullable: false + type: array + required: + - EndorsedProposalResponses + type: object + EndorsedProposalResponse: + properties: + payload: + $ref: '#/components/schemas/ProposalResponsePayload' + endorsement: + $ref: '#/components/schemas/endorsement' + type: object + ProposalResponsePayload: + properties: + proposalHash: + format: byte + nullable: false + type: string + extension: + format: byte + nullable: false + type: string + type: object + endorsement: + properties: + endorser: + format: byte + nullable: false + type: string + signature: + format: byte + nullable: false + type: string + type: object + RunInvokeResponse: + properties: + view: + $ref: '#/components/schemas/FabricView' + required: + - view + type: object + RunInvokeRequest: + additionalProperties: false + properties: + transientData: + nullable: true + type: object + gatewayOptions: + $ref: '#/components/schemas/GatewayOptions' + signingCredential: + $ref: '#/components/schemas/FabricSigningCredential' + channelName: + maxLength: 100 + minLength: 1 + nullable: false + type: string + contractName: + maxLength: 100 + minLength: 1 + nullable: false + type: string + methodName: + maxLength: 100 + minLength: 1 + nullable: false + type: string + params: + default: [] + items: + nullable: true + type: string + nullable: false + type: array + policies: + default: [] + description: List of endorsers + items: + nullable: true + type: string + nullable: true + type: array + required: + - channelName + - contractName + - methodName + - params + type: object RunTransactionResponseType: description: Response format from transaction / query execution enum: @@ -787,7 +915,6 @@ components: - invocationType - methodName - params - - signingCredential type: object RunTransactionResponse: example: @@ -1405,6 +1532,75 @@ components: - gatewayOptions - query type: object + GetLatestBlockNumberRequestV1: + description: Request for GetBlockNumber endpoint. + example: + gatewayOptions: + wallet: + keychain: + vaultTransitKey: + keyName: keyName + token: token + keychainId: keychainId + keychainRef: keychainRef + webSocketKey: + signature: signature + sessionId: sessionId + type: null + json: json + connectionProfile: + channels: + key: "" + certificateAuthorities: + key: "" + name: basic-network + organizations: + key: "" + peers: + key: "" + x-type: hlfv1 + description: The basic network + client: + organization: Org1 + orderers: + key: "" + version: "1.0" + discovery: + asLocalhost: true + enabled: true + identity: identity + eventHandlerOptions: + commitTimeout: 0.8008281904610115 + strategy: null + endorseTimeout: 6.027456183070403 + channelName: channelName + properties: + channelName: + description: Fabric channel which we want to query. + maxLength: 100 + minLength: 1 + nullable: false + type: string + gatewayOptions: + $ref: '#/components/schemas/GatewayOptions' + required: + - channelName + - contractName + - gatewayOptions + - methodName + type: object + GetLatestBlockNumberResponseV1: + description: Response from GetBlockNumber endpoint. + example: + blockNumber: 0.8008281904610115 + properties: + blockNumber: + description: Number of the block that was queried. + nullable: false + type: number + required: + - blockNumber + type: object GetChainInfoRequestV1: description: Request for GetChainInfo endpoint. example: diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go index b5d095f554..f4c99dac27 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/api_default.go @@ -482,6 +482,121 @@ func (a *DefaultApiService) GetDiscoveryResultsV1Execute(r ApiGetDiscoveryResult return localVarReturnValue, localVarHTTPResponse, nil } +type ApiGetLatestBlockNumberV1Request struct { + ctx context.Context + ApiService *DefaultApiService + getLatestBlockNumberRequestV1 *GetLatestBlockNumberRequestV1 +} + +func (r ApiGetLatestBlockNumberV1Request) GetLatestBlockNumberRequestV1(getLatestBlockNumberRequestV1 GetLatestBlockNumberRequestV1) ApiGetLatestBlockNumberV1Request { + r.getLatestBlockNumberRequestV1 = &getLatestBlockNumberRequestV1 + return r +} + +func (r ApiGetLatestBlockNumberV1Request) Execute() (*GetLatestBlockNumberResponseV1, *http.Response, error) { + return r.ApiService.GetLatestBlockNumberV1Execute(r) +} + +/* +GetLatestBlockNumberV1 Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetLatestBlockNumberV1Request +*/ +func (a *DefaultApiService) GetLatestBlockNumberV1(ctx context.Context) ApiGetLatestBlockNumberV1Request { + return ApiGetLatestBlockNumberV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return GetLatestBlockNumberResponseV1 +func (a *DefaultApiService) GetLatestBlockNumberV1Execute(r ApiGetLatestBlockNumberV1Request) (*GetLatestBlockNumberResponseV1, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetLatestBlockNumberResponseV1 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLatestBlockNumberV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.getLatestBlockNumberRequestV1 + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorExceptionResponseV1 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiGetPrometheusMetricsV1Request struct { ctx context.Context ApiService *DefaultApiService diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsed_proposal_response.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsed_proposal_response.go new file mode 100644 index 0000000000..a179493e50 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsed_proposal_response.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the EndorsedProposalResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EndorsedProposalResponse{} + +// EndorsedProposalResponse struct for EndorsedProposalResponse +type EndorsedProposalResponse struct { + Payload *ProposalResponsePayload `json:"payload,omitempty"` + Endorsement *Endorsement `json:"endorsement,omitempty"` +} + +// NewEndorsedProposalResponse instantiates a new EndorsedProposalResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEndorsedProposalResponse() *EndorsedProposalResponse { + this := EndorsedProposalResponse{} + return &this +} + +// NewEndorsedProposalResponseWithDefaults instantiates a new EndorsedProposalResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEndorsedProposalResponseWithDefaults() *EndorsedProposalResponse { + this := EndorsedProposalResponse{} + return &this +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *EndorsedProposalResponse) GetPayload() ProposalResponsePayload { + if o == nil || IsNil(o.Payload) { + var ret ProposalResponsePayload + return ret + } + return *o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EndorsedProposalResponse) GetPayloadOk() (*ProposalResponsePayload, bool) { + if o == nil || IsNil(o.Payload) { + return nil, false + } + return o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *EndorsedProposalResponse) HasPayload() bool { + if o != nil && !IsNil(o.Payload) { + return true + } + + return false +} + +// SetPayload gets a reference to the given ProposalResponsePayload and assigns it to the Payload field. +func (o *EndorsedProposalResponse) SetPayload(v ProposalResponsePayload) { + o.Payload = &v +} + +// GetEndorsement returns the Endorsement field value if set, zero value otherwise. +func (o *EndorsedProposalResponse) GetEndorsement() Endorsement { + if o == nil || IsNil(o.Endorsement) { + var ret Endorsement + return ret + } + return *o.Endorsement +} + +// GetEndorsementOk returns a tuple with the Endorsement field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EndorsedProposalResponse) GetEndorsementOk() (*Endorsement, bool) { + if o == nil || IsNil(o.Endorsement) { + return nil, false + } + return o.Endorsement, true +} + +// HasEndorsement returns a boolean if a field has been set. +func (o *EndorsedProposalResponse) HasEndorsement() bool { + if o != nil && !IsNil(o.Endorsement) { + return true + } + + return false +} + +// SetEndorsement gets a reference to the given Endorsement and assigns it to the Endorsement field. +func (o *EndorsedProposalResponse) SetEndorsement(v Endorsement) { + o.Endorsement = &v +} + +func (o EndorsedProposalResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EndorsedProposalResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Payload) { + toSerialize["payload"] = o.Payload + } + if !IsNil(o.Endorsement) { + toSerialize["endorsement"] = o.Endorsement + } + return toSerialize, nil +} + +type NullableEndorsedProposalResponse struct { + value *EndorsedProposalResponse + isSet bool +} + +func (v NullableEndorsedProposalResponse) Get() *EndorsedProposalResponse { + return v.value +} + +func (v *NullableEndorsedProposalResponse) Set(val *EndorsedProposalResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEndorsedProposalResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEndorsedProposalResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEndorsedProposalResponse(val *EndorsedProposalResponse) *NullableEndorsedProposalResponse { + return &NullableEndorsedProposalResponse{value: val, isSet: true} +} + +func (v NullableEndorsedProposalResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEndorsedProposalResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsement.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsement.go new file mode 100644 index 0000000000..ea5932f437 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_endorsement.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the Endorsement type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Endorsement{} + +// Endorsement struct for Endorsement +type Endorsement struct { + Endorser *string `json:"endorser,omitempty"` + Signature *string `json:"signature,omitempty"` +} + +// NewEndorsement instantiates a new Endorsement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEndorsement() *Endorsement { + this := Endorsement{} + return &this +} + +// NewEndorsementWithDefaults instantiates a new Endorsement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEndorsementWithDefaults() *Endorsement { + this := Endorsement{} + return &this +} + +// GetEndorser returns the Endorser field value if set, zero value otherwise. +func (o *Endorsement) GetEndorser() string { + if o == nil || IsNil(o.Endorser) { + var ret string + return ret + } + return *o.Endorser +} + +// GetEndorserOk returns a tuple with the Endorser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Endorsement) GetEndorserOk() (*string, bool) { + if o == nil || IsNil(o.Endorser) { + return nil, false + } + return o.Endorser, true +} + +// HasEndorser returns a boolean if a field has been set. +func (o *Endorsement) HasEndorser() bool { + if o != nil && !IsNil(o.Endorser) { + return true + } + + return false +} + +// SetEndorser gets a reference to the given string and assigns it to the Endorser field. +func (o *Endorsement) SetEndorser(v string) { + o.Endorser = &v +} + +// GetSignature returns the Signature field value if set, zero value otherwise. +func (o *Endorsement) GetSignature() string { + if o == nil || IsNil(o.Signature) { + var ret string + return ret + } + return *o.Signature +} + +// GetSignatureOk returns a tuple with the Signature field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Endorsement) GetSignatureOk() (*string, bool) { + if o == nil || IsNil(o.Signature) { + return nil, false + } + return o.Signature, true +} + +// HasSignature returns a boolean if a field has been set. +func (o *Endorsement) HasSignature() bool { + if o != nil && !IsNil(o.Signature) { + return true + } + + return false +} + +// SetSignature gets a reference to the given string and assigns it to the Signature field. +func (o *Endorsement) SetSignature(v string) { + o.Signature = &v +} + +func (o Endorsement) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Endorsement) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Endorser) { + toSerialize["endorser"] = o.Endorser + } + if !IsNil(o.Signature) { + toSerialize["signature"] = o.Signature + } + return toSerialize, nil +} + +type NullableEndorsement struct { + value *Endorsement + isSet bool +} + +func (v NullableEndorsement) Get() *Endorsement { + return v.value +} + +func (v *NullableEndorsement) Set(val *Endorsement) { + v.value = val + v.isSet = true +} + +func (v NullableEndorsement) IsSet() bool { + return v.isSet +} + +func (v *NullableEndorsement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEndorsement(val *Endorsement) *NullableEndorsement { + return &NullableEndorsement{value: val, isSet: true} +} + +func (v NullableEndorsement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEndorsement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_envent_type.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_envent_type.go new file mode 100644 index 0000000000..bd49acb58d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_envent_type.go @@ -0,0 +1,113 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" + "fmt" +) + +// EnventType Type of event to listen supported by Hyperledger Fabric +type EnventType string + +// List of EnventType +const ( + CONTRACT EnventType = "Contract" + BLOCK EnventType = "Block" + COMMIT EnventType = "Commit" +) + +// All allowed values of EnventType enum +var AllowedEnventTypeEnumValues = []EnventType{ + "Contract", + "Block", + "Commit", +} + +func (v *EnventType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EnventType(value) + for _, existing := range AllowedEnventTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EnventType", value) +} + +// NewEnventTypeFromValue returns a pointer to a valid EnventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEnventTypeFromValue(v string) (*EnventType, error) { + ev := EnventType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EnventType: valid values are %v", v, AllowedEnventTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EnventType) IsValid() bool { + for _, existing := range AllowedEnventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EnventType value +func (v EnventType) Ptr() *EnventType { + return &v +} + +type NullableEnventType struct { + value *EnventType + isSet bool +} + +func (v NullableEnventType) Get() *EnventType { + return v.value +} + +func (v *NullableEnventType) Set(val *EnventType) { + v.value = val + v.isSet = true +} + +func (v NullableEnventType) IsSet() bool { + return v.isSet +} + +func (v *NullableEnventType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnventType(val *EnventType) *NullableEnventType { + return &NullableEnventType{value: val, isSet: true} +} + +func (v NullableEnventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_event_type.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_event_type.go new file mode 100644 index 0000000000..ea01f54508 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_event_type.go @@ -0,0 +1,113 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" + "fmt" +) + +// EventType Type of event to listen supported by Hyperledger Fabric +type EventType string + +// List of EventType +const ( + CONTRACT EventType = "Contract" + BLOCK EventType = "Block" + COMMIT EventType = "Commit" +) + +// All allowed values of EventType enum +var AllowedEventTypeEnumValues = []EventType{ + "Contract", + "Block", + "Commit", +} + +func (v *EventType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EventType(value) + for _, existing := range AllowedEventTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EventType", value) +} + +// NewEventTypeFromValue returns a pointer to a valid EventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEventTypeFromValue(v string) (*EventType, error) { + ev := EventType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EventType: valid values are %v", v, AllowedEventTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EventType) IsValid() bool { + for _, existing := range AllowedEventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventType value +func (v EventType) Ptr() *EventType { + return &v +} + +type NullableEventType struct { + value *EventType + isSet bool +} + +func (v NullableEventType) Get() *EventType { + return v.value +} + +func (v *NullableEventType) Set(val *EventType) { + v.value = val + v.isSet = true +} + +func (v NullableEventType) IsSet() bool { + return v.isSet +} + +func (v *NullableEventType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEventType(val *EventType) *NullableEventType { + return &NullableEventType{value: val, isSet: true} +} + +func (v NullableEventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_fabric_view.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_fabric_view.go new file mode 100644 index 0000000000..8d5d2fde66 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_fabric_view.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the FabricView type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FabricView{} + +// FabricView struct for FabricView +type FabricView struct { + EndorsedProposalResponses []EndorsedProposalResponse `json:"endorsedProposalResponses,omitempty"` +} + +// NewFabricView instantiates a new FabricView object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFabricView() *FabricView { + this := FabricView{} + return &this +} + +// NewFabricViewWithDefaults instantiates a new FabricView object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFabricViewWithDefaults() *FabricView { + this := FabricView{} + return &this +} + +// GetEndorsedProposalResponses returns the EndorsedProposalResponses field value if set, zero value otherwise. +func (o *FabricView) GetEndorsedProposalResponses() []EndorsedProposalResponse { + if o == nil || IsNil(o.EndorsedProposalResponses) { + var ret []EndorsedProposalResponse + return ret + } + return o.EndorsedProposalResponses +} + +// GetEndorsedProposalResponsesOk returns a tuple with the EndorsedProposalResponses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FabricView) GetEndorsedProposalResponsesOk() ([]EndorsedProposalResponse, bool) { + if o == nil || IsNil(o.EndorsedProposalResponses) { + return nil, false + } + return o.EndorsedProposalResponses, true +} + +// HasEndorsedProposalResponses returns a boolean if a field has been set. +func (o *FabricView) HasEndorsedProposalResponses() bool { + if o != nil && !IsNil(o.EndorsedProposalResponses) { + return true + } + + return false +} + +// SetEndorsedProposalResponses gets a reference to the given []EndorsedProposalResponse and assigns it to the EndorsedProposalResponses field. +func (o *FabricView) SetEndorsedProposalResponses(v []EndorsedProposalResponse) { + o.EndorsedProposalResponses = v +} + +func (o FabricView) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FabricView) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.EndorsedProposalResponses) { + toSerialize["endorsedProposalResponses"] = o.EndorsedProposalResponses + } + return toSerialize, nil +} + +type NullableFabricView struct { + value *FabricView + isSet bool +} + +func (v NullableFabricView) Get() *FabricView { + return v.value +} + +func (v *NullableFabricView) Set(val *FabricView) { + v.value = val + v.isSet = true +} + +func (v NullableFabricView) IsSet() bool { + return v.isSet +} + +func (v *NullableFabricView) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFabricView(val *FabricView) *NullableFabricView { + return &NullableFabricView{value: val, isSet: true} +} + +func (v NullableFabricView) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFabricView) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_request_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_request_v1.go new file mode 100644 index 0000000000..00ad415394 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_request_v1.go @@ -0,0 +1,209 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetBlockNumberRequestV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetBlockNumberRequestV1{} + +// GetBlockNumberRequestV1 Request for GetBlockNumber endpoint. +type GetBlockNumberRequestV1 struct { + // Fabric channel which we want to query. + ChannelName string `json:"channelName"` + // Fabric channel we want to connect to. If not provided, then one from channelName parameter will be used + ConnectionChannelName *string `json:"connectionChannelName,omitempty"` + GatewayOptions GatewayOptions `json:"gatewayOptions"` + Query GetBlockRequestV1Query `json:"query"` +} + +// NewGetBlockNumberRequestV1 instantiates a new GetBlockNumberRequestV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetBlockNumberRequestV1(channelName string, gatewayOptions GatewayOptions, query GetBlockRequestV1Query) *GetBlockNumberRequestV1 { + this := GetBlockNumberRequestV1{} + this.ChannelName = channelName + this.GatewayOptions = gatewayOptions + this.Query = query + return &this +} + +// NewGetBlockNumberRequestV1WithDefaults instantiates a new GetBlockNumberRequestV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetBlockNumberRequestV1WithDefaults() *GetBlockNumberRequestV1 { + this := GetBlockNumberRequestV1{} + return &this +} + +// GetChannelName returns the ChannelName field value +func (o *GetBlockNumberRequestV1) GetChannelName() string { + if o == nil { + var ret string + return ret + } + + return o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value +// and a boolean to check if the value has been set. +func (o *GetBlockNumberRequestV1) GetChannelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChannelName, true +} + +// SetChannelName sets field value +func (o *GetBlockNumberRequestV1) SetChannelName(v string) { + o.ChannelName = v +} + +// GetConnectionChannelName returns the ConnectionChannelName field value if set, zero value otherwise. +func (o *GetBlockNumberRequestV1) GetConnectionChannelName() string { + if o == nil || IsNil(o.ConnectionChannelName) { + var ret string + return ret + } + return *o.ConnectionChannelName +} + +// GetConnectionChannelNameOk returns a tuple with the ConnectionChannelName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetBlockNumberRequestV1) GetConnectionChannelNameOk() (*string, bool) { + if o == nil || IsNil(o.ConnectionChannelName) { + return nil, false + } + return o.ConnectionChannelName, true +} + +// HasConnectionChannelName returns a boolean if a field has been set. +func (o *GetBlockNumberRequestV1) HasConnectionChannelName() bool { + if o != nil && !IsNil(o.ConnectionChannelName) { + return true + } + + return false +} + +// SetConnectionChannelName gets a reference to the given string and assigns it to the ConnectionChannelName field. +func (o *GetBlockNumberRequestV1) SetConnectionChannelName(v string) { + o.ConnectionChannelName = &v +} + +// GetGatewayOptions returns the GatewayOptions field value +func (o *GetBlockNumberRequestV1) GetGatewayOptions() GatewayOptions { + if o == nil { + var ret GatewayOptions + return ret + } + + return o.GatewayOptions +} + +// GetGatewayOptionsOk returns a tuple with the GatewayOptions field value +// and a boolean to check if the value has been set. +func (o *GetBlockNumberRequestV1) GetGatewayOptionsOk() (*GatewayOptions, bool) { + if o == nil { + return nil, false + } + return &o.GatewayOptions, true +} + +// SetGatewayOptions sets field value +func (o *GetBlockNumberRequestV1) SetGatewayOptions(v GatewayOptions) { + o.GatewayOptions = v +} + +// GetQuery returns the Query field value +func (o *GetBlockNumberRequestV1) GetQuery() GetBlockRequestV1Query { + if o == nil { + var ret GetBlockRequestV1Query + return ret + } + + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *GetBlockNumberRequestV1) GetQueryOk() (*GetBlockRequestV1Query, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value +func (o *GetBlockNumberRequestV1) SetQuery(v GetBlockRequestV1Query) { + o.Query = v +} + +func (o GetBlockNumberRequestV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetBlockNumberRequestV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["channelName"] = o.ChannelName + if !IsNil(o.ConnectionChannelName) { + toSerialize["connectionChannelName"] = o.ConnectionChannelName + } + toSerialize["gatewayOptions"] = o.GatewayOptions + toSerialize["query"] = o.Query + return toSerialize, nil +} + +type NullableGetBlockNumberRequestV1 struct { + value *GetBlockNumberRequestV1 + isSet bool +} + +func (v NullableGetBlockNumberRequestV1) Get() *GetBlockNumberRequestV1 { + return v.value +} + +func (v *NullableGetBlockNumberRequestV1) Set(val *GetBlockNumberRequestV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetBlockNumberRequestV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetBlockNumberRequestV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetBlockNumberRequestV1(val *GetBlockNumberRequestV1) *NullableGetBlockNumberRequestV1 { + return &NullableGetBlockNumberRequestV1{value: val, isSet: true} +} + +func (v NullableGetBlockNumberRequestV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetBlockNumberRequestV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_response_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_response_v1.go new file mode 100644 index 0000000000..8ca0d48eca --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_block_number_response_v1.go @@ -0,0 +1,118 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetBlockNumberResponseV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetBlockNumberResponseV1{} + +// GetBlockNumberResponseV1 Response from GetBlockNumber endpoint. +type GetBlockNumberResponseV1 struct { + // Number of the block that was queried. + BlockNumber float32 `json:"blockNumber"` +} + +// NewGetBlockNumberResponseV1 instantiates a new GetBlockNumberResponseV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetBlockNumberResponseV1(blockNumber float32) *GetBlockNumberResponseV1 { + this := GetBlockNumberResponseV1{} + this.BlockNumber = blockNumber + return &this +} + +// NewGetBlockNumberResponseV1WithDefaults instantiates a new GetBlockNumberResponseV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetBlockNumberResponseV1WithDefaults() *GetBlockNumberResponseV1 { + this := GetBlockNumberResponseV1{} + return &this +} + +// GetBlockNumber returns the BlockNumber field value +func (o *GetBlockNumberResponseV1) GetBlockNumber() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.BlockNumber +} + +// GetBlockNumberOk returns a tuple with the BlockNumber field value +// and a boolean to check if the value has been set. +func (o *GetBlockNumberResponseV1) GetBlockNumberOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.BlockNumber, true +} + +// SetBlockNumber sets field value +func (o *GetBlockNumberResponseV1) SetBlockNumber(v float32) { + o.BlockNumber = v +} + +func (o GetBlockNumberResponseV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetBlockNumberResponseV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["blockNumber"] = o.BlockNumber + return toSerialize, nil +} + +type NullableGetBlockNumberResponseV1 struct { + value *GetBlockNumberResponseV1 + isSet bool +} + +func (v NullableGetBlockNumberResponseV1) Get() *GetBlockNumberResponseV1 { + return v.value +} + +func (v *NullableGetBlockNumberResponseV1) Set(val *GetBlockNumberResponseV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetBlockNumberResponseV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetBlockNumberResponseV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetBlockNumberResponseV1(val *GetBlockNumberResponseV1) *NullableGetBlockNumberResponseV1 { + return &NullableGetBlockNumberResponseV1{value: val, isSet: true} +} + +func (v NullableGetBlockNumberResponseV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetBlockNumberResponseV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_request_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_request_v1.go new file mode 100644 index 0000000000..7ea3f6a54a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_request_v1.go @@ -0,0 +1,145 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetLatestBlockNumberRequestV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetLatestBlockNumberRequestV1{} + +// GetLatestBlockNumberRequestV1 Request for GetBlockNumber endpoint. +type GetLatestBlockNumberRequestV1 struct { + // Fabric channel which we want to query. + ChannelName string `json:"channelName"` + GatewayOptions GatewayOptions `json:"gatewayOptions"` +} + +// NewGetLatestBlockNumberRequestV1 instantiates a new GetLatestBlockNumberRequestV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetLatestBlockNumberRequestV1(channelName string, gatewayOptions GatewayOptions) *GetLatestBlockNumberRequestV1 { + this := GetLatestBlockNumberRequestV1{} + this.ChannelName = channelName + this.GatewayOptions = gatewayOptions + return &this +} + +// NewGetLatestBlockNumberRequestV1WithDefaults instantiates a new GetLatestBlockNumberRequestV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetLatestBlockNumberRequestV1WithDefaults() *GetLatestBlockNumberRequestV1 { + this := GetLatestBlockNumberRequestV1{} + return &this +} + +// GetChannelName returns the ChannelName field value +func (o *GetLatestBlockNumberRequestV1) GetChannelName() string { + if o == nil { + var ret string + return ret + } + + return o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value +// and a boolean to check if the value has been set. +func (o *GetLatestBlockNumberRequestV1) GetChannelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChannelName, true +} + +// SetChannelName sets field value +func (o *GetLatestBlockNumberRequestV1) SetChannelName(v string) { + o.ChannelName = v +} + +// GetGatewayOptions returns the GatewayOptions field value +func (o *GetLatestBlockNumberRequestV1) GetGatewayOptions() GatewayOptions { + if o == nil { + var ret GatewayOptions + return ret + } + + return o.GatewayOptions +} + +// GetGatewayOptionsOk returns a tuple with the GatewayOptions field value +// and a boolean to check if the value has been set. +func (o *GetLatestBlockNumberRequestV1) GetGatewayOptionsOk() (*GatewayOptions, bool) { + if o == nil { + return nil, false + } + return &o.GatewayOptions, true +} + +// SetGatewayOptions sets field value +func (o *GetLatestBlockNumberRequestV1) SetGatewayOptions(v GatewayOptions) { + o.GatewayOptions = v +} + +func (o GetLatestBlockNumberRequestV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetLatestBlockNumberRequestV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["channelName"] = o.ChannelName + toSerialize["gatewayOptions"] = o.GatewayOptions + return toSerialize, nil +} + +type NullableGetLatestBlockNumberRequestV1 struct { + value *GetLatestBlockNumberRequestV1 + isSet bool +} + +func (v NullableGetLatestBlockNumberRequestV1) Get() *GetLatestBlockNumberRequestV1 { + return v.value +} + +func (v *NullableGetLatestBlockNumberRequestV1) Set(val *GetLatestBlockNumberRequestV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetLatestBlockNumberRequestV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetLatestBlockNumberRequestV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetLatestBlockNumberRequestV1(val *GetLatestBlockNumberRequestV1) *NullableGetLatestBlockNumberRequestV1 { + return &NullableGetLatestBlockNumberRequestV1{value: val, isSet: true} +} + +func (v NullableGetLatestBlockNumberRequestV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetLatestBlockNumberRequestV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_response_v1.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_response_v1.go new file mode 100644 index 0000000000..4bfc056b80 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_get_latest_block_number_response_v1.go @@ -0,0 +1,118 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the GetLatestBlockNumberResponseV1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetLatestBlockNumberResponseV1{} + +// GetLatestBlockNumberResponseV1 Response from GetBlockNumber endpoint. +type GetLatestBlockNumberResponseV1 struct { + // Number of the block that was queried. + BlockNumber float32 `json:"blockNumber"` +} + +// NewGetLatestBlockNumberResponseV1 instantiates a new GetLatestBlockNumberResponseV1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetLatestBlockNumberResponseV1(blockNumber float32) *GetLatestBlockNumberResponseV1 { + this := GetLatestBlockNumberResponseV1{} + this.BlockNumber = blockNumber + return &this +} + +// NewGetLatestBlockNumberResponseV1WithDefaults instantiates a new GetLatestBlockNumberResponseV1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetLatestBlockNumberResponseV1WithDefaults() *GetLatestBlockNumberResponseV1 { + this := GetLatestBlockNumberResponseV1{} + return &this +} + +// GetBlockNumber returns the BlockNumber field value +func (o *GetLatestBlockNumberResponseV1) GetBlockNumber() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.BlockNumber +} + +// GetBlockNumberOk returns a tuple with the BlockNumber field value +// and a boolean to check if the value has been set. +func (o *GetLatestBlockNumberResponseV1) GetBlockNumberOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.BlockNumber, true +} + +// SetBlockNumber sets field value +func (o *GetLatestBlockNumberResponseV1) SetBlockNumber(v float32) { + o.BlockNumber = v +} + +func (o GetLatestBlockNumberResponseV1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetLatestBlockNumberResponseV1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["blockNumber"] = o.BlockNumber + return toSerialize, nil +} + +type NullableGetLatestBlockNumberResponseV1 struct { + value *GetLatestBlockNumberResponseV1 + isSet bool +} + +func (v NullableGetLatestBlockNumberResponseV1) Get() *GetLatestBlockNumberResponseV1 { + return v.value +} + +func (v *NullableGetLatestBlockNumberResponseV1) Set(val *GetLatestBlockNumberResponseV1) { + v.value = val + v.isSet = true +} + +func (v NullableGetLatestBlockNumberResponseV1) IsSet() bool { + return v.isSet +} + +func (v *NullableGetLatestBlockNumberResponseV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetLatestBlockNumberResponseV1(val *GetLatestBlockNumberResponseV1) *NullableGetLatestBlockNumberResponseV1 { + return &NullableGetLatestBlockNumberResponseV1{value: val, isSet: true} +} + +func (v NullableGetLatestBlockNumberResponseV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetLatestBlockNumberResponseV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_proposal_response_payload.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_proposal_response_payload.go new file mode 100644 index 0000000000..ce6feb60bc --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_proposal_response_payload.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the ProposalResponsePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProposalResponsePayload{} + +// ProposalResponsePayload struct for ProposalResponsePayload +type ProposalResponsePayload struct { + ProposalHash *string `json:"proposalHash,omitempty"` + Extension *string `json:"extension,omitempty"` +} + +// NewProposalResponsePayload instantiates a new ProposalResponsePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProposalResponsePayload() *ProposalResponsePayload { + this := ProposalResponsePayload{} + return &this +} + +// NewProposalResponsePayloadWithDefaults instantiates a new ProposalResponsePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProposalResponsePayloadWithDefaults() *ProposalResponsePayload { + this := ProposalResponsePayload{} + return &this +} + +// GetProposalHash returns the ProposalHash field value if set, zero value otherwise. +func (o *ProposalResponsePayload) GetProposalHash() string { + if o == nil || IsNil(o.ProposalHash) { + var ret string + return ret + } + return *o.ProposalHash +} + +// GetProposalHashOk returns a tuple with the ProposalHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProposalResponsePayload) GetProposalHashOk() (*string, bool) { + if o == nil || IsNil(o.ProposalHash) { + return nil, false + } + return o.ProposalHash, true +} + +// HasProposalHash returns a boolean if a field has been set. +func (o *ProposalResponsePayload) HasProposalHash() bool { + if o != nil && !IsNil(o.ProposalHash) { + return true + } + + return false +} + +// SetProposalHash gets a reference to the given string and assigns it to the ProposalHash field. +func (o *ProposalResponsePayload) SetProposalHash(v string) { + o.ProposalHash = &v +} + +// GetExtension returns the Extension field value if set, zero value otherwise. +func (o *ProposalResponsePayload) GetExtension() string { + if o == nil || IsNil(o.Extension) { + var ret string + return ret + } + return *o.Extension +} + +// GetExtensionOk returns a tuple with the Extension field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProposalResponsePayload) GetExtensionOk() (*string, bool) { + if o == nil || IsNil(o.Extension) { + return nil, false + } + return o.Extension, true +} + +// HasExtension returns a boolean if a field has been set. +func (o *ProposalResponsePayload) HasExtension() bool { + if o != nil && !IsNil(o.Extension) { + return true + } + + return false +} + +// SetExtension gets a reference to the given string and assigns it to the Extension field. +func (o *ProposalResponsePayload) SetExtension(v string) { + o.Extension = &v +} + +func (o ProposalResponsePayload) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProposalResponsePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ProposalHash) { + toSerialize["proposalHash"] = o.ProposalHash + } + if !IsNil(o.Extension) { + toSerialize["extension"] = o.Extension + } + return toSerialize, nil +} + +type NullableProposalResponsePayload struct { + value *ProposalResponsePayload + isSet bool +} + +func (v NullableProposalResponsePayload) Get() *ProposalResponsePayload { + return v.value +} + +func (v *NullableProposalResponsePayload) Set(val *ProposalResponsePayload) { + v.value = val + v.isSet = true +} + +func (v NullableProposalResponsePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableProposalResponsePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProposalResponsePayload(val *ProposalResponsePayload) *NullableProposalResponsePayload { + return &NullableProposalResponsePayload{value: val, isSet: true} +} + +func (v NullableProposalResponsePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProposalResponsePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_request.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_request.go new file mode 100644 index 0000000000..c3af7632d0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_request.go @@ -0,0 +1,345 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the RunInvokeRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunInvokeRequest{} + +// RunInvokeRequest struct for RunInvokeRequest +type RunInvokeRequest struct { + TransientData map[string]interface{} `json:"transientData,omitempty"` + GatewayOptions *GatewayOptions `json:"gatewayOptions,omitempty"` + SigningCredential *FabricSigningCredential `json:"signingCredential,omitempty"` + ChannelName string `json:"channelName"` + ContractName string `json:"contractName"` + MethodName string `json:"methodName"` + Params []*string `json:"params"` + // List of endorsers + Policies []*string `json:"policies,omitempty"` +} + +// NewRunInvokeRequest instantiates a new RunInvokeRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRunInvokeRequest(channelName string, contractName string, methodName string, params []*string) *RunInvokeRequest { + this := RunInvokeRequest{} + this.ChannelName = channelName + this.ContractName = contractName + this.MethodName = methodName + this.Params = params + return &this +} + +// NewRunInvokeRequestWithDefaults instantiates a new RunInvokeRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRunInvokeRequestWithDefaults() *RunInvokeRequest { + this := RunInvokeRequest{} + return &this +} + +// GetTransientData returns the TransientData field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RunInvokeRequest) GetTransientData() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.TransientData +} + +// GetTransientDataOk returns a tuple with the TransientData field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RunInvokeRequest) GetTransientDataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.TransientData) { + return map[string]interface{}{}, false + } + return o.TransientData, true +} + +// HasTransientData returns a boolean if a field has been set. +func (o *RunInvokeRequest) HasTransientData() bool { + if o != nil && IsNil(o.TransientData) { + return true + } + + return false +} + +// SetTransientData gets a reference to the given map[string]interface{} and assigns it to the TransientData field. +func (o *RunInvokeRequest) SetTransientData(v map[string]interface{}) { + o.TransientData = v +} + +// GetGatewayOptions returns the GatewayOptions field value if set, zero value otherwise. +func (o *RunInvokeRequest) GetGatewayOptions() GatewayOptions { + if o == nil || IsNil(o.GatewayOptions) { + var ret GatewayOptions + return ret + } + return *o.GatewayOptions +} + +// GetGatewayOptionsOk returns a tuple with the GatewayOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetGatewayOptionsOk() (*GatewayOptions, bool) { + if o == nil || IsNil(o.GatewayOptions) { + return nil, false + } + return o.GatewayOptions, true +} + +// HasGatewayOptions returns a boolean if a field has been set. +func (o *RunInvokeRequest) HasGatewayOptions() bool { + if o != nil && !IsNil(o.GatewayOptions) { + return true + } + + return false +} + +// SetGatewayOptions gets a reference to the given GatewayOptions and assigns it to the GatewayOptions field. +func (o *RunInvokeRequest) SetGatewayOptions(v GatewayOptions) { + o.GatewayOptions = &v +} + +// GetSigningCredential returns the SigningCredential field value if set, zero value otherwise. +func (o *RunInvokeRequest) GetSigningCredential() FabricSigningCredential { + if o == nil || IsNil(o.SigningCredential) { + var ret FabricSigningCredential + return ret + } + return *o.SigningCredential +} + +// GetSigningCredentialOk returns a tuple with the SigningCredential field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetSigningCredentialOk() (*FabricSigningCredential, bool) { + if o == nil || IsNil(o.SigningCredential) { + return nil, false + } + return o.SigningCredential, true +} + +// HasSigningCredential returns a boolean if a field has been set. +func (o *RunInvokeRequest) HasSigningCredential() bool { + if o != nil && !IsNil(o.SigningCredential) { + return true + } + + return false +} + +// SetSigningCredential gets a reference to the given FabricSigningCredential and assigns it to the SigningCredential field. +func (o *RunInvokeRequest) SetSigningCredential(v FabricSigningCredential) { + o.SigningCredential = &v +} + +// GetChannelName returns the ChannelName field value +func (o *RunInvokeRequest) GetChannelName() string { + if o == nil { + var ret string + return ret + } + + return o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetChannelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChannelName, true +} + +// SetChannelName sets field value +func (o *RunInvokeRequest) SetChannelName(v string) { + o.ChannelName = v +} + +// GetContractName returns the ContractName field value +func (o *RunInvokeRequest) GetContractName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetContractNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractName, true +} + +// SetContractName sets field value +func (o *RunInvokeRequest) SetContractName(v string) { + o.ContractName = v +} + +// GetMethodName returns the MethodName field value +func (o *RunInvokeRequest) GetMethodName() string { + if o == nil { + var ret string + return ret + } + + return o.MethodName +} + +// GetMethodNameOk returns a tuple with the MethodName field value +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetMethodNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MethodName, true +} + +// SetMethodName sets field value +func (o *RunInvokeRequest) SetMethodName(v string) { + o.MethodName = v +} + +// GetParams returns the Params field value +func (o *RunInvokeRequest) GetParams() []*string { + if o == nil { + var ret []*string + return ret + } + + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value +// and a boolean to check if the value has been set. +func (o *RunInvokeRequest) GetParamsOk() ([]*string, bool) { + if o == nil { + return nil, false + } + return o.Params, true +} + +// SetParams sets field value +func (o *RunInvokeRequest) SetParams(v []*string) { + o.Params = v +} + +// GetPolicies returns the Policies field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RunInvokeRequest) GetPolicies() []*string { + if o == nil { + var ret []*string + return ret + } + return o.Policies +} + +// GetPoliciesOk returns a tuple with the Policies field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RunInvokeRequest) GetPoliciesOk() ([]*string, bool) { + if o == nil || IsNil(o.Policies) { + return nil, false + } + return o.Policies, true +} + +// HasPolicies returns a boolean if a field has been set. +func (o *RunInvokeRequest) HasPolicies() bool { + if o != nil && IsNil(o.Policies) { + return true + } + + return false +} + +// SetPolicies gets a reference to the given []*string and assigns it to the Policies field. +func (o *RunInvokeRequest) SetPolicies(v []*string) { + o.Policies = v +} + +func (o RunInvokeRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RunInvokeRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.TransientData != nil { + toSerialize["transientData"] = o.TransientData + } + if !IsNil(o.GatewayOptions) { + toSerialize["gatewayOptions"] = o.GatewayOptions + } + if !IsNil(o.SigningCredential) { + toSerialize["signingCredential"] = o.SigningCredential + } + toSerialize["channelName"] = o.ChannelName + toSerialize["contractName"] = o.ContractName + toSerialize["methodName"] = o.MethodName + toSerialize["params"] = o.Params + if o.Policies != nil { + toSerialize["policies"] = o.Policies + } + return toSerialize, nil +} + +type NullableRunInvokeRequest struct { + value *RunInvokeRequest + isSet bool +} + +func (v NullableRunInvokeRequest) Get() *RunInvokeRequest { + return v.value +} + +func (v *NullableRunInvokeRequest) Set(val *RunInvokeRequest) { + v.value = val + v.isSet = true +} + +func (v NullableRunInvokeRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRunInvokeRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunInvokeRequest(val *RunInvokeRequest) *NullableRunInvokeRequest { + return &NullableRunInvokeRequest{value: val, isSet: true} +} + +func (v NullableRunInvokeRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunInvokeRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_response.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_response.go new file mode 100644 index 0000000000..72f57d4f7a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_invoke_response.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cactus Plugin - Connector Fabric + +Can perform basic tasks on a fabric ledger + +API version: 2.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-fabric + +import ( + "encoding/json" +) + +// checks if the RunInvokeResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunInvokeResponse{} + +// RunInvokeResponse struct for RunInvokeResponse +type RunInvokeResponse struct { + View FabricView `json:"view"` +} + +// NewRunInvokeResponse instantiates a new RunInvokeResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRunInvokeResponse(view FabricView) *RunInvokeResponse { + this := RunInvokeResponse{} + this.View = view + return &this +} + +// NewRunInvokeResponseWithDefaults instantiates a new RunInvokeResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRunInvokeResponseWithDefaults() *RunInvokeResponse { + this := RunInvokeResponse{} + return &this +} + +// GetView returns the View field value +func (o *RunInvokeResponse) GetView() FabricView { + if o == nil { + var ret FabricView + return ret + } + + return o.View +} + +// GetViewOk returns a tuple with the View field value +// and a boolean to check if the value has been set. +func (o *RunInvokeResponse) GetViewOk() (*FabricView, bool) { + if o == nil { + return nil, false + } + return &o.View, true +} + +// SetView sets field value +func (o *RunInvokeResponse) SetView(v FabricView) { + o.View = v +} + +func (o RunInvokeResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RunInvokeResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["view"] = o.View + return toSerialize, nil +} + +type NullableRunInvokeResponse struct { + value *RunInvokeResponse + isSet bool +} + +func (v NullableRunInvokeResponse) Get() *RunInvokeResponse { + return v.value +} + +func (v *NullableRunInvokeResponse) Set(val *RunInvokeResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRunInvokeResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRunInvokeResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunInvokeResponse(val *RunInvokeResponse) *NullableRunInvokeResponse { + return &NullableRunInvokeResponse{value: val, isSet: true} +} + +func (v NullableRunInvokeResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunInvokeResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_transaction_request.go b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_transaction_request.go index f9658bf49f..68e8e07ed1 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_transaction_request.go +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/go/generated/openapi/go-client/model_run_transaction_request.go @@ -25,7 +25,7 @@ type RunTransactionRequest struct { EndorsingOrgs []string `json:"endorsingOrgs,omitempty"` TransientData map[string]interface{} `json:"transientData,omitempty"` GatewayOptions *GatewayOptions `json:"gatewayOptions,omitempty"` - SigningCredential FabricSigningCredential `json:"signingCredential"` + SigningCredential *FabricSigningCredential `json:"signingCredential,omitempty"` ChannelName string `json:"channelName"` ContractName string `json:"contractName"` InvocationType FabricContractInvocationType `json:"invocationType"` @@ -38,9 +38,8 @@ type RunTransactionRequest struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRunTransactionRequest(signingCredential FabricSigningCredential, channelName string, contractName string, invocationType FabricContractInvocationType, methodName string, params []*string) *RunTransactionRequest { +func NewRunTransactionRequest(channelName string, contractName string, invocationType FabricContractInvocationType, methodName string, params []*string) *RunTransactionRequest { this := RunTransactionRequest{} - this.SigningCredential = signingCredential this.ChannelName = channelName this.ContractName = contractName this.InvocationType = invocationType @@ -186,28 +185,36 @@ func (o *RunTransactionRequest) SetGatewayOptions(v GatewayOptions) { o.GatewayOptions = &v } -// GetSigningCredential returns the SigningCredential field value +// GetSigningCredential returns the SigningCredential field value if set, zero value otherwise. func (o *RunTransactionRequest) GetSigningCredential() FabricSigningCredential { - if o == nil { + if o == nil || IsNil(o.SigningCredential) { var ret FabricSigningCredential return ret } - - return o.SigningCredential + return *o.SigningCredential } -// GetSigningCredentialOk returns a tuple with the SigningCredential field value +// GetSigningCredentialOk returns a tuple with the SigningCredential field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RunTransactionRequest) GetSigningCredentialOk() (*FabricSigningCredential, bool) { - if o == nil { + if o == nil || IsNil(o.SigningCredential) { return nil, false } - return &o.SigningCredential, true + return o.SigningCredential, true +} + +// HasSigningCredential returns a boolean if a field has been set. +func (o *RunTransactionRequest) HasSigningCredential() bool { + if o != nil && !IsNil(o.SigningCredential) { + return true + } + + return false } -// SetSigningCredential sets field value +// SetSigningCredential gets a reference to the given FabricSigningCredential and assigns it to the SigningCredential field. func (o *RunTransactionRequest) SetSigningCredential(v FabricSigningCredential) { - o.SigningCredential = v + o.SigningCredential = &v } // GetChannelName returns the ChannelName field value @@ -384,7 +391,9 @@ func (o RunTransactionRequest) ToMap() (map[string]interface{}, error) { if !IsNil(o.GatewayOptions) { toSerialize["gatewayOptions"] = o.GatewayOptions } - toSerialize["signingCredential"] = o.SigningCredential + if !IsNil(o.SigningCredential) { + toSerialize["signingCredential"] = o.SigningCredential + } toSerialize["channelName"] = o.ChannelName toSerialize["contractName"] = o.ContractName toSerialize["invocationType"] = o.InvocationType diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json index f560c9e485..c455821d19 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.json @@ -180,6 +180,11 @@ "description": "Enumerates the supported programming language runtimes of Hyperledger Fabric", "enum": ["golang", "node", "java"] }, + "EventType": { + "type": "string", + "description": "Type of event to listen supported by Hyperledger Fabric", + "enum": ["Contract", "Block", "Commit"] + }, "ConnectionProfile": { "type": "object", "required": ["name", "version", "organizations", "peers"], @@ -373,6 +378,134 @@ } } }, + "FabricView": { + "type": "object", + "required": ["EndorsedProposalResponses"], + "properties": { + "endorsedProposalResponses": { + "type": "array", + "nullable": false, + "items": { + "$ref": "#/components/schemas/EndorsedProposalResponse" + }, + "minItems": 1 + } + } + }, + "EndorsedProposalResponse": { + "type": "object", + "properties": { + "payload": { + "$ref": "#/components/schemas/ProposalResponsePayload", + "nullable": false + }, + "endorsement": { + "$ref": "#/components/schemas/endorsement", + "nullable": false + } + } + }, + "ProposalResponsePayload": { + "type": "object", + "properties": { + "proposalHash": { + "type": "string", + "format": "byte", + "nullable": false + }, + "extension": { + "type": "string", + "format": "byte", + "nullable": false + } + } + }, + "endorsement": { + "type": "object", + "properties": { + "endorser": { + "type": "string", + "format": "byte", + "nullable": false + }, + "signature": { + "type": "string", + "format": "byte", + "nullable": false + } + } + }, + "RunInvokeResponse": { + "type": "object", + "required": ["view"], + "properties": { + "view": { + "$ref": "#/components/schemas/FabricView", + "nullable": false + } + } + }, + "RunInvokeRequest": { + "type": "object", + "required": [ + "channelName", + "contractName", + "methodName", + "params" + ], + "additionalProperties": false, + "properties": { + "transientData": { + "type": "object", + "nullable": true + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "nullable": false + }, + "signingCredential": { + "$ref": "#/components/schemas/FabricSigningCredential", + "nullable": false + }, + "channelName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "methodName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "params": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "type": "string", + "nullable": true + } + }, + "policies": { + "type": "array", + "nullable": true, + "description": "List of endorsers", + "default": [], + "items": { + "type": "string", + "nullable": true + } + } + } + }, "RunTransactionResponseType": { "type": "string", "description": "Response format from transaction / query execution", @@ -385,7 +518,6 @@ "RunTransactionRequest": { "type": "object", "required": [ - "signingCredential", "channelName", "contractName", "invocationType", @@ -937,6 +1069,37 @@ } } }, + "GetLatestBlockNumberRequestV1": { + "description": "Request for GetBlockNumber endpoint.", + "type": "object", + "required": ["channelName", "gatewayOptions", "contractName", "methodName"], + "properties": { + "channelName": { + "type": "string", + "description": "Fabric channel which we want to query.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "description": "Fabric SDK gateway options.", + "nullable": false + } + } + }, + "GetLatestBlockNumberResponseV1": { + "type": "object", + "description": "Response from GetBlockNumber endpoint.", + "required": ["blockNumber"], + "properties": { + "blockNumber": { + "description": "Number of the block that was queried.", + "type": "number", + "nullable": false + } + } + }, "GetChainInfoRequestV1": { "description": "Request for GetChainInfo endpoint.", "type": "object", @@ -1910,6 +2073,50 @@ } } }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number": { + "post": { + "operationId": "getLatestBlockNumberV1", + "summary": "Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x.", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetLatestBlockNumberRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetLatestBlockNumberResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info": { "post": { "operationId": "getChainInfoV1", @@ -2024,4 +2231,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 4d8e64b610..674dd71340 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -37,11 +37,15 @@ src/main/kotlin/org/openapitools/client/models/DeployContractV1RequestConstructo src/main/kotlin/org/openapitools/client/models/DeployContractV1Response.kt src/main/kotlin/org/openapitools/client/models/DeploymentTargetOrgFabric2x.kt src/main/kotlin/org/openapitools/client/models/DeploymentTargetOrganization.kt +src/main/kotlin/org/openapitools/client/models/EndorsedProposalResponse.kt +src/main/kotlin/org/openapitools/client/models/Endorsement.kt src/main/kotlin/org/openapitools/client/models/ErrorExceptionResponseV1.kt +src/main/kotlin/org/openapitools/client/models/EventType.kt src/main/kotlin/org/openapitools/client/models/FabricCertificateIdentityV1.kt src/main/kotlin/org/openapitools/client/models/FabricContractInvocationType.kt src/main/kotlin/org/openapitools/client/models/FabricSigningCredential.kt src/main/kotlin/org/openapitools/client/models/FabricSigningCredentialType.kt +src/main/kotlin/org/openapitools/client/models/FabricView.kt src/main/kotlin/org/openapitools/client/models/FabricX509CertificateV1.kt src/main/kotlin/org/openapitools/client/models/FileBase64.kt src/main/kotlin/org/openapitools/client/models/FullBlockTransactionActionV1.kt @@ -68,8 +72,13 @@ src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1Orde src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValue.kt src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.kt src/main/kotlin/org/openapitools/client/models/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.kt +src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberRequestV1.kt +src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberResponseV1.kt src/main/kotlin/org/openapitools/client/models/GetTransactionReceiptResponse.kt +src/main/kotlin/org/openapitools/client/models/ProposalResponsePayload.kt src/main/kotlin/org/openapitools/client/models/RunDelegatedSignTransactionRequest.kt +src/main/kotlin/org/openapitools/client/models/RunInvokeRequest.kt +src/main/kotlin/org/openapitools/client/models/RunInvokeResponse.kt src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt src/main/kotlin/org/openapitools/client/models/RunTransactionResponseType.kt diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md index 72a09598fd..e04c2c3aac 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -48,6 +48,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**getBlockV1**](docs/DefaultApi.md#getblockv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block | Get block from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**getChainInfoV1**](docs/DefaultApi.md#getchaininfov1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-chain-info | Get fabric ledger chain info. *DefaultApi* | [**getDiscoveryResultsV1**](docs/DefaultApi.md#getdiscoveryresultsv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-discovery-results | Get fabric ledger node structure (from the discovery service). +*DefaultApi* | [**getLatestBlockNumberV1**](docs/DefaultApi.md#getlatestblocknumberv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number | Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. *DefaultApi* | [**getPrometheusMetricsV1**](docs/DefaultApi.md#getprometheusmetricsv1) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics | Get the Prometheus Metrics *DefaultApi* | [**getTransactionReceiptByTxIDV1**](docs/DefaultApi.md#gettransactionreceiptbytxidv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid | get a transaction receipt by tx id on a Fabric ledger. *DefaultApi* | [**runDelegatedSignTransactionV1**](docs/DefaultApi.md#rundelegatedsigntransactionv1) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction | Runs a transaction on a Fabric ledger using user-provided signing callback. @@ -73,11 +74,15 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.DeployContractV1Response](docs/DeployContractV1Response.md) - [org.openapitools.client.models.DeploymentTargetOrgFabric2x](docs/DeploymentTargetOrgFabric2x.md) - [org.openapitools.client.models.DeploymentTargetOrganization](docs/DeploymentTargetOrganization.md) + - [org.openapitools.client.models.EndorsedProposalResponse](docs/EndorsedProposalResponse.md) + - [org.openapitools.client.models.Endorsement](docs/Endorsement.md) - [org.openapitools.client.models.ErrorExceptionResponseV1](docs/ErrorExceptionResponseV1.md) + - [org.openapitools.client.models.EventType](docs/EventType.md) - [org.openapitools.client.models.FabricCertificateIdentityV1](docs/FabricCertificateIdentityV1.md) - [org.openapitools.client.models.FabricContractInvocationType](docs/FabricContractInvocationType.md) - [org.openapitools.client.models.FabricSigningCredential](docs/FabricSigningCredential.md) - [org.openapitools.client.models.FabricSigningCredentialType](docs/FabricSigningCredentialType.md) + - [org.openapitools.client.models.FabricView](docs/FabricView.md) - [org.openapitools.client.models.FabricX509CertificateV1](docs/FabricX509CertificateV1.md) - [org.openapitools.client.models.FileBase64](docs/FileBase64.md) - [org.openapitools.client.models.FullBlockTransactionActionV1](docs/FullBlockTransactionActionV1.md) @@ -104,8 +109,13 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValue](docs/GetDiscoveryResultsResponseV1PeersByMSPValue.md) - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInner.md) - [org.openapitools.client.models.GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner](docs/GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincodesInner.md) + - [org.openapitools.client.models.GetLatestBlockNumberRequestV1](docs/GetLatestBlockNumberRequestV1.md) + - [org.openapitools.client.models.GetLatestBlockNumberResponseV1](docs/GetLatestBlockNumberResponseV1.md) - [org.openapitools.client.models.GetTransactionReceiptResponse](docs/GetTransactionReceiptResponse.md) + - [org.openapitools.client.models.ProposalResponsePayload](docs/ProposalResponsePayload.md) - [org.openapitools.client.models.RunDelegatedSignTransactionRequest](docs/RunDelegatedSignTransactionRequest.md) + - [org.openapitools.client.models.RunInvokeRequest](docs/RunInvokeRequest.md) + - [org.openapitools.client.models.RunInvokeResponse](docs/RunInvokeResponse.md) - [org.openapitools.client.models.RunTransactionRequest](docs/RunTransactionRequest.md) - [org.openapitools.client.models.RunTransactionResponse](docs/RunTransactionResponse.md) - [org.openapitools.client.models.RunTransactionResponseType](docs/RunTransactionResponseType.md) diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index f6f22fd11f..644bef8efc 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -29,6 +29,8 @@ import org.openapitools.client.models.GetChainInfoRequestV1 import org.openapitools.client.models.GetChainInfoResponseV1 import org.openapitools.client.models.GetDiscoveryResultsRequestV1 import org.openapitools.client.models.GetDiscoveryResultsResponseV1 +import org.openapitools.client.models.GetLatestBlockNumberRequestV1 +import org.openapitools.client.models.GetLatestBlockNumberResponseV1 import org.openapitools.client.models.GetTransactionReceiptResponse import org.openapitools.client.models.RunDelegatedSignTransactionRequest import org.openapitools.client.models.RunTransactionRequest @@ -346,6 +348,78 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient ) } + /** + * Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * + * @param getLatestBlockNumberRequestV1 (optional) + * @return GetLatestBlockNumberResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getLatestBlockNumberV1(getLatestBlockNumberRequestV1: GetLatestBlockNumberRequestV1? = null) : GetLatestBlockNumberResponseV1 { + val localVarResponse = getLatestBlockNumberV1WithHttpInfo(getLatestBlockNumberRequestV1 = getLatestBlockNumberRequestV1) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as GetLatestBlockNumberResponseV1 + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * + * @param getLatestBlockNumberRequestV1 (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getLatestBlockNumberV1WithHttpInfo(getLatestBlockNumberRequestV1: GetLatestBlockNumberRequestV1?) : ApiResponse { + val localVariableConfig = getLatestBlockNumberV1RequestConfig(getLatestBlockNumberRequestV1 = getLatestBlockNumberRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getLatestBlockNumberV1 + * + * @param getLatestBlockNumberRequestV1 (optional) + * @return RequestConfig + */ + fun getLatestBlockNumberV1RequestConfig(getLatestBlockNumberRequestV1: GetLatestBlockNumberRequestV1?) : RequestConfig { + val localVariableBody = getLatestBlockNumberRequestV1 + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + /** * Get the Prometheus Metrics * diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EndorsedProposalResponse.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EndorsedProposalResponse.kt new file mode 100644 index 0000000000..fce4df3321 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EndorsedProposalResponse.kt @@ -0,0 +1,41 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Endorsement +import org.openapitools.client.models.ProposalResponsePayload + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param payload + * @param endorsement + */ + + +data class EndorsedProposalResponse ( + + @Json(name = "payload") + val payload: ProposalResponsePayload? = null, + + @Json(name = "endorsement") + val endorsement: Endorsement? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Endorsement.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Endorsement.kt new file mode 100644 index 0000000000..35c95e291a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Endorsement.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param endorser + * @param signature + */ + + +data class Endorsement ( + + @Json(name = "endorser") + val endorser: kotlin.ByteArray? = null, + + @Json(name = "signature") + val signature: kotlin.ByteArray? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EventType.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EventType.kt new file mode 100644 index 0000000000..879a91b2d0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EventType.kt @@ -0,0 +1,66 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Type of event to listen supported by Hyperledger Fabric + * + * Values: `contract`,block,commit + */ + +@JsonClass(generateAdapter = false) +enum class EventType(val value: kotlin.String) { + + @Json(name = "Contract") + `contract`("Contract"), + + @Json(name = "Block") + block("Block"), + + @Json(name = "Commit") + commit("Commit"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): String = value + + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is EventType) "$data" else null + + /** + * Returns a valid [EventType] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): EventType? = data?.let { + val normalizedData = "$it".lowercase() + values().firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } + } +} + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FabricView.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FabricView.kt new file mode 100644 index 0000000000..65e23dce5c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/FabricView.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.EndorsedProposalResponse + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param endorsedProposalResponses + */ + + +data class FabricView ( + + @Json(name = "endorsedProposalResponses") + val endorsedProposalResponses: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberRequestV1.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberRequestV1.kt new file mode 100644 index 0000000000..13842365a3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberRequestV1.kt @@ -0,0 +1,41 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.GatewayOptions + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Request for GetBlockNumber endpoint. + * + * @param channelName Fabric channel which we want to query. + * @param gatewayOptions + */ + + +data class GetLatestBlockNumberRequestV1 ( + + /* Fabric channel which we want to query. */ + @Json(name = "channelName") + val channelName: kotlin.String, + + @Json(name = "gatewayOptions") + val gatewayOptions: GatewayOptions + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberResponseV1.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberResponseV1.kt new file mode 100644 index 0000000000..d1731f7774 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetLatestBlockNumberResponseV1.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * Response from GetBlockNumber endpoint. + * + * @param blockNumber Number of the block that was queried. + */ + + +data class GetLatestBlockNumberResponseV1 ( + + /* Number of the block that was queried. */ + @Json(name = "blockNumber") + val blockNumber: java.math.BigDecimal + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ProposalResponsePayload.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ProposalResponsePayload.kt new file mode 100644 index 0000000000..0b6c5b7d72 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ProposalResponsePayload.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param proposalHash + * @param extension + */ + + +data class ProposalResponsePayload ( + + @Json(name = "proposalHash") + val proposalHash: kotlin.ByteArray? = null, + + @Json(name = "extension") + val extension: kotlin.ByteArray? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeRequest.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeRequest.kt new file mode 100644 index 0000000000..db495f1df3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeRequest.kt @@ -0,0 +1,66 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FabricSigningCredential +import org.openapitools.client.models.GatewayOptions + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param channelName + * @param contractName + * @param methodName + * @param params + * @param transientData + * @param gatewayOptions + * @param signingCredential + * @param policies List of endorsers + */ + + +data class RunInvokeRequest ( + + @Json(name = "channelName") + val channelName: kotlin.String, + + @Json(name = "contractName") + val contractName: kotlin.String, + + @Json(name = "methodName") + val methodName: kotlin.String, + + @Json(name = "params") + val params: kotlin.collections.List = arrayListOf(), + + @Json(name = "transientData") + val transientData: kotlin.Any? = null, + + @Json(name = "gatewayOptions") + val gatewayOptions: GatewayOptions? = null, + + @Json(name = "signingCredential") + val signingCredential: FabricSigningCredential? = null, + + /* List of endorsers */ + @Json(name = "policies") + val policies: kotlin.collections.List? = arrayListOf() + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeResponse.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeResponse.kt new file mode 100644 index 0000000000..ee7acf5d4b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunInvokeResponse.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.FabricView + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param view + */ + + +data class RunInvokeResponse ( + + @Json(name = "view") + val view: FabricView + +) + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt index ef4de914af..047b7e3179 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionRequest.kt @@ -26,7 +26,6 @@ import com.squareup.moshi.JsonClass /** * * - * @param signingCredential * @param channelName * @param contractName * @param invocationType @@ -36,15 +35,13 @@ import com.squareup.moshi.JsonClass * @param endorsingOrgs An array of endorsing organizations (by mspID or issuer org name on certificate) for the transaction. * @param transientData * @param gatewayOptions + * @param signingCredential * @param responseType */ data class RunTransactionRequest ( - @Json(name = "signingCredential") - val signingCredential: FabricSigningCredential, - @Json(name = "channelName") val channelName: kotlin.String, @@ -74,6 +71,9 @@ data class RunTransactionRequest ( @Json(name = "gatewayOptions") val gatewayOptions: GatewayOptions? = null, + @Json(name = "signingCredential") + val signingCredential: FabricSigningCredential? = null, + @Json(name = "responseType") val responseType: RunTransactionResponseType? = null diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/utils.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/utils.ts index fbd8a2eb77..61bd55414c 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/utils.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/common/utils.ts @@ -2,6 +2,7 @@ import Long from "long"; import { FabricSigningCredential, GatewayOptions, + EventType, } from "../generated/openapi/typescript-axios/api"; /** @@ -83,4 +84,11 @@ export interface CreateListenerRequest { * @memberof CreateListenerRequest */ signingCredential?: FabricSigningCredential; + + /** + * + * @type {EnventType} + * @memberof CreateListenerRequest + */ + eventType: EventType; } diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts index fb95caa4b6..efc59934a0 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -531,6 +531,44 @@ export interface DeploymentTargetOrganization { */ 'ORDERER_TLS_ROOTCERT': string; } +/** + * + * @export + * @interface EndorsedProposalResponse + */ +export interface EndorsedProposalResponse { + /** + * + * @type {ProposalResponsePayload} + * @memberof EndorsedProposalResponse + */ + 'payload'?: ProposalResponsePayload; + /** + * + * @type {Endorsement} + * @memberof EndorsedProposalResponse + */ + 'endorsement'?: Endorsement; +} +/** + * + * @export + * @interface Endorsement + */ +export interface Endorsement { + /** + * + * @type {string} + * @memberof Endorsement + */ + 'endorser'?: string; + /** + * + * @type {string} + * @memberof Endorsement + */ + 'signature'?: string; +} /** * * @export @@ -550,6 +588,21 @@ export interface ErrorExceptionResponseV1 { */ 'error': string; } +/** + * Type of event to listen supported by Hyperledger Fabric + * @export + * @enum {string} + */ + +export const EventType = { + Contract: 'Contract', + Block: 'Block', + Commit: 'Commit' +} as const; + +export type EventType = typeof EventType[keyof typeof EventType]; + + /** * Combination of certificate and it\'s MSP ID used to identify fabric actors. * @export @@ -638,6 +691,19 @@ export const FabricSigningCredentialType = { export type FabricSigningCredentialType = typeof FabricSigningCredentialType[keyof typeof FabricSigningCredentialType]; +/** + * + * @export + * @interface FabricView + */ +export interface FabricView { + /** + * + * @type {Array} + * @memberof FabricView + */ + 'endorsedProposalResponses'?: Array; +} /** * Transaction endorser certificate object * @export @@ -1313,6 +1379,38 @@ export interface GetDiscoveryResultsResponseV1PeersByMSPValuePeersInnerChaincode */ 'version': string; } +/** + * Request for GetBlockNumber endpoint. + * @export + * @interface GetLatestBlockNumberRequestV1 + */ +export interface GetLatestBlockNumberRequestV1 { + /** + * Fabric channel which we want to query. + * @type {string} + * @memberof GetLatestBlockNumberRequestV1 + */ + 'channelName': string; + /** + * + * @type {GatewayOptions} + * @memberof GetLatestBlockNumberRequestV1 + */ + 'gatewayOptions': GatewayOptions; +} +/** + * Response from GetBlockNumber endpoint. + * @export + * @interface GetLatestBlockNumberResponseV1 + */ +export interface GetLatestBlockNumberResponseV1 { + /** + * Number of the block that was queried. + * @type {number} + * @memberof GetLatestBlockNumberResponseV1 + */ + 'blockNumber': number; +} /** * * @export @@ -1380,6 +1478,25 @@ export interface GetTransactionReceiptResponse { */ 'rwsetWriteData'?: string; } +/** + * + * @export + * @interface ProposalResponsePayload + */ +export interface ProposalResponsePayload { + /** + * + * @type {string} + * @memberof ProposalResponsePayload + */ + 'proposalHash'?: string; + /** + * + * @type {string} + * @memberof ProposalResponsePayload + */ + 'extension'?: string; +} /** * * @export @@ -1461,6 +1578,74 @@ export interface RunDelegatedSignTransactionRequest { } +/** + * + * @export + * @interface RunInvokeRequest + */ +export interface RunInvokeRequest { + /** + * + * @type {object} + * @memberof RunInvokeRequest + */ + 'transientData'?: object | null; + /** + * + * @type {GatewayOptions} + * @memberof RunInvokeRequest + */ + 'gatewayOptions'?: GatewayOptions; + /** + * + * @type {FabricSigningCredential} + * @memberof RunInvokeRequest + */ + 'signingCredential'?: FabricSigningCredential; + /** + * + * @type {string} + * @memberof RunInvokeRequest + */ + 'channelName': string; + /** + * + * @type {string} + * @memberof RunInvokeRequest + */ + 'contractName': string; + /** + * + * @type {string} + * @memberof RunInvokeRequest + */ + 'methodName': string; + /** + * + * @type {Array} + * @memberof RunInvokeRequest + */ + 'params': Array; + /** + * List of endorsers + * @type {Array} + * @memberof RunInvokeRequest + */ + 'policies'?: Array | null; +} +/** + * + * @export + * @interface RunInvokeResponse + */ +export interface RunInvokeResponse { + /** + * + * @type {FabricView} + * @memberof RunInvokeResponse + */ + 'view': FabricView; +} /** * * @export @@ -1496,7 +1681,7 @@ export interface RunTransactionRequest { * @type {FabricSigningCredential} * @memberof RunTransactionRequest */ - 'signingCredential': FabricSigningCredential; + 'signingCredential'?: FabricSigningCredential; /** * * @type {string} @@ -2028,6 +2213,40 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * @param {GetLatestBlockNumberRequestV1} [getLatestBlockNumberRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLatestBlockNumberV1: async (getLatestBlockNumberRequestV1?: GetLatestBlockNumberRequestV1, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number`; + // 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(getLatestBlockNumberRequestV1, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @summary Get the Prometheus Metrics @@ -2220,6 +2439,17 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * @param {GetLatestBlockNumberRequestV1} [getLatestBlockNumberRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getLatestBlockNumberV1(getLatestBlockNumberRequestV1?: GetLatestBlockNumberRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getLatestBlockNumberV1(getLatestBlockNumberRequestV1, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @summary Get the Prometheus Metrics @@ -2313,6 +2543,16 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa getDiscoveryResultsV1(getDiscoveryResultsRequestV1?: GetDiscoveryResultsRequestV1, options?: any): AxiosPromise { return localVarFp.getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * @param {GetLatestBlockNumberRequestV1} [getLatestBlockNumberRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getLatestBlockNumberV1(getLatestBlockNumberRequestV1?: GetLatestBlockNumberRequestV1, options?: any): AxiosPromise { + return localVarFp.getLatestBlockNumberV1(getLatestBlockNumberRequestV1, options).then((request) => request(axios, basePath)); + }, /** * * @summary Get the Prometheus Metrics @@ -2410,6 +2650,18 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).getDiscoveryResultsV1(getDiscoveryResultsRequestV1, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary Get block number from the channel using one of selectors from the input. Works only on Fabric 2.x. + * @param {GetLatestBlockNumberRequestV1} [getLatestBlockNumberRequestV1] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getLatestBlockNumberV1(getLatestBlockNumberRequestV1?: GetLatestBlockNumberRequestV1, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getLatestBlockNumberV1(getLatestBlockNumberRequestV1, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Get the Prometheus Metrics diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/access_control_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/access_control_pb.ts new file mode 100644 index 0000000000..6ec3ed55af --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/access_control_pb.ts @@ -0,0 +1,77 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/access_control.proto (package common.access_control, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/access_control.proto. + */ +export const file_common_access_control: GenFile = /*@__PURE__*/ + fileDesc("Chtjb21tb24vYWNjZXNzX2NvbnRyb2wucHJvdG8SFWNvbW1vbi5hY2Nlc3NfY29udHJvbCJZChNBY2Nlc3NDb250cm9sUG9saWN5EhYKDnNlY3VyaXR5RG9tYWluGAEgASgJEioKBXJ1bGVzGAIgAygLMhsuY29tbW9uLmFjY2Vzc19jb250cm9sLlJ1bGUiUAoEUnVsZRIRCglwcmluY2lwYWwYASABKAkSFQoNcHJpbmNpcGFsVHlwZRgCIAEoCRIQCghyZXNvdXJjZRgDIAEoCRIMCgRyZWFkGAQgASgIQoEBCjlvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24uYWNjZXNzX2NvbnRyb2xaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM"); + +/** + * AccessControlPolicy specifies a set of data that can be accessed by some + * SecurityGroup + * + * @generated from message common.access_control.AccessControlPolicy + */ +export type AccessControlPolicy = Message<"common.access_control.AccessControlPolicy"> & { + /** + * @generated from field: string securityDomain = 1; + */ + securityDomain: string; + + /** + * @generated from field: repeated common.access_control.Rule rules = 2; + */ + rules: Rule[]; +}; + +/** + * Describes the message common.access_control.AccessControlPolicy. + * Use `create(AccessControlPolicySchema)` to create a new message. + */ +export const AccessControlPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_access_control, 0); + +/** + * Rule represents a single data access rule for the AccessControlPolicy + * + * @generated from message common.access_control.Rule + */ +export type Rule = Message<"common.access_control.Rule"> & { + /** + * @generated from field: string principal = 1; + */ + principal: string; + + /** + * @generated from field: string principalType = 2; + */ + principalType: string; + + /** + * @generated from field: string resource = 3; + */ + resource: string; + + /** + * @generated from field: bool read = 4; + */ + read: boolean; +}; + +/** + * Describes the message common.access_control.Rule. + * Use `create(RuleSchema)` to create a new message. + */ +export const RuleSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_access_control, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ack_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ack_pb.ts new file mode 100644 index 0000000000..a831ac6543 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ack_pb.ts @@ -0,0 +1,72 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/ack.proto (package common.ack, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/ack.proto. + */ +export const file_common_ack: GenFile = /*@__PURE__*/ + fileDesc("ChBjb21tb24vYWNrLnByb3RvEgpjb21tb24uYWNrIm8KA0FjaxImCgZzdGF0dXMYAiABKA4yFi5jb21tb24uYWNrLkFjay5TVEFUVVMSEgoKcmVxdWVzdF9pZBgDIAEoCRIPCgdtZXNzYWdlGAQgASgJIhsKBlNUQVRVUxIGCgJPSxAAEgkKBUVSUk9SEAFCdgoub3JnLmh5cGVybGVkZ2VyLmNhY3RpLndlYXZlci5wcm90b3MuY29tbW9uLmFja1pEZ2l0aHViLmNvbS9oeXBlcmxlZGdlci1jYWN0aS9jYWN0aS93ZWF2ZXIvY29tbW9uL3Byb3Rvcy1nby92Mi9jb21tb25iBnByb3RvMw"); + +/** + * This message respresents "ACKs" sent between relay-relay, + * relay-driver and relay-network + * + * @generated from message common.ack.Ack + */ +export type Ack = Message<"common.ack.Ack"> & { + /** + * @generated from field: common.ack.Ack.STATUS status = 2; + */ + status: Ack_STATUS; + + /** + * @generated from field: string request_id = 3; + */ + requestId: string; + + /** + * an error can have an associated string + * this is the best way to represent this in protobuf + * + * @generated from field: string message = 4; + */ + message: string; +}; + +/** + * Describes the message common.ack.Ack. + * Use `create(AckSchema)` to create a new message. + */ +export const AckSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_ack, 0); + +/** + * @generated from enum common.ack.Ack.STATUS + */ +export enum Ack_STATUS { + /** + * @generated from enum value: OK = 0; + */ + OK = 0, + + /** + * @generated from enum value: ERROR = 1; + */ + ERROR = 1, +} + +/** + * Describes the enum common.ack.Ack.STATUS. + */ +export const Ack_STATUSSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_ack, 0, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_locks_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_locks_pb.ts new file mode 100644 index 0000000000..57e732c3ae --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_locks_pb.ts @@ -0,0 +1,344 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/asset_locks.proto (package common.asset_locks, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/asset_locks.proto. + */ +export const file_common_asset_locks: GenFile = /*@__PURE__*/ + fileDesc("Chhjb21tb24vYXNzZXRfbG9ja3MucHJvdG8SEmNvbW1vbi5hc3NldF9sb2NrcyJXCglBc3NldExvY2sSOAoNbG9ja01lY2hhbmlzbRgBIAEoDjIhLmNvbW1vbi5hc3NldF9sb2Nrcy5Mb2NrTWVjaGFuaXNtEhAKCGxvY2tJbmZvGAIgASgMIlkKCkFzc2V0Q2xhaW0SOAoNbG9ja01lY2hhbmlzbRgBIAEoDjIhLmNvbW1vbi5hc3NldF9sb2Nrcy5Mb2NrTWVjaGFuaXNtEhEKCWNsYWltSW5mbxgCIAEoDCKlAQoNQXNzZXRMb2NrSFRMQxI4Cg1oYXNoTWVjaGFuaXNtGAEgASgOMiEuY29tbW9uLmFzc2V0X2xvY2tzLkhhc2hNZWNoYW5pc20SEgoKaGFzaEJhc2U2NBgCIAEoDBIWCg5leHBpcnlUaW1lU2VjcxgDIAEoBBIuCgh0aW1lU3BlYxgEIAEoDjIcLmNvbW1vbi5hc3NldF9sb2Nrcy5UaW1lU3BlYyJmCg5Bc3NldENsYWltSFRMQxI4Cg1oYXNoTWVjaGFuaXNtGAEgASgOMiEuY29tbW9uLmFzc2V0X2xvY2tzLkhhc2hNZWNoYW5pc20SGgoSaGFzaFByZWltYWdlQmFzZTY0GAIgASgMIloKFkFzc2V0RXhjaGFuZ2VBZ3JlZW1lbnQSEQoJYXNzZXRUeXBlGAEgASgJEgoKAmlkGAIgASgJEg4KBmxvY2tlchgDIAEoCRIRCglyZWNpcGllbnQYBCABKAkihQEKHEh5YnJpZEFzc2V0RXhjaGFuZ2VBZ3JlZW1lbnQSEQoJYXNzZXRUeXBlGAEgASgJEgoKAmlkGAIgASgJEhEKCWFzc2V0RGF0YRgDIAEoDBIQCghudW1Vbml0cxgEIAEoBBIOCgZsb2NrZXIYBSABKAkSEQoJcmVjaXBpZW50GAYgASgJImgKHkZ1bmdpYmxlQXNzZXRFeGNoYW5nZUFncmVlbWVudBIRCglhc3NldFR5cGUYASABKAkSEAoIbnVtVW5pdHMYAiABKAQSDgoGbG9ja2VyGAMgASgJEhEKCXJlY2lwaWVudBgEIAEoCSLKAQoRQXNzZXRDb250cmFjdEhUTEMSEgoKY29udHJhY3RJZBgBIAEoCRI9CglhZ3JlZW1lbnQYAiABKAsyKi5jb21tb24uYXNzZXRfbG9ja3MuQXNzZXRFeGNoYW5nZUFncmVlbWVudBIvCgRsb2NrGAMgASgLMiEuY29tbW9uLmFzc2V0X2xvY2tzLkFzc2V0TG9ja0hUTEMSMQoFY2xhaW0YBCABKAsyIi5jb21tb24uYXNzZXRfbG9ja3MuQXNzZXRDbGFpbUhUTEMi2gEKGUZ1bmdpYmxlQXNzZXRDb250cmFjdEhUTEMSEgoKY29udHJhY3RJZBgBIAEoCRJFCglhZ3JlZW1lbnQYAiABKAsyMi5jb21tb24uYXNzZXRfbG9ja3MuRnVuZ2libGVBc3NldEV4Y2hhbmdlQWdyZWVtZW50Ei8KBGxvY2sYAyABKAsyIS5jb21tb24uYXNzZXRfbG9ja3MuQXNzZXRMb2NrSFRMQxIxCgVjbGFpbRgEIAEoCzIiLmNvbW1vbi5hc3NldF9sb2Nrcy5Bc3NldENsYWltSFRMQyoZCg1Mb2NrTWVjaGFuaXNtEggKBEhUTEMQAConCg1IYXNoTWVjaGFuaXNtEgoKBlNIQTI1NhAAEgoKBlNIQTUxMhABKiMKCFRpbWVTcGVjEgkKBUVQT0NIEAASDAoIRFVSQVRJT04QAUJ+CjZvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24uYXNzZXRfbG9ja3NaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM"); + +/** + * @generated from message common.asset_locks.AssetLock + */ +export type AssetLock = Message<"common.asset_locks.AssetLock"> & { + /** + * @generated from field: common.asset_locks.LockMechanism lockMechanism = 1; + */ + lockMechanism: LockMechanism; + + /** + * @generated from field: bytes lockInfo = 2; + */ + lockInfo: Uint8Array; +}; + +/** + * Describes the message common.asset_locks.AssetLock. + * Use `create(AssetLockSchema)` to create a new message. + */ +export const AssetLockSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 0); + +/** + * @generated from message common.asset_locks.AssetClaim + */ +export type AssetClaim = Message<"common.asset_locks.AssetClaim"> & { + /** + * @generated from field: common.asset_locks.LockMechanism lockMechanism = 1; + */ + lockMechanism: LockMechanism; + + /** + * @generated from field: bytes claimInfo = 2; + */ + claimInfo: Uint8Array; +}; + +/** + * Describes the message common.asset_locks.AssetClaim. + * Use `create(AssetClaimSchema)` to create a new message. + */ +export const AssetClaimSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 1); + +/** + * @generated from message common.asset_locks.AssetLockHTLC + */ +export type AssetLockHTLC = Message<"common.asset_locks.AssetLockHTLC"> & { + /** + * @generated from field: common.asset_locks.HashMechanism hashMechanism = 1; + */ + hashMechanism: HashMechanism; + + /** + * @generated from field: bytes hashBase64 = 2; + */ + hashBase64: Uint8Array; + + /** + * @generated from field: uint64 expiryTimeSecs = 3; + */ + expiryTimeSecs: bigint; + + /** + * @generated from field: common.asset_locks.TimeSpec timeSpec = 4; + */ + timeSpec: TimeSpec; +}; + +/** + * Describes the message common.asset_locks.AssetLockHTLC. + * Use `create(AssetLockHTLCSchema)` to create a new message. + */ +export const AssetLockHTLCSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 2); + +/** + * @generated from message common.asset_locks.AssetClaimHTLC + */ +export type AssetClaimHTLC = Message<"common.asset_locks.AssetClaimHTLC"> & { + /** + * @generated from field: common.asset_locks.HashMechanism hashMechanism = 1; + */ + hashMechanism: HashMechanism; + + /** + * @generated from field: bytes hashPreimageBase64 = 2; + */ + hashPreimageBase64: Uint8Array; +}; + +/** + * Describes the message common.asset_locks.AssetClaimHTLC. + * Use `create(AssetClaimHTLCSchema)` to create a new message. + */ +export const AssetClaimHTLCSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 3); + +/** + * @generated from message common.asset_locks.AssetExchangeAgreement + */ +export type AssetExchangeAgreement = Message<"common.asset_locks.AssetExchangeAgreement"> & { + /** + * @generated from field: string assetType = 1; + */ + assetType: string; + + /** + * @generated from field: string id = 2; + */ + id: string; + + /** + * @generated from field: string locker = 3; + */ + locker: string; + + /** + * @generated from field: string recipient = 4; + */ + recipient: string; +}; + +/** + * Describes the message common.asset_locks.AssetExchangeAgreement. + * Use `create(AssetExchangeAgreementSchema)` to create a new message. + */ +export const AssetExchangeAgreementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 4); + +/** + * @generated from message common.asset_locks.HybridAssetExchangeAgreement + */ +export type HybridAssetExchangeAgreement = Message<"common.asset_locks.HybridAssetExchangeAgreement"> & { + /** + * @generated from field: string assetType = 1; + */ + assetType: string; + + /** + * @generated from field: string id = 2; + */ + id: string; + + /** + * @generated from field: bytes assetData = 3; + */ + assetData: Uint8Array; + + /** + * @generated from field: uint64 numUnits = 4; + */ + numUnits: bigint; + + /** + * @generated from field: string locker = 5; + */ + locker: string; + + /** + * @generated from field: string recipient = 6; + */ + recipient: string; +}; + +/** + * Describes the message common.asset_locks.HybridAssetExchangeAgreement. + * Use `create(HybridAssetExchangeAgreementSchema)` to create a new message. + */ +export const HybridAssetExchangeAgreementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 5); + +/** + * @generated from message common.asset_locks.FungibleAssetExchangeAgreement + */ +export type FungibleAssetExchangeAgreement = Message<"common.asset_locks.FungibleAssetExchangeAgreement"> & { + /** + * @generated from field: string assetType = 1; + */ + assetType: string; + + /** + * @generated from field: uint64 numUnits = 2; + */ + numUnits: bigint; + + /** + * @generated from field: string locker = 3; + */ + locker: string; + + /** + * @generated from field: string recipient = 4; + */ + recipient: string; +}; + +/** + * Describes the message common.asset_locks.FungibleAssetExchangeAgreement. + * Use `create(FungibleAssetExchangeAgreementSchema)` to create a new message. + */ +export const FungibleAssetExchangeAgreementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 6); + +/** + * @generated from message common.asset_locks.AssetContractHTLC + */ +export type AssetContractHTLC = Message<"common.asset_locks.AssetContractHTLC"> & { + /** + * @generated from field: string contractId = 1; + */ + contractId: string; + + /** + * @generated from field: common.asset_locks.AssetExchangeAgreement agreement = 2; + */ + agreement?: AssetExchangeAgreement; + + /** + * @generated from field: common.asset_locks.AssetLockHTLC lock = 3; + */ + lock?: AssetLockHTLC; + + /** + * @generated from field: common.asset_locks.AssetClaimHTLC claim = 4; + */ + claim?: AssetClaimHTLC; +}; + +/** + * Describes the message common.asset_locks.AssetContractHTLC. + * Use `create(AssetContractHTLCSchema)` to create a new message. + */ +export const AssetContractHTLCSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 7); + +/** + * @generated from message common.asset_locks.FungibleAssetContractHTLC + */ +export type FungibleAssetContractHTLC = Message<"common.asset_locks.FungibleAssetContractHTLC"> & { + /** + * @generated from field: string contractId = 1; + */ + contractId: string; + + /** + * @generated from field: common.asset_locks.FungibleAssetExchangeAgreement agreement = 2; + */ + agreement?: FungibleAssetExchangeAgreement; + + /** + * @generated from field: common.asset_locks.AssetLockHTLC lock = 3; + */ + lock?: AssetLockHTLC; + + /** + * @generated from field: common.asset_locks.AssetClaimHTLC claim = 4; + */ + claim?: AssetClaimHTLC; +}; + +/** + * Describes the message common.asset_locks.FungibleAssetContractHTLC. + * Use `create(FungibleAssetContractHTLCSchema)` to create a new message. + */ +export const FungibleAssetContractHTLCSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_locks, 8); + +/** + * @generated from enum common.asset_locks.LockMechanism + */ +export enum LockMechanism { + /** + * @generated from enum value: HTLC = 0; + */ + HTLC = 0, +} + +/** + * Describes the enum common.asset_locks.LockMechanism. + */ +export const LockMechanismSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_asset_locks, 0); + +/** + * @generated from enum common.asset_locks.HashMechanism + */ +export enum HashMechanism { + /** + * @generated from enum value: SHA256 = 0; + */ + SHA256 = 0, + + /** + * @generated from enum value: SHA512 = 1; + */ + SHA512 = 1, +} + +/** + * Describes the enum common.asset_locks.HashMechanism. + */ +export const HashMechanismSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_asset_locks, 1); + +/** + * @generated from enum common.asset_locks.TimeSpec + */ +export enum TimeSpec { + /** + * @generated from enum value: EPOCH = 0; + */ + EPOCH = 0, + + /** + * @generated from enum value: DURATION = 1; + */ + DURATION = 1, +} + +/** + * Describes the enum common.asset_locks.TimeSpec. + */ +export const TimeSpecSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_asset_locks, 2); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_transfer_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_transfer_pb.ts new file mode 100644 index 0000000000..ebbd2c7871 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/asset_transfer_pb.ts @@ -0,0 +1,102 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/asset_transfer.proto (package common.asset_transfer, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/asset_transfer.proto. + */ +export const file_common_asset_transfer: GenFile = /*@__PURE__*/ + fileDesc("Chtjb21tb24vYXNzZXRfdHJhbnNmZXIucHJvdG8SFWNvbW1vbi5hc3NldF90cmFuc2ZlciJ/CgtBc3NldFBsZWRnZRIUCgxhc3NldERldGFpbHMYASABKAwSFgoObG9jYWxOZXR3b3JrSUQYAiABKAkSFwoPcmVtb3RlTmV0d29ya0lEGAMgASgJEhEKCXJlY2lwaWVudBgEIAEoCRIWCg5leHBpcnlUaW1lU2VjcxgFIAEoBCKzAQoQQXNzZXRDbGFpbVN0YXR1cxIUCgxhc3NldERldGFpbHMYASABKAwSFgoObG9jYWxOZXR3b3JrSUQYAiABKAkSFwoPcmVtb3RlTmV0d29ya0lEGAMgASgJEhEKCXJlY2lwaWVudBgEIAEoCRITCgtjbGFpbVN0YXR1cxgFIAEoCBIWCg5leHBpcnlUaW1lU2VjcxgGIAEoBBIYChBleHBpcmF0aW9uU3RhdHVzGAcgASgIQoEBCjlvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24uYXNzZXRfdHJhbnNmZXJaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM"); + +/** + * @generated from message common.asset_transfer.AssetPledge + */ +export type AssetPledge = Message<"common.asset_transfer.AssetPledge"> & { + /** + * @generated from field: bytes assetDetails = 1; + */ + assetDetails: Uint8Array; + + /** + * @generated from field: string localNetworkID = 2; + */ + localNetworkID: string; + + /** + * @generated from field: string remoteNetworkID = 3; + */ + remoteNetworkID: string; + + /** + * @generated from field: string recipient = 4; + */ + recipient: string; + + /** + * @generated from field: uint64 expiryTimeSecs = 5; + */ + expiryTimeSecs: bigint; +}; + +/** + * Describes the message common.asset_transfer.AssetPledge. + * Use `create(AssetPledgeSchema)` to create a new message. + */ +export const AssetPledgeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_transfer, 0); + +/** + * @generated from message common.asset_transfer.AssetClaimStatus + */ +export type AssetClaimStatus = Message<"common.asset_transfer.AssetClaimStatus"> & { + /** + * @generated from field: bytes assetDetails = 1; + */ + assetDetails: Uint8Array; + + /** + * @generated from field: string localNetworkID = 2; + */ + localNetworkID: string; + + /** + * @generated from field: string remoteNetworkID = 3; + */ + remoteNetworkID: string; + + /** + * @generated from field: string recipient = 4; + */ + recipient: string; + + /** + * @generated from field: bool claimStatus = 5; + */ + claimStatus: boolean; + + /** + * @generated from field: uint64 expiryTimeSecs = 6; + */ + expiryTimeSecs: bigint; + + /** + * @generated from field: bool expirationStatus = 7; + */ + expirationStatus: boolean; +}; + +/** + * Describes the message common.asset_transfer.AssetClaimStatus. + * Use `create(AssetClaimStatusSchema)` to create a new message. + */ +export const AssetClaimStatusSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_asset_transfer, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/collection_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/collection_pb.ts new file mode 100644 index 0000000000..903172ac36 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/collection_pb.ts @@ -0,0 +1,199 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/collection.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { ApplicationPolicy, SignaturePolicyEnvelope } from "./policies_pb"; +import { file_common_policies } from "./policies_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/collection.proto. + */ +export const file_common_collection: GenFile = /*@__PURE__*/ + fileDesc("Chdjb21tb24vY29sbGVjdGlvbi5wcm90bxIGY29tbW9uIkcKF0NvbGxlY3Rpb25Db25maWdQYWNrYWdlEigKBmNvbmZpZxgBIAMoCzIYLmNvbW1vbi5Db2xsZWN0aW9uQ29uZmlnOgIYASJlChBDb2xsZWN0aW9uQ29uZmlnEkIKGHN0YXRpY19jb2xsZWN0aW9uX2NvbmZpZxgBIAEoCzIeLmNvbW1vbi5TdGF0aWNDb2xsZWN0aW9uQ29uZmlnSAA6AhgBQgkKB3BheWxvYWQiogIKFlN0YXRpY0NvbGxlY3Rpb25Db25maWcSDAoEbmFtZRgBIAEoCRI6ChJtZW1iZXJfb3Jnc19wb2xpY3kYAiABKAsyHi5jb21tb24uQ29sbGVjdGlvblBvbGljeUNvbmZpZxIbChNyZXF1aXJlZF9wZWVyX2NvdW50GAMgASgFEhoKEm1heGltdW1fcGVlcl9jb3VudBgEIAEoBRIVCg1ibG9ja190b19saXZlGAUgASgEEhgKEG1lbWJlcl9vbmx5X3JlYWQYBiABKAgSGQoRbWVtYmVyX29ubHlfd3JpdGUYByABKAgSNQoSZW5kb3JzZW1lbnRfcG9saWN5GAggASgLMhkuY29tbW9uLkFwcGxpY2F0aW9uUG9saWN5OgIYASJkChZDb2xsZWN0aW9uUG9saWN5Q29uZmlnEjsKEHNpZ25hdHVyZV9wb2xpY3kYASABKAsyHy5jb21tb24uU2lnbmF0dXJlUG9saWN5RW52ZWxvcGVIADoCGAFCCQoHcGF5bG9hZEJWCiRvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5jb21tb25aLmdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9jb21tb25iBnByb3RvMw", [file_common_policies]); + +/** + * CollectionConfigPackage represents an array of CollectionConfig + * messages; the extra struct is required because repeated oneof is + * forbidden by the protobuf syntax + * + * @generated from message common.CollectionConfigPackage + * @deprecated + */ +export type CollectionConfigPackage = Message<"common.CollectionConfigPackage"> & { + /** + * @generated from field: repeated common.CollectionConfig config = 1; + */ + config: CollectionConfig[]; +}; + +/** + * Describes the message common.CollectionConfigPackage. + * Use `create(CollectionConfigPackageSchema)` to create a new message. + * @deprecated + */ +export const CollectionConfigPackageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_collection, 0); + +/** + * CollectionConfig defines the configuration of a collection object; + * it currently contains a single, static type. + * Dynamic collections are deferred. + * + * @generated from message common.CollectionConfig + * @deprecated + */ +export type CollectionConfig = Message<"common.CollectionConfig"> & { + /** + * @generated from oneof common.CollectionConfig.payload + * @deprecated + */ + payload: { + /** + * @generated from field: common.StaticCollectionConfig static_collection_config = 1; + */ + value: StaticCollectionConfig; + case: "staticCollectionConfig"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.CollectionConfig. + * Use `create(CollectionConfigSchema)` to create a new message. + * @deprecated + */ +export const CollectionConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_collection, 1); + +/** + * StaticCollectionConfig constitutes the configuration parameters of a + * static collection object. Static collections are collections that are + * known at chaincode instantiation time, and that cannot be changed. + * Dynamic collections are deferred. + * + * @generated from message common.StaticCollectionConfig + * @deprecated + */ +export type StaticCollectionConfig = Message<"common.StaticCollectionConfig"> & { + /** + * the name of the collection inside the denoted chaincode + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * a reference to a policy residing / managed in the config block + * to define which orgs have access to this collection’s private data + * + * @generated from field: common.CollectionPolicyConfig member_orgs_policy = 2; + */ + memberOrgsPolicy?: CollectionPolicyConfig; + + /** + * The minimum number of peers private data will be sent to upon + * endorsement. The endorsement would fail if dissemination to at least + * this number of peers is not achieved. + * + * @generated from field: int32 required_peer_count = 3; + */ + requiredPeerCount: number; + + /** + * The maximum number of peers that private data will be sent to + * upon endorsement. This number has to be bigger than required_peer_count. + * + * @generated from field: int32 maximum_peer_count = 4; + */ + maximumPeerCount: number; + + /** + * The number of blocks after which the collection data expires. + * For instance if the value is set to 10, a key last modified by block number 100 + * will be purged at block number 111. A zero value is treated same as MaxUint64 + * + * @generated from field: uint64 block_to_live = 5; + */ + blockToLive: bigint; + + /** + * The member only read access denotes whether only collection member clients + * can read the private data (if set to true), or even non members can + * read the data (if set to false, for example if you want to implement more granular + * access logic in the chaincode) + * + * @generated from field: bool member_only_read = 6; + */ + memberOnlyRead: boolean; + + /** + * The member only write access denotes whether only collection member clients + * can write the private data (if set to true), or even non members can + * write the data (if set to false, for example if you want to implement more granular + * access logic in the chaincode) + * + * @generated from field: bool member_only_write = 7; + */ + memberOnlyWrite: boolean; + + /** + * a reference to a policy residing / managed in the config block + * to define the endorsement policy for this collection + * + * @generated from field: common.ApplicationPolicy endorsement_policy = 8; + */ + endorsementPolicy?: ApplicationPolicy; +}; + +/** + * Describes the message common.StaticCollectionConfig. + * Use `create(StaticCollectionConfigSchema)` to create a new message. + * @deprecated + */ +export const StaticCollectionConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_collection, 2); + +/** + * Collection policy configuration. Initially, the configuration can only + * contain a SignaturePolicy. In the future, the SignaturePolicy may be a + * more general Policy. Instead of containing the actual policy, the + * configuration may in the future contain a string reference to a policy. + * + * @generated from message common.CollectionPolicyConfig + * @deprecated + */ +export type CollectionPolicyConfig = Message<"common.CollectionPolicyConfig"> & { + /** + * @generated from oneof common.CollectionPolicyConfig.payload + * @deprecated + */ + payload: { + /** + * Initially, only a signature policy is supported. + * + * Later, the SignaturePolicy will be replaced by a Policy. + * Policy policy = 1; + * A reference to a Policy is planned to be added later. + * string reference = 2; + * + * @generated from field: common.SignaturePolicyEnvelope signature_policy = 1; + */ + value: SignaturePolicyEnvelope; + case: "signaturePolicy"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.CollectionPolicyConfig. + * Use `create(CollectionPolicyConfigSchema)` to create a new message. + * @deprecated + */ +export const CollectionPolicyConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_collection, 3); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/common_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/common_pb.ts new file mode 100644 index 0000000000..1737a1b12b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/common_pb.ts @@ -0,0 +1,580 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/common.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/common.proto. + */ +export const file_common_common: GenFile = /*@__PURE__*/ + fileDesc("ChNjb21tb24vY29tbW9uLnByb3RvEgZjb21tb24iGwoKTGFzdENvbmZpZxINCgVpbmRleBgBIAEoBCJICghNZXRhZGF0YRINCgV2YWx1ZRgBIAEoDBItCgpzaWduYXR1cmVzGAIgAygLMhkuY29tbW9uLk1ldGFkYXRhU2lnbmF0dXJlIkAKEU1ldGFkYXRhU2lnbmF0dXJlEhgKEHNpZ25hdHVyZV9oZWFkZXIYASABKAwSEQoJc2lnbmF0dXJlGAIgASgMIjoKBkhlYWRlchIWCg5jaGFubmVsX2hlYWRlchgBIAEoDBIYChBzaWduYXR1cmVfaGVhZGVyGAIgASgMIrkBCg1DaGFubmVsSGVhZGVyEgwKBHR5cGUYASABKAUSDwoHdmVyc2lvbhgCIAEoBRItCgl0aW1lc3RhbXAYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhIKCmNoYW5uZWxfaWQYBCABKAkSDQoFdHhfaWQYBSABKAkSDQoFZXBvY2gYBiABKAQSEQoJZXh0ZW5zaW9uGAcgASgMEhUKDXRsc19jZXJ0X2hhc2gYCCABKAwiMQoPU2lnbmF0dXJlSGVhZGVyEg8KB2NyZWF0b3IYASABKAwSDQoFbm9uY2UYAiABKAwiNwoHUGF5bG9hZBIeCgZoZWFkZXIYASABKAsyDi5jb21tb24uSGVhZGVyEgwKBGRhdGEYAiABKAwiLgoIRW52ZWxvcGUSDwoHcGF5bG9hZBgBIAEoDBIRCglzaWduYXR1cmUYAiABKAwidgoFQmxvY2sSIwoGaGVhZGVyGAEgASgLMhMuY29tbW9uLkJsb2NrSGVhZGVyEh8KBGRhdGEYAiABKAsyES5jb21tb24uQmxvY2tEYXRhEicKCG1ldGFkYXRhGAMgASgLMhUuY29tbW9uLkJsb2NrTWV0YWRhdGEiRwoLQmxvY2tIZWFkZXISDgoGbnVtYmVyGAEgASgEEhUKDXByZXZpb3VzX2hhc2gYAiABKAwSEQoJZGF0YV9oYXNoGAMgASgMIhkKCUJsb2NrRGF0YRIMCgRkYXRhGAEgAygMIiEKDUJsb2NrTWV0YWRhdGESEAoIbWV0YWRhdGEYASADKAwiWwoUT3JkZXJlckJsb2NrTWV0YWRhdGESJwoLbGFzdF9jb25maWcYASABKAsyEi5jb21tb24uTGFzdENvbmZpZxIaChJjb25zZW50ZXJfbWV0YWRhdGEYAiABKAwqwAEKBlN0YXR1cxILCgdVTktOT1dOEAASDAoHU1VDQ0VTUxDIARIQCgtCQURfUkVRVUVTVBCQAxIOCglGT1JCSURERU4QkwMSDgoJTk9UX0ZPVU5EEJQDEh0KGFJFUVVFU1RfRU5USVRZX1RPT19MQVJHRRCdAxIaChVJTlRFUk5BTF9TRVJWRVJfRVJST1IQ9AMSFAoPTk9UX0lNUExFTUVOVEVEEPUDEhgKE1NFUlZJQ0VfVU5BVkFJTEFCTEUQ9wMq6AEKCkhlYWRlclR5cGUSCwoHTUVTU0FHRRAAEgoKBkNPTkZJRxABEhEKDUNPTkZJR19VUERBVEUQAhIYChRFTkRPUlNFUl9UUkFOU0FDVElPThADEhcKE09SREVSRVJfVFJBTlNBQ1RJT04QBBIVChFERUxJVkVSX1NFRUtfSU5GTxAFEhUKEUNIQUlOQ09ERV9QQUNLQUdFEAYSGAoUUEVFUl9BRE1JTl9PUEVSQVRJT04QCCIECAcQByIECAkQCSoUUEVFUl9SRVNPVVJDRV9VUERBVEUqEVRPS0VOX1RSQU5TQUNUSU9OKnQKEkJsb2NrTWV0YWRhdGFJbmRleBIOCgpTSUdOQVRVUkVTEAASEwoLTEFTVF9DT05GSUcQARoCCAESFwoTVFJBTlNBQ1RJT05TX0ZJTFRFUhACEg8KB09SREVSRVIQAxoCCAESDwoLQ09NTUlUX0hBU0gQBEJWCiRvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5jb21tb25aLmdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9jb21tb25iBnByb3RvMw", [file_google_protobuf_timestamp]); + +/** + * LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index + * + * @generated from message common.LastConfig + */ +export type LastConfig = Message<"common.LastConfig"> & { + /** + * @generated from field: uint64 index = 1; + */ + index: bigint; +}; + +/** + * Describes the message common.LastConfig. + * Use `create(LastConfigSchema)` to create a new message. + */ +export const LastConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 0); + +/** + * Metadata is a common structure to be used to encode block metadata + * + * @generated from message common.Metadata + */ +export type Metadata = Message<"common.Metadata"> & { + /** + * @generated from field: bytes value = 1; + */ + value: Uint8Array; + + /** + * @generated from field: repeated common.MetadataSignature signatures = 2; + */ + signatures: MetadataSignature[]; +}; + +/** + * Describes the message common.Metadata. + * Use `create(MetadataSchema)` to create a new message. + */ +export const MetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 1); + +/** + * @generated from message common.MetadataSignature + */ +export type MetadataSignature = Message<"common.MetadataSignature"> & { + /** + * An encoded SignatureHeader + * + * @generated from field: bytes signature_header = 1; + */ + signatureHeader: Uint8Array; + + /** + * The signature over the concatenation of the Metadata value bytes, signatureHeader, and block header + * + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message common.MetadataSignature. + * Use `create(MetadataSignatureSchema)` to create a new message. + */ +export const MetadataSignatureSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 2); + +/** + * @generated from message common.Header + */ +export type Header = Message<"common.Header"> & { + /** + * @generated from field: bytes channel_header = 1; + */ + channelHeader: Uint8Array; + + /** + * @generated from field: bytes signature_header = 2; + */ + signatureHeader: Uint8Array; +}; + +/** + * Describes the message common.Header. + * Use `create(HeaderSchema)` to create a new message. + */ +export const HeaderSchema: GenMessage
= /*@__PURE__*/ + messageDesc(file_common_common, 3); + +/** + * Header is a generic replay prevention and identity message to include in a signed payload + * + * @generated from message common.ChannelHeader + */ +export type ChannelHeader = Message<"common.ChannelHeader"> & { + /** + * Header types 0-10000 are reserved and defined by HeaderType + * + * @generated from field: int32 type = 1; + */ + type: number; + + /** + * Version indicates message protocol version + * + * @generated from field: int32 version = 2; + */ + version: number; + + /** + * Timestamp is the local time when the message was created + * by the sender + * + * @generated from field: google.protobuf.Timestamp timestamp = 3; + */ + timestamp?: Timestamp; + + /** + * Identifier of the channel this message is bound for + * + * @generated from field: string channel_id = 4; + */ + channelId: string; + + /** + * An unique identifier that is used end-to-end. + * - set by higher layers such as end user or SDK + * - passed to the endorser (which will check for uniqueness) + * - as the header is passed along unchanged, it will be + * be retrieved by the committer (uniqueness check here as well) + * - to be stored in the ledger + * + * @generated from field: string tx_id = 5; + */ + txId: string; + + /** + * The epoch in which this header was generated, where epoch is defined based on block height + * Epoch in which the response has been generated. This field identifies a + * logical window of time. A proposal response is accepted by a peer only if + * two conditions hold: + * 1. the epoch specified in the message is the current epoch + * 2. this message has been only seen once during this epoch (i.e. it hasn't + * been replayed) + * + * @generated from field: uint64 epoch = 6; + */ + epoch: bigint; + + /** + * Extension that may be attached based on the header type + * + * @generated from field: bytes extension = 7; + */ + extension: Uint8Array; + + /** + * If mutual TLS is employed, this represents + * the hash of the client's TLS certificate + * + * @generated from field: bytes tls_cert_hash = 8; + */ + tlsCertHash: Uint8Array; +}; + +/** + * Describes the message common.ChannelHeader. + * Use `create(ChannelHeaderSchema)` to create a new message. + */ +export const ChannelHeaderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 4); + +/** + * @generated from message common.SignatureHeader + */ +export type SignatureHeader = Message<"common.SignatureHeader"> & { + /** + * Creator of the message, a marshaled msp.SerializedIdentity + * + * @generated from field: bytes creator = 1; + */ + creator: Uint8Array; + + /** + * Arbitrary number that may only be used once. Can be used to detect replay attacks. + * + * @generated from field: bytes nonce = 2; + */ + nonce: Uint8Array; +}; + +/** + * Describes the message common.SignatureHeader. + * Use `create(SignatureHeaderSchema)` to create a new message. + */ +export const SignatureHeaderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 5); + +/** + * Payload is the message contents (and header to allow for signing) + * + * @generated from message common.Payload + */ +export type Payload = Message<"common.Payload"> & { + /** + * Header is included to provide identity and prevent replay + * + * @generated from field: common.Header header = 1; + */ + header?: Header; + + /** + * Data, the encoding of which is defined by the type in the header + * + * @generated from field: bytes data = 2; + */ + data: Uint8Array; +}; + +/** + * Describes the message common.Payload. + * Use `create(PayloadSchema)` to create a new message. + */ +export const PayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 6); + +/** + * Envelope wraps a Payload with a signature so that the message may be authenticated + * + * @generated from message common.Envelope + */ +export type Envelope = Message<"common.Envelope"> & { + /** + * A marshaled Payload + * + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * A signature by the creator specified in the Payload header + * + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message common.Envelope. + * Use `create(EnvelopeSchema)` to create a new message. + */ +export const EnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 7); + +/** + * This is finalized block structure to be shared among the orderer and peer + * Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded + * in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but + * the Metadata is not. + * + * @generated from message common.Block + */ +export type Block = Message<"common.Block"> & { + /** + * @generated from field: common.BlockHeader header = 1; + */ + header?: BlockHeader; + + /** + * @generated from field: common.BlockData data = 2; + */ + data?: BlockData; + + /** + * @generated from field: common.BlockMetadata metadata = 3; + */ + metadata?: BlockMetadata; +}; + +/** + * Describes the message common.Block. + * Use `create(BlockSchema)` to create a new message. + */ +export const BlockSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 8); + +/** + * BlockHeader is the element of the block which forms the block chain + * The block header is hashed using the configured chain hashing algorithm + * over the ASN.1 encoding of the BlockHeader + * + * @generated from message common.BlockHeader + */ +export type BlockHeader = Message<"common.BlockHeader"> & { + /** + * The position in the blockchain + * + * @generated from field: uint64 number = 1; + */ + number: bigint; + + /** + * The hash of the previous block header + * + * @generated from field: bytes previous_hash = 2; + */ + previousHash: Uint8Array; + + /** + * The hash of the BlockData, by MerkleTree + * + * @generated from field: bytes data_hash = 3; + */ + dataHash: Uint8Array; +}; + +/** + * Describes the message common.BlockHeader. + * Use `create(BlockHeaderSchema)` to create a new message. + */ +export const BlockHeaderSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 9); + +/** + * @generated from message common.BlockData + */ +export type BlockData = Message<"common.BlockData"> & { + /** + * @generated from field: repeated bytes data = 1; + */ + data: Uint8Array[]; +}; + +/** + * Describes the message common.BlockData. + * Use `create(BlockDataSchema)` to create a new message. + */ +export const BlockDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 10); + +/** + * @generated from message common.BlockMetadata + */ +export type BlockMetadata = Message<"common.BlockMetadata"> & { + /** + * @generated from field: repeated bytes metadata = 1; + */ + metadata: Uint8Array[]; +}; + +/** + * Describes the message common.BlockMetadata. + * Use `create(BlockMetadataSchema)` to create a new message. + */ +export const BlockMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 11); + +/** + * OrdererBlockMetadata defines metadata that is set by the ordering service. + * + * @generated from message common.OrdererBlockMetadata + */ +export type OrdererBlockMetadata = Message<"common.OrdererBlockMetadata"> & { + /** + * @generated from field: common.LastConfig last_config = 1; + */ + lastConfig?: LastConfig; + + /** + * @generated from field: bytes consenter_metadata = 2; + */ + consenterMetadata: Uint8Array; +}; + +/** + * Describes the message common.OrdererBlockMetadata. + * Use `create(OrdererBlockMetadataSchema)` to create a new message. + */ +export const OrdererBlockMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_common, 12); + +/** + * These status codes are intended to resemble selected HTTP status codes + * + * @generated from enum common.Status + */ +export enum Status { + /** + * @generated from enum value: UNKNOWN = 0; + */ + UNKNOWN = 0, + + /** + * @generated from enum value: SUCCESS = 200; + */ + SUCCESS = 200, + + /** + * @generated from enum value: BAD_REQUEST = 400; + */ + BAD_REQUEST = 400, + + /** + * @generated from enum value: FORBIDDEN = 403; + */ + FORBIDDEN = 403, + + /** + * @generated from enum value: NOT_FOUND = 404; + */ + NOT_FOUND = 404, + + /** + * @generated from enum value: REQUEST_ENTITY_TOO_LARGE = 413; + */ + REQUEST_ENTITY_TOO_LARGE = 413, + + /** + * @generated from enum value: INTERNAL_SERVER_ERROR = 500; + */ + INTERNAL_SERVER_ERROR = 500, + + /** + * @generated from enum value: NOT_IMPLEMENTED = 501; + */ + NOT_IMPLEMENTED = 501, + + /** + * @generated from enum value: SERVICE_UNAVAILABLE = 503; + */ + SERVICE_UNAVAILABLE = 503, +} + +/** + * Describes the enum common.Status. + */ +export const StatusSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_common, 0); + +/** + * @generated from enum common.HeaderType + */ +export enum HeaderType { + /** + * Used for messages which are signed but opaque + * + * @generated from enum value: MESSAGE = 0; + */ + MESSAGE = 0, + + /** + * Used for messages which express the channel config + * + * @generated from enum value: CONFIG = 1; + */ + CONFIG = 1, + + /** + * Used for transactions which update the channel config + * + * @generated from enum value: CONFIG_UPDATE = 2; + */ + CONFIG_UPDATE = 2, + + /** + * Used by the SDK to submit endorser based transactions + * + * @generated from enum value: ENDORSER_TRANSACTION = 3; + */ + ENDORSER_TRANSACTION = 3, + + /** + * Used internally by the orderer for management + * + * @generated from enum value: ORDERER_TRANSACTION = 4; + */ + ORDERER_TRANSACTION = 4, + + /** + * Used as the type for Envelope messages submitted to instruct the Deliver API to seek + * + * @generated from enum value: DELIVER_SEEK_INFO = 5; + */ + DELIVER_SEEK_INFO = 5, + + /** + * Used for packaging chaincode artifacts for install + * + * @generated from enum value: CHAINCODE_PACKAGE = 6; + */ + CHAINCODE_PACKAGE = 6, + + /** + * Used for invoking an administrative operation on a peer + * + * @generated from enum value: PEER_ADMIN_OPERATION = 8; + */ + PEER_ADMIN_OPERATION = 8, +} + +/** + * Describes the enum common.HeaderType. + */ +export const HeaderTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_common, 1); + +/** + * This enum enlists indexes of the block metadata array + * + * @generated from enum common.BlockMetadataIndex + */ +export enum BlockMetadataIndex { + /** + * Block metadata array position for block signatures + * + * @generated from enum value: SIGNATURES = 0; + */ + SIGNATURES = 0, + + /** + * Block metadata array position to store last configuration block sequence number + * + * @generated from enum value: LAST_CONFIG = 1 [deprecated = true]; + * @deprecated + */ + LAST_CONFIG = 1, + + /** + * Block metadata array position to store serialized bit array filter of invalid transactions + * + * @generated from enum value: TRANSACTIONS_FILTER = 2; + */ + TRANSACTIONS_FILTER = 2, + + /** + * Block metadata array position to store operational metadata for orderers + * e.g. For Kafka, this is where we store the last offset written to the local ledger + * + * @generated from enum value: ORDERER = 3 [deprecated = true]; + * @deprecated + */ + ORDERER = 3, + + /** + * Block metadata array position to store the hash of TRANSACTIONS_FILTER, State Updates, + * and the COMMIT_HASH of the previous block + * + * @generated from enum value: COMMIT_HASH = 4; + */ + COMMIT_HASH = 4, +} + +/** + * Describes the enum common.BlockMetadataIndex. + */ +export const BlockMetadataIndexSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_common, 2); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configtx_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configtx_pb.ts new file mode 100644 index 0000000000..2ccaf22b21 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configtx_pb.ts @@ -0,0 +1,293 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/configtx.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Envelope } from "./common_pb"; +import { file_common_common } from "./common_pb"; +import type { Policy } from "./policies_pb"; +import { file_common_policies } from "./policies_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/configtx.proto. + */ +export const file_common_configtx: GenFile = /*@__PURE__*/ + fileDesc("ChVjb21tb24vY29uZmlndHgucHJvdG8SBmNvbW1vbiJXCg5Db25maWdFbnZlbG9wZRIeCgZjb25maWcYASABKAsyDi5jb21tb24uQ29uZmlnEiUKC2xhc3RfdXBkYXRlGAIgASgLMhAuY29tbW9uLkVudmVsb3BlIlIKBkNvbmZpZxIQCghzZXF1ZW5jZRgBIAEoBBIqCg1jaGFubmVsX2dyb3VwGAIgASgLMhMuY29tbW9uLkNvbmZpZ0dyb3VwSgQIAxAEUgR0eXBlIloKFENvbmZpZ1VwZGF0ZUVudmVsb3BlEhUKDWNvbmZpZ191cGRhdGUYASABKAwSKwoKc2lnbmF0dXJlcxgCIAMoCzIXLmNvbW1vbi5Db25maWdTaWduYXR1cmUi8QEKDENvbmZpZ1VwZGF0ZRISCgpjaGFubmVsX2lkGAEgASgJEiUKCHJlYWRfc2V0GAIgASgLMhMuY29tbW9uLkNvbmZpZ0dyb3VwEiYKCXdyaXRlX3NldBgDIAEoCzITLmNvbW1vbi5Db25maWdHcm91cBI9Cg1pc29sYXRlZF9kYXRhGAUgAygLMiYuY29tbW9uLkNvbmZpZ1VwZGF0ZS5Jc29sYXRlZERhdGFFbnRyeRozChFJc29sYXRlZERhdGFFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAw6AjgBSgQIBBAFUgR0eXBlIpgDCgtDb25maWdHcm91cBIPCgd2ZXJzaW9uGAEgASgEEi8KBmdyb3VwcxgCIAMoCzIfLmNvbW1vbi5Db25maWdHcm91cC5Hcm91cHNFbnRyeRIvCgZ2YWx1ZXMYAyADKAsyHy5jb21tb24uQ29uZmlnR3JvdXAuVmFsdWVzRW50cnkSMwoIcG9saWNpZXMYBCADKAsyIS5jb21tb24uQ29uZmlnR3JvdXAuUG9saWNpZXNFbnRyeRISCgptb2RfcG9saWN5GAUgASgJGkIKC0dyb3Vwc0VudHJ5EgsKA2tleRgBIAEoCRIiCgV2YWx1ZRgCIAEoCzITLmNvbW1vbi5Db25maWdHcm91cDoCOAEaQgoLVmFsdWVzRW50cnkSCwoDa2V5GAEgASgJEiIKBXZhbHVlGAIgASgLMhMuY29tbW9uLkNvbmZpZ1ZhbHVlOgI4ARpFCg1Qb2xpY2llc0VudHJ5EgsKA2tleRgBIAEoCRIjCgV2YWx1ZRgCIAEoCzIULmNvbW1vbi5Db25maWdQb2xpY3k6AjgBIkEKC0NvbmZpZ1ZhbHVlEg8KB3ZlcnNpb24YASABKAQSDQoFdmFsdWUYAiABKAwSEgoKbW9kX3BvbGljeRgDIAEoCSJTCgxDb25maWdQb2xpY3kSDwoHdmVyc2lvbhgBIAEoBBIeCgZwb2xpY3kYAiABKAsyDi5jb21tb24uUG9saWN5EhIKCm1vZF9wb2xpY3kYAyABKAkiPgoPQ29uZmlnU2lnbmF0dXJlEhgKEHNpZ25hdHVyZV9oZWFkZXIYASABKAwSEQoJc2lnbmF0dXJlGAIgASgMQlYKJG9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLmNvbW1vblouZ2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL2NvbW1vbmIGcHJvdG8z", [file_common_common, file_common_policies]); + +/** + * ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency + * on previous configuration transactions. + * + * It is generated with the following scheme: + * 1. Retrieve the existing configuration + * 2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified + * 3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely) + * 4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely) + * 5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set + * Note: any element not modified but specified should already be in the read_set, so may be specified sparsely + * 6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures + * a) Each signature is of type ConfigSignature + * b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader) + * 5. Submit new Config for ordering in Envelope signed by submitter + * a) The Envelope Payload has data set to the marshaled ConfigEnvelope + * b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE + * + * The configuration manager will verify: + * 1. All items in the read_set exist at the read versions + * 2. All items in the write_set at a different version than, or not in, the read_set have been appropriately signed according to their mod_policy + * 3. The new configuration satisfies the ConfigSchema + * + * @generated from message common.ConfigEnvelope + */ +export type ConfigEnvelope = Message<"common.ConfigEnvelope"> & { + /** + * A marshaled Config structure + * + * @generated from field: common.Config config = 1; + */ + config?: Config; + + /** + * The last CONFIG_UPDATE message which generated this current configuration + * + * @generated from field: common.Envelope last_update = 2; + */ + lastUpdate?: Envelope; +}; + +/** + * Describes the message common.ConfigEnvelope. + * Use `create(ConfigEnvelopeSchema)` to create a new message. + */ +export const ConfigEnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 0); + +/** + * Config represents the config for a particular channel + * + * @generated from message common.Config + */ +export type Config = Message<"common.Config"> & { + /** + * @generated from field: uint64 sequence = 1; + */ + sequence: bigint; + + /** + * channel_group is a bad name for this, it should be changed to root when API breakage is allowed + * + * @generated from field: common.ConfigGroup channel_group = 2; + */ + channelGroup?: ConfigGroup; +}; + +/** + * Describes the message common.Config. + * Use `create(ConfigSchema)` to create a new message. + */ +export const ConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 1); + +/** + * @generated from message common.ConfigUpdateEnvelope + */ +export type ConfigUpdateEnvelope = Message<"common.ConfigUpdateEnvelope"> & { + /** + * A marshaled ConfigUpdate structure + * + * @generated from field: bytes config_update = 1; + */ + configUpdate: Uint8Array; + + /** + * Signatures over the config_update + * + * @generated from field: repeated common.ConfigSignature signatures = 2; + */ + signatures: ConfigSignature[]; +}; + +/** + * Describes the message common.ConfigUpdateEnvelope. + * Use `create(ConfigUpdateEnvelopeSchema)` to create a new message. + */ +export const ConfigUpdateEnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 2); + +/** + * ConfigUpdate is used to submit a subset of config and to have the orderer apply to Config + * it is always submitted inside a ConfigUpdateEnvelope which allows the addition of signatures + * resulting in a new total configuration. The update is applied as follows: + * 1. The versions from all of the elements in the read_set is verified against the versions in the existing config. + * If there is a mismatch in the read versions, then the config update fails and is rejected. + * 2. Any elements in the write_set with the same version as the read_set are ignored. + * 3. The corresponding mod_policy for every remaining element in the write_set is collected. + * 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected + * 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal + * + * @generated from message common.ConfigUpdate + */ +export type ConfigUpdate = Message<"common.ConfigUpdate"> & { + /** + * Which channel this config update is for + * + * @generated from field: string channel_id = 1; + */ + channelId: string; + + /** + * ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set + * + * @generated from field: common.ConfigGroup read_set = 2; + */ + readSet?: ConfigGroup; + + /** + * WriteSet lists the portion of the config which was written, this should included updated Versions + * + * @generated from field: common.ConfigGroup write_set = 3; + */ + writeSet?: ConfigGroup; + + /** + * Data which is not to be reflected in the resulting Config, but is still needed for some other purpose. For instance, rscc_seed_data + * + * @generated from field: map isolated_data = 5; + */ + isolatedData: { [key: string]: Uint8Array }; +}; + +/** + * Describes the message common.ConfigUpdate. + * Use `create(ConfigUpdateSchema)` to create a new message. + */ +export const ConfigUpdateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 3); + +/** + * ConfigGroup is the hierarchical data structure for holding config + * + * @generated from message common.ConfigGroup + */ +export type ConfigGroup = Message<"common.ConfigGroup"> & { + /** + * @generated from field: uint64 version = 1; + */ + version: bigint; + + /** + * @generated from field: map groups = 2; + */ + groups: { [key: string]: ConfigGroup }; + + /** + * @generated from field: map values = 3; + */ + values: { [key: string]: ConfigValue }; + + /** + * @generated from field: map policies = 4; + */ + policies: { [key: string]: ConfigPolicy }; + + /** + * @generated from field: string mod_policy = 5; + */ + modPolicy: string; +}; + +/** + * Describes the message common.ConfigGroup. + * Use `create(ConfigGroupSchema)` to create a new message. + */ +export const ConfigGroupSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 4); + +/** + * ConfigValue represents an individual piece of config data + * + * @generated from message common.ConfigValue + */ +export type ConfigValue = Message<"common.ConfigValue"> & { + /** + * @generated from field: uint64 version = 1; + */ + version: bigint; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @generated from field: string mod_policy = 3; + */ + modPolicy: string; +}; + +/** + * Describes the message common.ConfigValue. + * Use `create(ConfigValueSchema)` to create a new message. + */ +export const ConfigValueSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 5); + +/** + * @generated from message common.ConfigPolicy + */ +export type ConfigPolicy = Message<"common.ConfigPolicy"> & { + /** + * @generated from field: uint64 version = 1; + */ + version: bigint; + + /** + * @generated from field: common.Policy policy = 2; + */ + policy?: Policy; + + /** + * @generated from field: string mod_policy = 3; + */ + modPolicy: string; +}; + +/** + * Describes the message common.ConfigPolicy. + * Use `create(ConfigPolicySchema)` to create a new message. + */ +export const ConfigPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 6); + +/** + * @generated from message common.ConfigSignature + */ +export type ConfigSignature = Message<"common.ConfigSignature"> & { + /** + * A marshaled SignatureHeader + * + * @generated from field: bytes signature_header = 1; + */ + signatureHeader: Uint8Array; + + /** + * Signature over the concatenation signatureHeader bytes and config bytes + * + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message common.ConfigSignature. + * Use `create(ConfigSignatureSchema)` to create a new message. + */ +export const ConfigSignatureSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configtx, 7); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configuration_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configuration_pb.ts new file mode 100644 index 0000000000..561385a671 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/configuration_pb.ts @@ -0,0 +1,168 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/configuration.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/configuration.proto. + */ +export const file_common_configuration: GenFile = /*@__PURE__*/ + fileDesc("Chpjb21tb24vY29uZmlndXJhdGlvbi5wcm90bxIGY29tbW9uIiAKEEhhc2hpbmdBbGdvcml0aG0SDAoEbmFtZRgBIAEoCSIqChlCbG9ja0RhdGFIYXNoaW5nU3RydWN0dXJlEg0KBXdpZHRoGAEgASgNIiUKEE9yZGVyZXJBZGRyZXNzZXMSEQoJYWRkcmVzc2VzGAEgAygJIhoKCkNvbnNvcnRpdW0SDAoEbmFtZRgBIAEoCSKVAQoMQ2FwYWJpbGl0aWVzEjwKDGNhcGFiaWxpdGllcxgBIAMoCzImLmNvbW1vbi5DYXBhYmlsaXRpZXMuQ2FwYWJpbGl0aWVzRW50cnkaRwoRQ2FwYWJpbGl0aWVzRW50cnkSCwoDa2V5GAEgASgJEiEKBXZhbHVlGAIgASgLMhIuY29tbW9uLkNhcGFiaWxpdHk6AjgBIgwKCkNhcGFiaWxpdHlCVgokb3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MuY29tbW9uWi5naXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vY29tbW9uYgZwcm90bzM"); + +/** + * HashingAlgorithm is encoded into the configuration transaction as a configuration item of type Chain + * with a Key of "HashingAlgorithm" and a Value of HashingAlgorithm as marshaled protobuf bytes + * + * @generated from message common.HashingAlgorithm + */ +export type HashingAlgorithm = Message<"common.HashingAlgorithm"> & { + /** + * Currently supported algorithms are: SHAKE256 + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message common.HashingAlgorithm. + * Use `create(HashingAlgorithmSchema)` to create a new message. + */ +export const HashingAlgorithmSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 0); + +/** + * BlockDataHashingStructure is encoded into the configuration transaction as a configuration item of + * type Chain with a Key of "BlockDataHashingStructure" and a Value of HashingAlgorithm as marshaled protobuf bytes + * + * @generated from message common.BlockDataHashingStructure + */ +export type BlockDataHashingStructure = Message<"common.BlockDataHashingStructure"> & { + /** + * width specifies the width of the Merkle tree to use when computing the BlockDataHash + * in order to replicate flat hashing, set this width to MAX_UINT32 + * + * @generated from field: uint32 width = 1; + */ + width: number; +}; + +/** + * Describes the message common.BlockDataHashingStructure. + * Use `create(BlockDataHashingStructureSchema)` to create a new message. + */ +export const BlockDataHashingStructureSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 1); + +/** + * OrdererAddresses is encoded into the configuration transaction as a configuration item of type Chain + * with a Key of "OrdererAddresses" and a Value of OrdererAddresses as marshaled protobuf bytes + * + * @generated from message common.OrdererAddresses + */ +export type OrdererAddresses = Message<"common.OrdererAddresses"> & { + /** + * @generated from field: repeated string addresses = 1; + */ + addresses: string[]; +}; + +/** + * Describes the message common.OrdererAddresses. + * Use `create(OrdererAddressesSchema)` to create a new message. + */ +export const OrdererAddressesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 2); + +/** + * Consortium represents the consortium context in which the channel was created + * + * @generated from message common.Consortium + */ +export type Consortium = Message<"common.Consortium"> & { + /** + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message common.Consortium. + * Use `create(ConsortiumSchema)` to create a new message. + */ +export const ConsortiumSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 3); + +/** + * Capabilities message defines the capabilities a particular binary must implement + * for that binary to be able to safely participate in the channel. The capabilities + * message is defined at the /Channel level, the /Channel/Application level, and the + * /Channel/Orderer level. + * + * The /Channel level capabilties define capabilities which both the orderer and peer + * binaries must satisfy. These capabilties might be things like a new MSP type, + * or a new policy type. + * + * The /Channel/Orderer level capabilties define capabilities which must be supported + * by the orderer, but which have no bearing on the behavior of the peer. For instance + * if the orderer changes the logic for how it constructs new channels, only all orderers + * must agree on the new logic. The peers do not need to be aware of this change as + * they only interact with the channel after it has been constructed. + * + * Finally, the /Channel/Application level capabilities define capabilities which the peer + * binary must satisfy, but which have no bearing on the orderer. For instance, if the + * peer adds a new UTXO transaction type, or changes the chaincode lifecycle requirements, + * all peers must agree on the new logic. However, orderers never inspect transactions + * this deeply, and therefore have no need to be aware of the change. + * + * The capabilities strings defined in these messages typically correspond to release + * binary versions (e.g. "V1.1"), and are used primarilly as a mechanism for a fully + * upgraded network to switch from one set of logic to a new one. + * + * Although for V1.1, the orderers must be upgraded to V1.1 prior to the rest of the + * network, going forward, because of the split between the /Channel, /Channel/Orderer + * and /Channel/Application capabilities. It should be possible for the orderer and + * application networks to upgrade themselves independently (with the exception of any + * new capabilities defined at the /Channel level). + * + * @generated from message common.Capabilities + */ +export type Capabilities = Message<"common.Capabilities"> & { + /** + * @generated from field: map capabilities = 1; + */ + capabilities: { [key: string]: Capability }; +}; + +/** + * Describes the message common.Capabilities. + * Use `create(CapabilitiesSchema)` to create a new message. + */ +export const CapabilitiesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 4); + +/** + * Capability is an empty message for the time being. It is defined as a protobuf + * message rather than a constant, so that we may extend capabilities with other fields + * if the need arises in the future. For the time being, a capability being in the + * capabilities map requires that that capability be supported. + * + * @generated from message common.Capability + */ +export type Capability = Message<"common.Capability"> & { +}; + +/** + * Describes the message common.Capability. + * Use `create(CapabilitySchema)` to create a new message. + */ +export const CapabilitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_configuration, 5); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/events_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/events_pb.ts new file mode 100644 index 0000000000..ee054541c4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/events_pb.ts @@ -0,0 +1,361 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/events.proto (package common.events, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Query } from "./query_pb"; +import { file_common_query } from "./query_pb"; +import type { RequestState } from "./state_pb"; +import { file_common_state } from "./state_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/events.proto. + */ +export const file_common_events: GenFile = /*@__PURE__*/ + fileDesc("ChNjb21tb24vZXZlbnRzLnByb3RvEg1jb21tb24uZXZlbnRzIq4BCgxFdmVudE1hdGNoZXISLAoKZXZlbnRfdHlwZRgBIAEoDjIYLmNvbW1vbi5ldmVudHMuRXZlbnRUeXBlEhYKDmV2ZW50X2NsYXNzX2lkGAIgASgJEh0KFXRyYW5zYWN0aW9uX2xlZGdlcl9pZBgDIAEoCRIfChd0cmFuc2FjdGlvbl9jb250cmFjdF9pZBgEIAEoCRIYChB0cmFuc2FjdGlvbl9mdW5jGAUgASgJIqABChFFdmVudFN1YnNjcmlwdGlvbhIyCg1ldmVudF9tYXRjaGVyGAEgASgLMhsuY29tbW9uLmV2ZW50cy5FdmVudE1hdGNoZXISIgoFcXVlcnkYAiABKAsyEy5jb21tb24ucXVlcnkuUXVlcnkSMwoJb3BlcmF0aW9uGAMgASgOMiAuY29tbW9uLmV2ZW50cy5FdmVudFN1Yk9wZXJhdGlvbiLQAwoWRXZlbnRTdWJzY3JpcHRpb25TdGF0ZRISCgpyZXF1ZXN0X2lkGAEgASgJEh0KFXB1Ymxpc2hpbmdfcmVxdWVzdF9pZBgCIAEoCRI8CgZzdGF0dXMYAyABKA4yLC5jb21tb24uZXZlbnRzLkV2ZW50U3Vic2NyaXB0aW9uU3RhdGUuU1RBVFVTEg8KB21lc3NhZ2UYBCABKAkSMgoNZXZlbnRfbWF0Y2hlchgFIAEoCzIbLmNvbW1vbi5ldmVudHMuRXZlbnRNYXRjaGVyEkAKF2V2ZW50X3B1YmxpY2F0aW9uX3NwZWNzGAYgAygLMh8uY29tbW9uLmV2ZW50cy5FdmVudFB1YmxpY2F0aW9uIr0BCgZTVEFUVVMSGQoVU1VCU0NSSUJFX1BFTkRJTkdfQUNLEAASFQoRU1VCU0NSSUJFX1BFTkRJTkcQARIOCgpTVUJTQ1JJQkVEEAISGwoXVU5TVUJTQ1JJQkVfUEVORElOR19BQ0sQAxIXChNVTlNVQlNDUklCRV9QRU5ESU5HEAQSEAoMVU5TVUJTQ1JJQkVEEAUSCQoFRVJST1IQBhIeChpEVVBMSUNBVEVfUVVFUllfU1VCU0NSSUJFRBAHIpgBChNDb250cmFjdFRyYW5zYWN0aW9uEhEKCWRyaXZlcl9pZBgBIAEoCRIRCglsZWRnZXJfaWQYAiABKAkSEwoLY29udHJhY3RfaWQYAyABKAkSDAoEZnVuYxgEIAEoCRIMCgRhcmdzGAUgAygMEhkKEXJlcGxhY2VfYXJnX2luZGV4GAYgASgEEg8KB21lbWJlcnMYByADKAkibgoQRXZlbnRQdWJsaWNhdGlvbhIxCgNjdHgYASABKAsyIi5jb21tb24uZXZlbnRzLkNvbnRyYWN0VHJhbnNhY3Rpb25IABIRCgdhcHBfdXJsGAIgASgJSABCFAoScHVibGljYXRpb25fdGFyZ2V0IjgKC0V2ZW50U3RhdGVzEikKBnN0YXRlcxgBIAMoCzIZLmNvbW1vbi5ldmVudHMuRXZlbnRTdGF0ZSJaCgpFdmVudFN0YXRlEikKBXN0YXRlGAEgASgLMhouY29tbW9uLnN0YXRlLlJlcXVlc3RTdGF0ZRIQCghldmVudF9pZBgCIAEoCRIPCgdtZXNzYWdlGAMgASgJKj4KCUV2ZW50VHlwZRIQCgxMRURHRVJfU1RBVEUQABIOCgpBU1NFVF9MT0NLEAESDwoLQVNTRVRfQ0xBSU0QAio/ChFFdmVudFN1Yk9wZXJhdGlvbhINCglTVUJTQ1JJQkUQABIPCgtVTlNVQlNDUklCRRABEgoKBlVQREFURRACQnkKMW9yZy5oeXBlcmxlZGdlci5jYWN0aS53ZWF2ZXIucHJvdG9zLmNvbW1vbi5ldmVudHNaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM", [file_common_query, file_common_state]); + +/** + * @generated from message common.events.EventMatcher + */ +export type EventMatcher = Message<"common.events.EventMatcher"> & { + /** + * @generated from field: common.events.EventType event_type = 1; + */ + eventType: EventType; + + /** + * @generated from field: string event_class_id = 2; + */ + eventClassId: string; + + /** + * @generated from field: string transaction_ledger_id = 3; + */ + transactionLedgerId: string; + + /** + * @generated from field: string transaction_contract_id = 4; + */ + transactionContractId: string; + + /** + * @generated from field: string transaction_func = 5; + */ + transactionFunc: string; +}; + +/** + * Describes the message common.events.EventMatcher. + * Use `create(EventMatcherSchema)` to create a new message. + */ +export const EventMatcherSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 0); + +/** + * Below message is used to communicate between dest-relay and src-relay; + * and src-relay and src-driver. + * + * @generated from message common.events.EventSubscription + */ +export type EventSubscription = Message<"common.events.EventSubscription"> & { + /** + * @generated from field: common.events.EventMatcher event_matcher = 1; + */ + eventMatcher?: EventMatcher; + + /** + * @generated from field: common.query.Query query = 2; + */ + query?: Query; + + /** + * @generated from field: common.events.EventSubOperation operation = 3; + */ + operation: EventSubOperation; +}; + +/** + * Describes the message common.events.EventSubscription. + * Use `create(EventSubscriptionSchema)` to create a new message. + */ +export const EventSubscriptionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 1); + +/** + * @generated from message common.events.EventSubscriptionState + */ +export type EventSubscriptionState = Message<"common.events.EventSubscriptionState"> & { + /** + * @generated from field: string request_id = 1; + */ + requestId: string; + + /** + * @generated from field: string publishing_request_id = 2; + */ + publishingRequestId: string; + + /** + * @generated from field: common.events.EventSubscriptionState.STATUS status = 3; + */ + status: EventSubscriptionState_STATUS; + + /** + * @generated from field: string message = 4; + */ + message: string; + + /** + * @generated from field: common.events.EventMatcher event_matcher = 5; + */ + eventMatcher?: EventMatcher; + + /** + * @generated from field: repeated common.events.EventPublication event_publication_specs = 6; + */ + eventPublicationSpecs: EventPublication[]; +}; + +/** + * Describes the message common.events.EventSubscriptionState. + * Use `create(EventSubscriptionStateSchema)` to create a new message. + */ +export const EventSubscriptionStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 2); + +/** + * @generated from enum common.events.EventSubscriptionState.STATUS + */ +export enum EventSubscriptionState_STATUS { + /** + * pending ACK from remote relay + * + * @generated from enum value: SUBSCRIBE_PENDING_ACK = 0; + */ + SUBSCRIBE_PENDING_ACK = 0, + + /** + * Received ACK, waiting for event subscription confirmation from remote relay + * + * @generated from enum value: SUBSCRIBE_PENDING = 1; + */ + SUBSCRIBE_PENDING = 1, + + /** + * @generated from enum value: SUBSCRIBED = 2; + */ + SUBSCRIBED = 2, + + /** + * @generated from enum value: UNSUBSCRIBE_PENDING_ACK = 3; + */ + UNSUBSCRIBE_PENDING_ACK = 3, + + /** + * @generated from enum value: UNSUBSCRIBE_PENDING = 4; + */ + UNSUBSCRIBE_PENDING = 4, + + /** + * @generated from enum value: UNSUBSCRIBED = 5; + */ + UNSUBSCRIBED = 5, + + /** + * @generated from enum value: ERROR = 6; + */ + ERROR = 6, + + /** + * @generated from enum value: DUPLICATE_QUERY_SUBSCRIBED = 7; + */ + DUPLICATE_QUERY_SUBSCRIBED = 7, +} + +/** + * Describes the enum common.events.EventSubscriptionState.STATUS. + */ +export const EventSubscriptionState_STATUSSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_events, 2, 0); + +/** + * @generated from message common.events.ContractTransaction + */ +export type ContractTransaction = Message<"common.events.ContractTransaction"> & { + /** + * @generated from field: string driver_id = 1; + */ + driverId: string; + + /** + * @generated from field: string ledger_id = 2; + */ + ledgerId: string; + + /** + * @generated from field: string contract_id = 3; + */ + contractId: string; + + /** + * @generated from field: string func = 4; + */ + func: string; + + /** + * @generated from field: repeated bytes args = 5; + */ + args: Uint8Array[]; + + /** + * @generated from field: uint64 replace_arg_index = 6; + */ + replaceArgIndex: bigint; + + /** + * @generated from field: repeated string members = 7; + */ + members: string[]; +}; + +/** + * Describes the message common.events.ContractTransaction. + * Use `create(ContractTransactionSchema)` to create a new message. + */ +export const ContractTransactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 3); + +/** + * @generated from message common.events.EventPublication + */ +export type EventPublication = Message<"common.events.EventPublication"> & { + /** + * @generated from oneof common.events.EventPublication.publication_target + */ + publicationTarget: { + /** + * @generated from field: common.events.ContractTransaction ctx = 1; + */ + value: ContractTransaction; + case: "ctx"; + } | { + /** + * @generated from field: string app_url = 2; + */ + value: string; + case: "appUrl"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.events.EventPublication. + * Use `create(EventPublicationSchema)` to create a new message. + */ +export const EventPublicationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 4); + +/** + * @generated from message common.events.EventStates + */ +export type EventStates = Message<"common.events.EventStates"> & { + /** + * @generated from field: repeated common.events.EventState states = 1; + */ + states: EventState[]; +}; + +/** + * Describes the message common.events.EventStates. + * Use `create(EventStatesSchema)` to create a new message. + */ +export const EventStatesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 5); + +/** + * the payload that is used for the communication between the requesting relay + * and its network + * + * @generated from message common.events.EventState + */ +export type EventState = Message<"common.events.EventState"> & { + /** + * @generated from field: common.state.RequestState state = 1; + */ + state?: RequestState; + + /** + * @generated from field: string event_id = 2; + */ + eventId: string; + + /** + * @generated from field: string message = 3; + */ + message: string; +}; + +/** + * Describes the message common.events.EventState. + * Use `create(EventStateSchema)` to create a new message. + */ +export const EventStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_events, 6); + +/** + * @generated from enum common.events.EventType + */ +export enum EventType { + /** + * @generated from enum value: LEDGER_STATE = 0; + */ + LEDGER_STATE = 0, + + /** + * @generated from enum value: ASSET_LOCK = 1; + */ + ASSET_LOCK = 1, + + /** + * @generated from enum value: ASSET_CLAIM = 2; + */ + ASSET_CLAIM = 2, +} + +/** + * Describes the enum common.events.EventType. + */ +export const EventTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_events, 0); + +/** + * @generated from enum common.events.EventSubOperation + */ +export enum EventSubOperation { + /** + * @generated from enum value: SUBSCRIBE = 0; + */ + SUBSCRIBE = 0, + + /** + * @generated from enum value: UNSUBSCRIBE = 1; + */ + UNSUBSCRIBE = 1, + + /** + * @generated from enum value: UPDATE = 2; + */ + UPDATE = 2, +} + +/** + * Describes the enum common.events.EventSubOperation. + */ +export const EventSubOperationSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_events, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/interop_payload_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/interop_payload_pb.ts new file mode 100644 index 0000000000..7971c7e488 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/interop_payload_pb.ts @@ -0,0 +1,120 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/interop_payload.proto (package common.interop_payload, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/interop_payload.proto. + */ +export const file_common_interop_payload: GenFile = /*@__PURE__*/ + fileDesc("Chxjb21tb24vaW50ZXJvcF9wYXlsb2FkLnByb3RvEhZjb21tb24uaW50ZXJvcF9wYXlsb2FkInYKDkludGVyb3BQYXlsb2FkEg8KB3BheWxvYWQYASABKAwSDwoHYWRkcmVzcxgCIAEoCRIUCgxjb25maWRlbnRpYWwYAyABKAgSHQoVcmVxdWVzdG9yX2NlcnRpZmljYXRlGAQgASgJEg0KBW5vbmNlGAUgASgJIp0BChNDb25maWRlbnRpYWxQYXlsb2FkEhkKEWVuY3J5cHRlZF9wYXlsb2FkGAEgASgMEkcKCWhhc2hfdHlwZRgCIAEoDjI0LmNvbW1vbi5pbnRlcm9wX3BheWxvYWQuQ29uZmlkZW50aWFsUGF5bG9hZC5IYXNoVHlwZRIMCgRoYXNoGAMgASgMIhQKCEhhc2hUeXBlEggKBEhNQUMQACI+ChtDb25maWRlbnRpYWxQYXlsb2FkQ29udGVudHMSDwoHcGF5bG9hZBgBIAEoDBIOCgZyYW5kb20YAiABKAxCggEKOm9yZy5oeXBlcmxlZGdlci5jYWN0aS53ZWF2ZXIucHJvdG9zLmNvbW1vbi5pbnRlcm9wX3BheWxvYWRaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM"); + +/** + * @generated from message common.interop_payload.InteropPayload + */ +export type InteropPayload = Message<"common.interop_payload.InteropPayload"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: string address = 2; + */ + address: string; + + /** + * @generated from field: bool confidential = 3; + */ + confidential: boolean; + + /** + * @generated from field: string requestor_certificate = 4; + */ + requestorCertificate: string; + + /** + * @generated from field: string nonce = 5; + */ + nonce: string; +}; + +/** + * Describes the message common.interop_payload.InteropPayload. + * Use `create(InteropPayloadSchema)` to create a new message. + */ +export const InteropPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_interop_payload, 0); + +/** + * @generated from message common.interop_payload.ConfidentialPayload + */ +export type ConfidentialPayload = Message<"common.interop_payload.ConfidentialPayload"> & { + /** + * @generated from field: bytes encrypted_payload = 1; + */ + encryptedPayload: Uint8Array; + + /** + * @generated from field: common.interop_payload.ConfidentialPayload.HashType hash_type = 2; + */ + hashType: ConfidentialPayload_HashType; + + /** + * @generated from field: bytes hash = 3; + */ + hash: Uint8Array; +}; + +/** + * Describes the message common.interop_payload.ConfidentialPayload. + * Use `create(ConfidentialPayloadSchema)` to create a new message. + */ +export const ConfidentialPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_interop_payload, 1); + +/** + * @generated from enum common.interop_payload.ConfidentialPayload.HashType + */ +export enum ConfidentialPayload_HashType { + /** + * @generated from enum value: HMAC = 0; + */ + HMAC = 0, +} + +/** + * Describes the enum common.interop_payload.ConfidentialPayload.HashType. + */ +export const ConfidentialPayload_HashTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_interop_payload, 1, 0); + +/** + * @generated from message common.interop_payload.ConfidentialPayloadContents + */ +export type ConfidentialPayloadContents = Message<"common.interop_payload.ConfidentialPayloadContents"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: bytes random = 2; + */ + random: Uint8Array; +}; + +/** + * Describes the message common.interop_payload.ConfidentialPayloadContents. + * Use `create(ConfidentialPayloadContentsSchema)` to create a new message. + */ +export const ConfidentialPayloadContentsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_interop_payload, 2); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ledger_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ledger_pb.ts new file mode 100644 index 0000000000..b5082f13c2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/ledger_pb.ts @@ -0,0 +1,48 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/ledger.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/ledger.proto. + */ +export const file_common_ledger: GenFile = /*@__PURE__*/ + fileDesc("ChNjb21tb24vbGVkZ2VyLnByb3RvEgZjb21tb24iVQoOQmxvY2tjaGFpbkluZm8SDgoGaGVpZ2h0GAEgASgEEhgKEGN1cnJlbnRCbG9ja0hhc2gYAiABKAwSGQoRcHJldmlvdXNCbG9ja0hhc2gYAyABKAxCVgokb3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MuY29tbW9uWi5naXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vY29tbW9uYgZwcm90bzM"); + +/** + * Contains information about the blockchain ledger such as height, current + * block hash, and previous block hash. + * + * @generated from message common.BlockchainInfo + */ +export type BlockchainInfo = Message<"common.BlockchainInfo"> & { + /** + * @generated from field: uint64 height = 1; + */ + height: bigint; + + /** + * @generated from field: bytes currentBlockHash = 2; + */ + currentBlockHash: Uint8Array; + + /** + * @generated from field: bytes previousBlockHash = 3; + */ + previousBlockHash: Uint8Array; +}; + +/** + * Describes the message common.BlockchainInfo. + * Use `create(BlockchainInfoSchema)` to create a new message. + */ +export const BlockchainInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_ledger, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/membership_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/membership_pb.ts new file mode 100644 index 0000000000..8a208d13f8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/membership_pb.ts @@ -0,0 +1,73 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/membership.proto (package common.membership, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/membership.proto. + */ +export const file_common_membership: GenFile = /*@__PURE__*/ + fileDesc("Chdjb21tb24vbWVtYmVyc2hpcC5wcm90bxIRY29tbW9uLm1lbWJlcnNoaXAirAEKCk1lbWJlcnNoaXASFgoOc2VjdXJpdHlEb21haW4YASABKAkSOwoHbWVtYmVycxgCIAMoCzIqLmNvbW1vbi5tZW1iZXJzaGlwLk1lbWJlcnNoaXAuTWVtYmVyc0VudHJ5GkkKDE1lbWJlcnNFbnRyeRILCgNrZXkYASABKAkSKAoFdmFsdWUYAiABKAsyGS5jb21tb24ubWVtYmVyc2hpcC5NZW1iZXI6AjgBIjQKBk1lbWJlchINCgV2YWx1ZRgBIAEoCRIMCgR0eXBlGAIgASgJEg0KBWNoYWluGAMgAygJQn0KNW9yZy5oeXBlcmxlZGdlci5jYWN0aS53ZWF2ZXIucHJvdG9zLmNvbW1vbi5tZW1iZXJzaGlwWkRnaXRodWIuY29tL2h5cGVybGVkZ2VyLWNhY3RpL2NhY3RpL3dlYXZlci9jb21tb24vcHJvdG9zLWdvL3YyL2NvbW1vbmIGcHJvdG8z"); + +/** + * Membership captures the members of an external entity such as a thing, + * person, organization or groups of entities such as networks + * + * @generated from message common.membership.Membership + */ +export type Membership = Message<"common.membership.Membership"> & { + /** + * @generated from field: string securityDomain = 1; + */ + securityDomain: string; + + /** + * @generated from field: map members = 2; + */ + members: { [key: string]: Member }; +}; + +/** + * Describes the message common.membership.Membership. + * Use `create(MembershipSchema)` to create a new message. + */ +export const MembershipSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_membership, 0); + +/** + * Member of a security group is represented by a set of public keys, + * certificates or certificate authorities + * + * @generated from message common.membership.Member + */ +export type Member = Message<"common.membership.Member"> & { + /** + * @generated from field: string value = 1; + */ + value: string; + + /** + * @generated from field: string type = 2; + */ + type: string; + + /** + * @generated from field: repeated string chain = 3; + */ + chain: string[]; +}; + +/** + * Describes the message common.membership.Member. + * Use `create(MemberSchema)` to create a new message. + */ +export const MemberSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_membership, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/policies_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/policies_pb.ts new file mode 100644 index 0000000000..3efe54399b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/policies_pb.ts @@ -0,0 +1,273 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/policies.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { MSPPrincipal } from "../msp/msp_principal_pb"; +import { file_msp_msp_principal } from "../msp/msp_principal_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/policies.proto. + */ +export const file_common_policies: GenFile = /*@__PURE__*/ + fileDesc("ChVjb21tb24vcG9saWNpZXMucHJvdG8SBmNvbW1vbiJrCgZQb2xpY3kSDAoEdHlwZRgBIAEoBRINCgV2YWx1ZRgCIAEoDCJECgpQb2xpY3lUeXBlEgsKB1VOS05PV04QABINCglTSUdOQVRVUkUQARIHCgNNU1AQAhIRCg1JTVBMSUNJVF9NRVRBEAMiewoXU2lnbmF0dXJlUG9saWN5RW52ZWxvcGUSDwoHdmVyc2lvbhgBIAEoBRIlCgRydWxlGAIgASgLMhcuY29tbW9uLlNpZ25hdHVyZVBvbGljeRIoCgppZGVudGl0aWVzGAMgAygLMhQuY29tbW9uLk1TUFByaW5jaXBhbCKfAQoPU2lnbmF0dXJlUG9saWN5EhMKCXNpZ25lZF9ieRgBIAEoBUgAEjIKCG5fb3V0X29mGAIgASgLMh4uY29tbW9uLlNpZ25hdHVyZVBvbGljeS5OT3V0T2ZIABo7CgZOT3V0T2YSCQoBbhgBIAEoBRImCgVydWxlcxgCIAMoCzIXLmNvbW1vbi5TaWduYXR1cmVQb2xpY3lCBgoEVHlwZSJ/ChJJbXBsaWNpdE1ldGFQb2xpY3kSEgoKc3ViX3BvbGljeRgBIAEoCRItCgRydWxlGAIgASgOMh8uY29tbW9uLkltcGxpY2l0TWV0YVBvbGljeS5SdWxlIiYKBFJ1bGUSBwoDQU5ZEAASBwoDQUxMEAESDAoITUFKT1JJVFkQAiKHAQoRQXBwbGljYXRpb25Qb2xpY3kSOwoQc2lnbmF0dXJlX3BvbGljeRgBIAEoCzIfLmNvbW1vbi5TaWduYXR1cmVQb2xpY3lFbnZlbG9wZUgAEikKH2NoYW5uZWxfY29uZmlnX3BvbGljeV9yZWZlcmVuY2UYAiABKAlIADoCGAFCBgoEVHlwZUJWCiRvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5jb21tb25aLmdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9jb21tb25iBnByb3RvMw", [file_msp_msp_principal]); + +/** + * Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support + * multiple policy engines, this is typed as a oneof for now + * + * @generated from message common.Policy + */ +export type Policy = Message<"common.Policy"> & { + /** + * For outside implementors, consider the first 1000 types reserved, otherwise one of PolicyType + * + * @generated from field: int32 type = 1; + */ + type: number; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; +}; + +/** + * Describes the message common.Policy. + * Use `create(PolicySchema)` to create a new message. + */ +export const PolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 0); + +/** + * @generated from enum common.Policy.PolicyType + */ +export enum Policy_PolicyType { + /** + * Reserved to check for proper initialization + * + * @generated from enum value: UNKNOWN = 0; + */ + UNKNOWN = 0, + + /** + * @generated from enum value: SIGNATURE = 1; + */ + SIGNATURE = 1, + + /** + * @generated from enum value: MSP = 2; + */ + MSP = 2, + + /** + * @generated from enum value: IMPLICIT_META = 3; + */ + IMPLICIT_META = 3, +} + +/** + * Describes the enum common.Policy.PolicyType. + */ +export const Policy_PolicyTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_policies, 0, 0); + +/** + * SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements + * + * @generated from message common.SignaturePolicyEnvelope + */ +export type SignaturePolicyEnvelope = Message<"common.SignaturePolicyEnvelope"> & { + /** + * @generated from field: int32 version = 1; + */ + version: number; + + /** + * @generated from field: common.SignaturePolicy rule = 2; + */ + rule?: SignaturePolicy; + + /** + * @generated from field: repeated common.MSPPrincipal identities = 3; + */ + identities: MSPPrincipal[]; +}; + +/** + * Describes the message common.SignaturePolicyEnvelope. + * Use `create(SignaturePolicyEnvelopeSchema)` to create a new message. + */ +export const SignaturePolicyEnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 1); + +/** + * SignaturePolicy is a recursive message structure which defines a featherweight DSL for describing + * policies which are more complicated than 'exactly this signature'. The NOutOf operator is sufficent + * to express AND as well as OR, as well as of course N out of the following M policies + * SignedBy implies that the signature is from a valid certificate which is signed by the trusted + * authority specified in the bytes. This will be the certificate itself for a self-signed certificate + * and will be the CA for more traditional certificates + * + * @generated from message common.SignaturePolicy + */ +export type SignaturePolicy = Message<"common.SignaturePolicy"> & { + /** + * @generated from oneof common.SignaturePolicy.Type + */ + Type: { + /** + * @generated from field: int32 signed_by = 1; + */ + value: number; + case: "signedBy"; + } | { + /** + * @generated from field: common.SignaturePolicy.NOutOf n_out_of = 2; + */ + value: SignaturePolicy_NOutOf; + case: "nOutOf"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.SignaturePolicy. + * Use `create(SignaturePolicySchema)` to create a new message. + */ +export const SignaturePolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 2); + +/** + * @generated from message common.SignaturePolicy.NOutOf + */ +export type SignaturePolicy_NOutOf = Message<"common.SignaturePolicy.NOutOf"> & { + /** + * @generated from field: int32 n = 1; + */ + n: number; + + /** + * @generated from field: repeated common.SignaturePolicy rules = 2; + */ + rules: SignaturePolicy[]; +}; + +/** + * Describes the message common.SignaturePolicy.NOutOf. + * Use `create(SignaturePolicy_NOutOfSchema)` to create a new message. + */ +export const SignaturePolicy_NOutOfSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 2, 0); + +/** + * ImplicitMetaPolicy is a policy type which depends on the hierarchical nature of the configuration + * It is implicit because the rule is generate implicitly based on the number of sub policies + * It is meta because it depends only on the result of other policies + * When evaluated, this policy iterates over all immediate child sub-groups, retrieves the policy + * of name sub_policy, evaluates the collection and applies the rule. + * For example, with 4 sub-groups, and a policy name of "foo", ImplicitMetaPolicy retrieves + * each sub-group, retrieves policy "foo" for each subgroup, evaluates it, and, in the case of ANY + * 1 satisfied is sufficient, ALL would require 4 signatures, and MAJORITY would require 3 signatures. + * + * @generated from message common.ImplicitMetaPolicy + */ +export type ImplicitMetaPolicy = Message<"common.ImplicitMetaPolicy"> & { + /** + * @generated from field: string sub_policy = 1; + */ + subPolicy: string; + + /** + * @generated from field: common.ImplicitMetaPolicy.Rule rule = 2; + */ + rule: ImplicitMetaPolicy_Rule; +}; + +/** + * Describes the message common.ImplicitMetaPolicy. + * Use `create(ImplicitMetaPolicySchema)` to create a new message. + */ +export const ImplicitMetaPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 3); + +/** + * @generated from enum common.ImplicitMetaPolicy.Rule + */ +export enum ImplicitMetaPolicy_Rule { + /** + * Requires any of the sub-policies be satisfied, if no sub-policies exist, always returns true + * + * @generated from enum value: ANY = 0; + */ + ANY = 0, + + /** + * Requires all of the sub-policies be satisfied + * + * @generated from enum value: ALL = 1; + */ + ALL = 1, + + /** + * Requires a strict majority (greater than half) of the sub-policies be satisfied + * + * @generated from enum value: MAJORITY = 2; + */ + MAJORITY = 2, +} + +/** + * Describes the enum common.ImplicitMetaPolicy.Rule. + */ +export const ImplicitMetaPolicy_RuleSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_policies, 3, 0); + +/** + * ApplicationPolicy captures the diffenrent policy types that + * are set and evaluted at the application level. + * + * @generated from message common.ApplicationPolicy + * @deprecated + */ +export type ApplicationPolicy = Message<"common.ApplicationPolicy"> & { + /** + * @generated from oneof common.ApplicationPolicy.Type + * @deprecated + */ + Type: { + /** + * SignaturePolicy type is used if the policy is specified as + * a combination (using threshold gates) of signatures from MSP + * principals + * + * @generated from field: common.SignaturePolicyEnvelope signature_policy = 1; + */ + value: SignaturePolicyEnvelope; + case: "signaturePolicy"; + } | { + /** + * ChannelConfigPolicyReference is used when the policy is + * specified as a string that references a policy defined in + * the configuration of the channel + * + * @generated from field: string channel_config_policy_reference = 2; + */ + value: string; + case: "channelConfigPolicyReference"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.ApplicationPolicy. + * Use `create(ApplicationPolicySchema)` to create a new message. + * @deprecated + */ +export const ApplicationPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_policies, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/proofs_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/proofs_pb.ts new file mode 100644 index 0000000000..9b32b72aaf --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/proofs_pb.ts @@ -0,0 +1,57 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/proofs.proto (package common.proofs, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/proofs.proto. + */ +export const file_common_proofs: GenFile = /*@__PURE__*/ + fileDesc("ChNjb21tb24vcHJvb2ZzLnByb3RvEg1jb21tb24ucHJvb2ZzIi8KBVByb29mEhEKCXNpZ25hdHVyZRgBIAEoCRITCgtjZXJ0aWZpY2F0ZRgCIAEoCSIuCgZQcm9vZnMSJAoGcHJvb2ZzGAEgAygLMhQuY29tbW9uLnByb29mcy5Qcm9vZkJ5CjFvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24ucHJvb2ZzWkRnaXRodWIuY29tL2h5cGVybGVkZ2VyLWNhY3RpL2NhY3RpL3dlYXZlci9jb21tb24vcHJvdG9zLWdvL3YyL2NvbW1vbmIGcHJvdG8z"); + +/** + * @generated from message common.proofs.Proof + */ +export type Proof = Message<"common.proofs.Proof"> & { + /** + * @generated from field: string signature = 1; + */ + signature: string; + + /** + * @generated from field: string certificate = 2; + */ + certificate: string; +}; + +/** + * Describes the message common.proofs.Proof. + * Use `create(ProofSchema)` to create a new message. + */ +export const ProofSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_proofs, 0); + +/** + * @generated from message common.proofs.Proofs + */ +export type Proofs = Message<"common.proofs.Proofs"> & { + /** + * @generated from field: repeated common.proofs.Proof proofs = 1; + */ + proofs: Proof[]; +}; + +/** + * Describes the message common.proofs.Proofs. + * Use `create(ProofsSchema)` to create a new message. + */ +export const ProofsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_proofs, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/query_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/query_pb.ts new file mode 100644 index 0000000000..d0365d52c2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/query_pb.ts @@ -0,0 +1,82 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/query.proto (package common.query, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/query.proto. + */ +export const file_common_query: GenFile = /*@__PURE__*/ + fileDesc("ChJjb21tb24vcXVlcnkucHJvdG8SDGNvbW1vbi5xdWVyeSLhAQoFUXVlcnkSDgoGcG9saWN5GAEgAygJEg8KB2FkZHJlc3MYAiABKAkSGAoQcmVxdWVzdGluZ19yZWxheRgDIAEoCRIaChJyZXF1ZXN0aW5nX25ldHdvcmsYBCABKAkSEwoLY2VydGlmaWNhdGUYBSABKAkSGwoTcmVxdWVzdG9yX3NpZ25hdHVyZRgGIAEoCRINCgVub25jZRgHIAEoCRISCgpyZXF1ZXN0X2lkGAggASgJEhYKDnJlcXVlc3Rpbmdfb3JnGAkgASgJEhQKDGNvbmZpZGVudGlhbBgKIAEoCEJ4CjBvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24ucXVlcnlaRGdpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29tbW9uYgZwcm90bzM"); + +/** + * the payload to define the data that is being requested + * + * @generated from message common.query.Query + */ +export type Query = Message<"common.query.Query"> & { + /** + * @generated from field: repeated string policy = 1; + */ + policy: string[]; + + /** + * @generated from field: string address = 2; + */ + address: string; + + /** + * @generated from field: string requesting_relay = 3; + */ + requestingRelay: string; + + /** + * @generated from field: string requesting_network = 4; + */ + requestingNetwork: string; + + /** + * @generated from field: string certificate = 5; + */ + certificate: string; + + /** + * @generated from field: string requestor_signature = 6; + */ + requestorSignature: string; + + /** + * @generated from field: string nonce = 7; + */ + nonce: string; + + /** + * @generated from field: string request_id = 8; + */ + requestId: string; + + /** + * @generated from field: string requesting_org = 9; + */ + requestingOrg: string; + + /** + * @generated from field: bool confidential = 10; + */ + confidential: boolean; +}; + +/** + * Describes the message common.query.Query. + * Use `create(QuerySchema)` to create a new message. + */ +export const QuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_query, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/state_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/state_pb.ts new file mode 100644 index 0000000000..8310e931a8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/state_pb.ts @@ -0,0 +1,264 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/state.proto (package common.state, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/state.proto. + */ +export const file_common_state: GenFile = /*@__PURE__*/ + fileDesc("ChJjb21tb24vc3RhdGUucHJvdG8SDGNvbW1vbi5zdGF0ZSK4AQoETWV0YRItCghwcm90b2NvbBgBIAEoDjIbLmNvbW1vbi5zdGF0ZS5NZXRhLlByb3RvY29sEhEKCXRpbWVzdGFtcBgCIAEoCRISCgpwcm9vZl90eXBlGAMgASgJEhwKFHNlcmlhbGl6YXRpb25fZm9ybWF0GAQgASgJIjwKCFByb3RvY29sEgsKB0JJVENPSU4QABIMCghFVEhFUkVVTRABEgoKBkZBQlJJQxADEgkKBUNPUkRBEAQiNgoEVmlldxIgCgRtZXRhGAEgASgLMhIuY29tbW9uLnN0YXRlLk1ldGESDAoEZGF0YRgCIAEoDCJfCgtWaWV3UGF5bG9hZBISCgpyZXF1ZXN0X2lkGAEgASgJEiIKBHZpZXcYAiABKAsyEi5jb21tb24uc3RhdGUuVmlld0gAEg8KBWVycm9yGAMgASgJSABCBwoFc3RhdGUioQIKDFJlcXVlc3RTdGF0ZRISCgpyZXF1ZXN0X2lkGAEgASgJEjEKBnN0YXR1cxgCIAEoDjIhLmNvbW1vbi5zdGF0ZS5SZXF1ZXN0U3RhdGUuU1RBVFVTEiIKBHZpZXcYAyABKAsyEi5jb21tb24uc3RhdGUuVmlld0gAEg8KBWVycm9yGAQgASgJSAAiiwEKBlNUQVRVUxIPCgtQRU5ESU5HX0FDSxAAEgsKB1BFTkRJTkcQARIJCgVFUlJPUhACEg0KCUNPTVBMRVRFRBADEhIKDkVWRU5UX1JFQ0VJVkVEEAQSEQoNRVZFTlRfV1JJVFRFThAFEhUKEUVWRU5UX1dSSVRFX0VSUk9SEAYSCwoHREVMRVRFRBAHQgcKBXN0YXRlQngKMG9yZy5oeXBlcmxlZGdlci5jYWN0aS53ZWF2ZXIucHJvdG9zLmNvbW1vbi5zdGF0ZVpEZ2l0aHViLmNvbS9oeXBlcmxlZGdlci1jYWN0aS9jYWN0aS93ZWF2ZXIvY29tbW9uL3Byb3Rvcy1nby92Mi9jb21tb25iBnByb3RvMw"); + +/** + * Metadata for a View + * + * @generated from message common.state.Meta + */ +export type Meta = Message<"common.state.Meta"> & { + /** + * Underlying distributed ledger protocol. + * + * @generated from field: common.state.Meta.Protocol protocol = 1; + */ + protocol: Meta_Protocol; + + /** + * What notion of time? + * If the observer and network are synchronizing on a global clock + * there won't be a need to distinguish between static and dynamic views. + * + * @generated from field: string timestamp = 2; + */ + timestamp: string; + + /** + * Notorization, SPV, ZKP, etc. Possibly enum + * + * @generated from field: string proof_type = 3; + */ + proofType: string; + + /** + * The data field's serialization format (e.g. JSON, XML, Protobuf) + * + * @generated from field: string serialization_format = 4; + */ + serializationFormat: string; +}; + +/** + * Describes the message common.state.Meta. + * Use `create(MetaSchema)` to create a new message. + */ +export const MetaSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_state, 0); + +/** + * @generated from enum common.state.Meta.Protocol + */ +export enum Meta_Protocol { + /** + * @generated from enum value: BITCOIN = 0; + */ + BITCOIN = 0, + + /** + * @generated from enum value: ETHEREUM = 1; + */ + ETHEREUM = 1, + + /** + * @generated from enum value: FABRIC = 3; + */ + FABRIC = 3, + + /** + * @generated from enum value: CORDA = 4; + */ + CORDA = 4, +} + +/** + * Describes the enum common.state.Meta.Protocol. + */ +export const Meta_ProtocolSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_state, 0, 0); + +/** + * @generated from message common.state.View + */ +export type View = Message<"common.state.View"> & { + /** + * @generated from field: common.state.Meta meta = 1; + */ + meta?: Meta; + + /** + * Represents the data playload of this view. + * The representation of Fabric, Corda etc will be captured elsewhere. + * For some protocols, like Bitcoin, the structure of an SPV proof is well known. + * + * @generated from field: bytes data = 2; + */ + data: Uint8Array; +}; + +/** + * Describes the message common.state.View. + * Use `create(ViewSchema)` to create a new message. + */ +export const ViewSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_state, 1); + +/** + * View represents the response from a remote network + * + * @generated from message common.state.ViewPayload + */ +export type ViewPayload = Message<"common.state.ViewPayload"> & { + /** + * @generated from field: string request_id = 1; + */ + requestId: string; + + /** + * @generated from oneof common.state.ViewPayload.state + */ + state: { + /** + * @generated from field: common.state.View view = 2; + */ + value: View; + case: "view"; + } | { + /** + * @generated from field: string error = 3; + */ + value: string; + case: "error"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.state.ViewPayload. + * Use `create(ViewPayloadSchema)` to create a new message. + */ +export const ViewPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_state, 2); + +/** + * the payload that is used for the communication between the requesting relay + * and its network + * + * @generated from message common.state.RequestState + */ +export type RequestState = Message<"common.state.RequestState"> & { + /** + * @generated from field: string request_id = 1; + */ + requestId: string; + + /** + * @generated from field: common.state.RequestState.STATUS status = 2; + */ + status: RequestState_STATUS; + + /** + * @generated from oneof common.state.RequestState.state + */ + state: { + /** + * @generated from field: common.state.View view = 3; + */ + value: View; + case: "view"; + } | { + /** + * @generated from field: string error = 4; + */ + value: string; + case: "error"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message common.state.RequestState. + * Use `create(RequestStateSchema)` to create a new message. + */ +export const RequestStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_state, 3); + +/** + * @generated from enum common.state.RequestState.STATUS + */ +export enum RequestState_STATUS { + /** + * pending ACK from remote relay + * + * @generated from enum value: PENDING_ACK = 0; + */ + PENDING_ACK = 0, + + /** + * Received ACK, waiting for data to be sent from remote relay + * + * @generated from enum value: PENDING = 1; + */ + PENDING = 1, + + /** + * View is not there, received error from remote relay + * + * @generated from enum value: ERROR = 2; + */ + ERROR = 2, + + /** + * Data Sharing completed Successfully + * + * @generated from enum value: COMPLETED = 3; + */ + COMPLETED = 3, + + /** + * View is there and event is received from remote relay + * + * @generated from enum value: EVENT_RECEIVED = 4; + */ + EVENT_RECEIVED = 4, + + /** + * Driver Successfully wrote the view to ledger + * + * @generated from enum value: EVENT_WRITTEN = 5; + */ + EVENT_WRITTEN = 5, + + /** + * View is there but driver failed to write + * + * @generated from enum value: EVENT_WRITE_ERROR = 6; + */ + EVENT_WRITE_ERROR = 6, + + /** + * Once network fetches this request state, mark it delete for cleanup later on + * + * @generated from enum value: DELETED = 7; + */ + DELETED = 7, +} + +/** + * Describes the enum common.state.RequestState.STATUS. + */ +export const RequestState_STATUSSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_common_state, 3, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/verification_policy_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/verification_policy_pb.ts new file mode 100644 index 0000000000..b234e73a1e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/common/verification_policy_pb.ts @@ -0,0 +1,96 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file common/verification_policy.proto (package common.verification_policy, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file common/verification_policy.proto. + */ +export const file_common_verification_policy: GenFile = /*@__PURE__*/ + fileDesc("CiBjb21tb24vdmVyaWZpY2F0aW9uX3BvbGljeS5wcm90bxIaY29tbW9uLnZlcmlmaWNhdGlvbl9wb2xpY3kiaQoSVmVyaWZpY2F0aW9uUG9saWN5EhYKDnNlY3VyaXR5RG9tYWluGAEgASgJEjsKC2lkZW50aWZpZXJzGAIgAygLMiYuY29tbW9uLnZlcmlmaWNhdGlvbl9wb2xpY3kuSWRlbnRpZmllciIoCgZQb2xpY3kSDAoEdHlwZRgBIAEoCRIQCghjcml0ZXJpYRgCIAMoCSJRCgpJZGVudGlmaWVyEg8KB3BhdHRlcm4YASABKAkSMgoGcG9saWN5GAIgASgLMiIuY29tbW9uLnZlcmlmaWNhdGlvbl9wb2xpY3kuUG9saWN5QoYBCj5vcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5jb21tb24udmVyaWZpY2F0aW9uX3BvbGljeVpEZ2l0aHViLmNvbS9oeXBlcmxlZGdlci1jYWN0aS9jYWN0aS93ZWF2ZXIvY29tbW9uL3Byb3Rvcy1nby92Mi9jb21tb25iBnByb3RvMw"); + +/** + * VerificationPolicy stores the rules around which parties from a foreign + * network need to provide proof of a view in order for it to be deemed valid by + * the Fabric network + * + * @generated from message common.verification_policy.VerificationPolicy + */ +export type VerificationPolicy = Message<"common.verification_policy.VerificationPolicy"> & { + /** + * @generated from field: string securityDomain = 1; + */ + securityDomain: string; + + /** + * @generated from field: repeated common.verification_policy.Identifier identifiers = 2; + */ + identifiers: Identifier[]; +}; + +/** + * Describes the message common.verification_policy.VerificationPolicy. + * Use `create(VerificationPolicySchema)` to create a new message. + */ +export const VerificationPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_verification_policy, 0); + +/** + * The Policy captures the list of parties that are required to provide proofs + * of a view in order for the Fabric network to accept the view as valid. + * + * @generated from message common.verification_policy.Policy + */ +export type Policy = Message<"common.verification_policy.Policy"> & { + /** + * @generated from field: string type = 1; + */ + type: string; + + /** + * @generated from field: repeated string criteria = 2; + */ + criteria: string[]; +}; + +/** + * Describes the message common.verification_policy.Policy. + * Use `create(PolicySchema)` to create a new message. + */ +export const PolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_verification_policy, 1); + +/** + * List of identifiers for the VerificationPolicy + * + * @generated from message common.verification_policy.Identifier + */ +export type Identifier = Message<"common.verification_policy.Identifier"> & { + /** + * pattern defines the view/views that this rule applies to + * A rule may contain a "*" at the end of the pattern + * + * @generated from field: string pattern = 1; + */ + pattern: string; + + /** + * @generated from field: common.verification_policy.Policy policy = 2; + */ + policy?: Policy; +}; + +/** + * Describes the message common.verification_policy.Identifier. + * Use `create(IdentifierSchema)` to create a new message. + */ +export const IdentifierSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_common_verification_policy, 2); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/corda/view_data_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/corda/view_data_pb.ts new file mode 100644 index 0000000000..a2ef2a4a83 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/corda/view_data_pb.ts @@ -0,0 +1,69 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file corda/view_data.proto (package corda, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file corda/view_data.proto. + */ +export const file_corda_view_data: GenFile = /*@__PURE__*/ + fileDesc("ChVjb3JkYS92aWV3X2RhdGEucHJvdG8SBWNvcmRhIqEBCghWaWV3RGF0YRI8ChJub3Rhcml6ZWRfcGF5bG9hZHMYASADKAsyIC5jb3JkYS5WaWV3RGF0YS5Ob3Rhcml6ZWRQYXlsb2FkGlcKEE5vdGFyaXplZFBheWxvYWQSEQoJc2lnbmF0dXJlGAEgASgJEhMKC2NlcnRpZmljYXRlGAIgASgJEgoKAmlkGAMgASgJEg8KB3BheWxvYWQYBCABKAxCcAopb3JnLmh5cGVybGVkZ2VyLmNhY3RpLndlYXZlci5wcm90b3MuY29yZGFaQ2dpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvY29yZGFiBnByb3RvMw"); + +/** + * @generated from message corda.ViewData + */ +export type ViewData = Message<"corda.ViewData"> & { + /** + * @generated from field: repeated corda.ViewData.NotarizedPayload notarized_payloads = 1; + */ + notarizedPayloads: ViewData_NotarizedPayload[]; +}; + +/** + * Describes the message corda.ViewData. + * Use `create(ViewDataSchema)` to create a new message. + */ +export const ViewDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_corda_view_data, 0); + +/** + * @generated from message corda.ViewData.NotarizedPayload + */ +export type ViewData_NotarizedPayload = Message<"corda.ViewData.NotarizedPayload"> & { + /** + * @generated from field: string signature = 1; + */ + signature: string; + + /** + * @generated from field: string certificate = 2; + */ + certificate: string; + + /** + * @generated from field: string id = 3; + */ + id: string; + + /** + * Bytes of InteropPayload + * + * @generated from field: bytes payload = 4; + */ + payload: Uint8Array; +}; + +/** + * Describes the message corda.ViewData.NotarizedPayload. + * Use `create(ViewData_NotarizedPayloadSchema)` to create a new message. + */ +export const ViewData_NotarizedPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_corda_view_data, 0, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_connect.ts new file mode 100644 index 0000000000..9521db04fa --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_connect.ts @@ -0,0 +1,35 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file discovery/protocol.proto (package discovery, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Response, SignedRequest } from "./protocol_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Discovery defines a service that serves information about the fabric network + * like which peers, orderers, chaincodes, etc. + * + * @generated from service discovery.Discovery + */ +export const Discovery = { + typeName: "discovery.Discovery", + methods: { + /** + * Discover receives a signed request, and returns a response. + * + * @generated from rpc discovery.Discovery.Discover + */ + discover: { + name: "Discover", + I: SignedRequest, + O: Response, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_pb.ts new file mode 100644 index 0000000000..85dff0602a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/discovery/protocol_pb.ts @@ -0,0 +1,662 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file discovery/protocol.proto (package discovery, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Envelope } from "../gossip/message_pb"; +import { file_gossip_message } from "../gossip/message_pb"; +import type { FabricMSPConfig } from "../msp/msp_config_pb"; +import { file_msp_msp_config } from "../msp/msp_config_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file discovery/protocol.proto. + */ +export const file_discovery_protocol: GenFile = /*@__PURE__*/ + fileDesc("ChhkaXNjb3ZlcnkvcHJvdG9jb2wucHJvdG8SCWRpc2NvdmVyeSIzCg1TaWduZWRSZXF1ZXN0Eg8KB3BheWxvYWQYASABKAwSEQoJc2lnbmF0dXJlGAIgASgMIlkKB1JlcXVlc3QSKwoOYXV0aGVudGljYXRpb24YASABKAsyEy5kaXNjb3ZlcnkuQXV0aEluZm8SIQoHcXVlcmllcxgCIAMoCzIQLmRpc2NvdmVyeS5RdWVyeSIzCghSZXNwb25zZRInCgdyZXN1bHRzGAEgAygLMhYuZGlzY292ZXJ5LlF1ZXJ5UmVzdWx0IkEKCEF1dGhJbmZvEhcKD2NsaWVudF9pZGVudGl0eRgBIAEoDBIcChRjbGllbnRfdGxzX2NlcnRfaGFzaBgCIAEoDCLoAQoFUXVlcnkSDwoHY2hhbm5lbBgBIAEoCRIuCgxjb25maWdfcXVlcnkYAiABKAsyFi5kaXNjb3ZlcnkuQ29uZmlnUXVlcnlIABI0CgpwZWVyX3F1ZXJ5GAMgASgLMh4uZGlzY292ZXJ5LlBlZXJNZW1iZXJzaGlwUXVlcnlIABItCghjY19xdWVyeRgEIAEoCzIZLmRpc2NvdmVyeS5DaGFpbmNvZGVRdWVyeUgAEjAKC2xvY2FsX3BlZXJzGAUgASgLMhkuZGlzY292ZXJ5LkxvY2FsUGVlclF1ZXJ5SABCBwoFcXVlcnki2QEKC1F1ZXJ5UmVzdWx0EiEKBWVycm9yGAEgASgLMhAuZGlzY292ZXJ5LkVycm9ySAASMAoNY29uZmlnX3Jlc3VsdBgCIAEoCzIXLmRpc2NvdmVyeS5Db25maWdSZXN1bHRIABI3CgxjY19xdWVyeV9yZXMYAyABKAsyHy5kaXNjb3ZlcnkuQ2hhaW5jb2RlUXVlcnlSZXN1bHRIABIyCgdtZW1iZXJzGAQgASgLMh8uZGlzY292ZXJ5LlBlZXJNZW1iZXJzaGlwUmVzdWx0SABCCAoGcmVzdWx0Ig0KC0NvbmZpZ1F1ZXJ5IoICCgxDb25maWdSZXN1bHQSLwoEbXNwcxgBIAMoCzIhLmRpc2NvdmVyeS5Db25maWdSZXN1bHQuTXNwc0VudHJ5EjcKCG9yZGVyZXJzGAIgAygLMiUuZGlzY292ZXJ5LkNvbmZpZ1Jlc3VsdC5PcmRlcmVyc0VudHJ5GkEKCU1zcHNFbnRyeRILCgNrZXkYASABKAkSIwoFdmFsdWUYAiABKAsyFC5tc3AuRmFicmljTVNQQ29uZmlnOgI4ARpFCg1PcmRlcmVyc0VudHJ5EgsKA2tleRgBIAEoCRIjCgV2YWx1ZRgCIAEoCzIULmRpc2NvdmVyeS5FbmRwb2ludHM6AjgBIkMKE1BlZXJNZW1iZXJzaGlwUXVlcnkSLAoGZmlsdGVyGAEgASgLMhwuZGlzY292ZXJ5LkNoYWluY29kZUludGVyZXN0IqIBChRQZWVyTWVtYmVyc2hpcFJlc3VsdBJFCgxwZWVyc19ieV9vcmcYASADKAsyLy5kaXNjb3ZlcnkuUGVlck1lbWJlcnNoaXBSZXN1bHQuUGVlcnNCeU9yZ0VudHJ5GkMKD1BlZXJzQnlPcmdFbnRyeRILCgNrZXkYASABKAkSHwoFdmFsdWUYAiABKAsyEC5kaXNjb3ZlcnkuUGVlcnM6AjgBIkEKDkNoYWluY29kZVF1ZXJ5Ei8KCWludGVyZXN0cxgBIAMoCzIcLmRpc2NvdmVyeS5DaGFpbmNvZGVJbnRlcmVzdCJBChFDaGFpbmNvZGVJbnRlcmVzdBIsCgpjaGFpbmNvZGVzGAEgAygLMhguZGlzY292ZXJ5LkNoYWluY29kZUNhbGwiawoNQ2hhaW5jb2RlQ2FsbBIMCgRuYW1lGAEgASgJEhgKEGNvbGxlY3Rpb25fbmFtZXMYAiADKAkSGAoQbm9fcHJpdmF0ZV9yZWFkcxgDIAEoCBIYChBub19wdWJsaWNfd3JpdGVzGAQgASgIIkkKFENoYWluY29kZVF1ZXJ5UmVzdWx0EjEKB2NvbnRlbnQYASADKAsyIC5kaXNjb3ZlcnkuRW5kb3JzZW1lbnREZXNjcmlwdG9yIhAKDkxvY2FsUGVlclF1ZXJ5IvABChVFbmRvcnNlbWVudERlc2NyaXB0b3ISEQoJY2hhaW5jb2RlGAEgASgJElQKE2VuZG9yc2Vyc19ieV9ncm91cHMYAiADKAsyNy5kaXNjb3ZlcnkuRW5kb3JzZW1lbnREZXNjcmlwdG9yLkVuZG9yc2Vyc0J5R3JvdXBzRW50cnkSIgoHbGF5b3V0cxgDIAMoCzIRLmRpc2NvdmVyeS5MYXlvdXQaSgoWRW5kb3JzZXJzQnlHcm91cHNFbnRyeRILCgNrZXkYASABKAkSHwoFdmFsdWUYAiABKAsyEC5kaXNjb3ZlcnkuUGVlcnM6AjgBIokBCgZMYXlvdXQSRQoTcXVhbnRpdGllc19ieV9ncm91cBgBIAMoCzIoLmRpc2NvdmVyeS5MYXlvdXQuUXVhbnRpdGllc0J5R3JvdXBFbnRyeRo4ChZRdWFudGl0aWVzQnlHcm91cEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoDToCOAEiJwoFUGVlcnMSHgoFcGVlcnMYASADKAsyDy5kaXNjb3ZlcnkuUGVlciJpCgRQZWVyEiQKCnN0YXRlX2luZm8YASABKAsyEC5nb3NzaXAuRW52ZWxvcGUSKQoPbWVtYmVyc2hpcF9pbmZvGAIgASgLMhAuZ29zc2lwLkVudmVsb3BlEhAKCGlkZW50aXR5GAMgASgMIhgKBUVycm9yEg8KB2NvbnRlbnQYASABKAkiMgoJRW5kcG9pbnRzEiUKCGVuZHBvaW50GAEgAygLMhMuZGlzY292ZXJ5LkVuZHBvaW50IiYKCEVuZHBvaW50EgwKBGhvc3QYASABKAkSDAoEcG9ydBgCIAEoDTJGCglEaXNjb3ZlcnkSOQoIRGlzY292ZXISGC5kaXNjb3ZlcnkuU2lnbmVkUmVxdWVzdBoTLmRpc2NvdmVyeS5SZXNwb25zZUJcCidvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5kaXNjb3ZlcnlaMWdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9kaXNjb3ZlcnliBnByb3RvMw", [file_gossip_message, file_msp_msp_config]); + +/** + * SignedRequest contains a serialized Request in the payload field + * and a signature. + * The identity that is used to verify the signature + * can be extracted from the authentication field of type AuthInfo + * in the Request itself after deserializing it. + * + * @generated from message discovery.SignedRequest + */ +export type SignedRequest = Message<"discovery.SignedRequest"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message discovery.SignedRequest. + * Use `create(SignedRequestSchema)` to create a new message. + */ +export const SignedRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 0); + +/** + * Request contains authentication info about the client that sent the request + * and the queries it wishes to query the service + * + * @generated from message discovery.Request + */ +export type Request = Message<"discovery.Request"> & { + /** + * authentication contains information that the service uses to check + * the client's eligibility for the queries. + * + * @generated from field: discovery.AuthInfo authentication = 1; + */ + authentication?: AuthInfo; + + /** + * queries + * + * @generated from field: repeated discovery.Query queries = 2; + */ + queries: Query[]; +}; + +/** + * Describes the message discovery.Request. + * Use `create(RequestSchema)` to create a new message. + */ +export const RequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 1); + +/** + * @generated from message discovery.Response + */ +export type Response = Message<"discovery.Response"> & { + /** + * The results are returned in the same order of the queries + * + * @generated from field: repeated discovery.QueryResult results = 1; + */ + results: QueryResult[]; +}; + +/** + * Describes the message discovery.Response. + * Use `create(ResponseSchema)` to create a new message. + */ +export const ResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 2); + +/** + * AuthInfo aggregates authentication information that the server uses + * to authenticate the client + * + * @generated from message discovery.AuthInfo + */ +export type AuthInfo = Message<"discovery.AuthInfo"> & { + /** + * This is the identity of the client that is used to verify the signature + * on the SignedRequest's payload. + * It is a msp.SerializedIdentity in bytes form + * + * @generated from field: bytes client_identity = 1; + */ + clientIdentity: Uint8Array; + + /** + * This is the hash of the client's TLS cert. + * When the network is running with TLS, clients that don't include a certificate + * will be denied access to the service. + * Since the Request is encapsulated with a SignedRequest (which is signed), + * this binds the TLS session to the enrollement identity of the client and + * therefore both authenticates the client to the server, + * and also prevents the server from relaying the request message to another server. + * + * @generated from field: bytes client_tls_cert_hash = 2; + */ + clientTlsCertHash: Uint8Array; +}; + +/** + * Describes the message discovery.AuthInfo. + * Use `create(AuthInfoSchema)` to create a new message. + */ +export const AuthInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 3); + +/** + * Query asks for information in the context of a specific channel + * + * @generated from message discovery.Query + */ +export type Query = Message<"discovery.Query"> & { + /** + * @generated from field: string channel = 1; + */ + channel: string; + + /** + * @generated from oneof discovery.Query.query + */ + query: { + /** + * ConfigQuery is used to query for the configuration of the channel, + * such as FabricMSPConfig, and rorderer endpoints. + * The client has to query a peer it trusts as it doesn't have means to self-verify + * the authenticity of the returned result. + * The result is returned in the form of ConfigResult. + * + * @generated from field: discovery.ConfigQuery config_query = 2; + */ + value: ConfigQuery; + case: "configQuery"; + } | { + /** + * PeerMembershipQuery queries for peers in a channel context, + * and returns PeerMembershipResult + * + * @generated from field: discovery.PeerMembershipQuery peer_query = 3; + */ + value: PeerMembershipQuery; + case: "peerQuery"; + } | { + /** + * ChaincodeQuery queries for chaincodes by their name and version. + * An empty version means any version can by returned. + * + * @generated from field: discovery.ChaincodeQuery cc_query = 4; + */ + value: ChaincodeQuery; + case: "ccQuery"; + } | { + /** + * LocalPeerQuery queries for peers in a non channel context, + * and returns PeerMembershipResult + * + * @generated from field: discovery.LocalPeerQuery local_peers = 5; + */ + value: LocalPeerQuery; + case: "localPeers"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message discovery.Query. + * Use `create(QuerySchema)` to create a new message. + */ +export const QuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 4); + +/** + * QueryResult contains a result for a given Query. + * The corresponding Query can be inferred by the index of the QueryResult from + * its enclosing Response message. + * QueryResults are ordered in the same order as the Queries are ordered in their enclosing Request. + * + * @generated from message discovery.QueryResult + */ +export type QueryResult = Message<"discovery.QueryResult"> & { + /** + * @generated from oneof discovery.QueryResult.result + */ + result: { + /** + * Error indicates failure or refusal to process the query + * + * @generated from field: discovery.Error error = 1; + */ + value: Error; + case: "error"; + } | { + /** + * ConfigResult contains the configuration of the channel, + * such as FabricMSPConfig and orderer endpoints + * + * @generated from field: discovery.ConfigResult config_result = 2; + */ + value: ConfigResult; + case: "configResult"; + } | { + /** + * ChaincodeQueryResult contains information about chaincodes, + * and their corresponding endorsers + * + * @generated from field: discovery.ChaincodeQueryResult cc_query_res = 3; + */ + value: ChaincodeQueryResult; + case: "ccQueryRes"; + } | { + /** + * PeerMembershipResult contains information about peers, + * such as their identity, endpoints, and channel related state. + * + * @generated from field: discovery.PeerMembershipResult members = 4; + */ + value: PeerMembershipResult; + case: "members"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message discovery.QueryResult. + * Use `create(QueryResultSchema)` to create a new message. + */ +export const QueryResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 5); + +/** + * ConfigQuery requests a ConfigResult + * + * @generated from message discovery.ConfigQuery + */ +export type ConfigQuery = Message<"discovery.ConfigQuery"> & { +}; + +/** + * Describes the message discovery.ConfigQuery. + * Use `create(ConfigQuerySchema)` to create a new message. + */ +export const ConfigQuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 6); + +/** + * @generated from message discovery.ConfigResult + */ +export type ConfigResult = Message<"discovery.ConfigResult"> & { + /** + * msps is a map from MSP_ID to FabricMSPConfig + * + * @generated from field: map msps = 1; + */ + msps: { [key: string]: FabricMSPConfig }; + + /** + * orderers is a map from MSP_ID to endpoint lists of orderers + * + * @generated from field: map orderers = 2; + */ + orderers: { [key: string]: Endpoints }; +}; + +/** + * Describes the message discovery.ConfigResult. + * Use `create(ConfigResultSchema)` to create a new message. + */ +export const ConfigResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 7); + +/** + * PeerMembershipQuery requests PeerMembershipResult. + * The filter field may be optionally populated in order + * for the peer membership to be filtered according to + * chaincodes that are installed on peers and collection + * access control policies. + * + * @generated from message discovery.PeerMembershipQuery + */ +export type PeerMembershipQuery = Message<"discovery.PeerMembershipQuery"> & { + /** + * @generated from field: discovery.ChaincodeInterest filter = 1; + */ + filter?: ChaincodeInterest; +}; + +/** + * Describes the message discovery.PeerMembershipQuery. + * Use `create(PeerMembershipQuerySchema)` to create a new message. + */ +export const PeerMembershipQuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 8); + +/** + * PeerMembershipResult contains peers mapped by their organizations (MSP_ID) + * + * @generated from message discovery.PeerMembershipResult + */ +export type PeerMembershipResult = Message<"discovery.PeerMembershipResult"> & { + /** + * @generated from field: map peers_by_org = 1; + */ + peersByOrg: { [key: string]: Peers }; +}; + +/** + * Describes the message discovery.PeerMembershipResult. + * Use `create(PeerMembershipResultSchema)` to create a new message. + */ +export const PeerMembershipResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 9); + +/** + * ChaincodeQuery requests ChaincodeQueryResults for a given + * list of chaincode invocations. + * Each invocation is a separate one, and the endorsement policy + * is evaluated independantly for each given interest. + * + * @generated from message discovery.ChaincodeQuery + */ +export type ChaincodeQuery = Message<"discovery.ChaincodeQuery"> & { + /** + * @generated from field: repeated discovery.ChaincodeInterest interests = 1; + */ + interests: ChaincodeInterest[]; +}; + +/** + * Describes the message discovery.ChaincodeQuery. + * Use `create(ChaincodeQuerySchema)` to create a new message. + */ +export const ChaincodeQuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 10); + +/** + * ChaincodeInterest defines an interest about an endorsement + * for a specific single chaincode invocation. + * Multiple chaincodes indicate chaincode to chaincode invocations. + * + * @generated from message discovery.ChaincodeInterest + */ +export type ChaincodeInterest = Message<"discovery.ChaincodeInterest"> & { + /** + * @generated from field: repeated discovery.ChaincodeCall chaincodes = 1; + */ + chaincodes: ChaincodeCall[]; +}; + +/** + * Describes the message discovery.ChaincodeInterest. + * Use `create(ChaincodeInterestSchema)` to create a new message. + */ +export const ChaincodeInterestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 11); + +/** + * ChaincodeCall defines a call to a chaincode. + * It may have collections that are related to the chaincode + * + * @generated from message discovery.ChaincodeCall + */ +export type ChaincodeCall = Message<"discovery.ChaincodeCall"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: repeated string collection_names = 2; + */ + collectionNames: string[]; + + /** + * Indicates we do not need to read from private data + * + * @generated from field: bool no_private_reads = 3; + */ + noPrivateReads: boolean; + + /** + * Indicates we do not need to write to the chaincode namespace + * + * @generated from field: bool no_public_writes = 4; + */ + noPublicWrites: boolean; +}; + +/** + * Describes the message discovery.ChaincodeCall. + * Use `create(ChaincodeCallSchema)` to create a new message. + */ +export const ChaincodeCallSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 12); + +/** + * ChaincodeQueryResult contains EndorsementDescriptors for + * chaincodes + * + * @generated from message discovery.ChaincodeQueryResult + */ +export type ChaincodeQueryResult = Message<"discovery.ChaincodeQueryResult"> & { + /** + * @generated from field: repeated discovery.EndorsementDescriptor content = 1; + */ + content: EndorsementDescriptor[]; +}; + +/** + * Describes the message discovery.ChaincodeQueryResult. + * Use `create(ChaincodeQueryResultSchema)` to create a new message. + */ +export const ChaincodeQueryResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 13); + +/** + * LocalPeerQuery queries for peers in a non channel context + * + * @generated from message discovery.LocalPeerQuery + */ +export type LocalPeerQuery = Message<"discovery.LocalPeerQuery"> & { +}; + +/** + * Describes the message discovery.LocalPeerQuery. + * Use `create(LocalPeerQuerySchema)` to create a new message. + */ +export const LocalPeerQuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 14); + +/** + * EndorsementDescriptor contains information about which peers can be used + * to request endorsement from, such that the endorsement policy would be fulfilled. + * Here is how to compute a set of peers to ask an endorsement from, given an EndorsementDescriptor: + * Let e: G --> P be the endorsers_by_groups field that maps a group to a set of peers. + * Note that applying e on a group g yields a set of peers. + * 1) Select a layout l: G --> N out of the layouts given. + * l is the quantities_by_group field of a Layout, and it maps a group to an integer. + * 2) R = {} (an empty set of peers) + * 3) For each group g in the layout l, compute n = l(g) + * 3.1) Denote P_g as a set of n random peers {p0, p1, ... p_n} selected from e(g) + * 3.2) R = R U P_g (add P_g to R) + * 4) The set of peers R is the peers the client needs to request endorsements from + * + * @generated from message discovery.EndorsementDescriptor + */ +export type EndorsementDescriptor = Message<"discovery.EndorsementDescriptor"> & { + /** + * @generated from field: string chaincode = 1; + */ + chaincode: string; + + /** + * Specifies the endorsers, separated to groups. + * + * @generated from field: map endorsers_by_groups = 2; + */ + endorsersByGroups: { [key: string]: Peers }; + + /** + * Specifies options of fulfulling the endorsement policy. + * Each option lists the group names, and the amount of signatures needed + * from each group. + * + * @generated from field: repeated discovery.Layout layouts = 3; + */ + layouts: Layout[]; +}; + +/** + * Describes the message discovery.EndorsementDescriptor. + * Use `create(EndorsementDescriptorSchema)` to create a new message. + */ +export const EndorsementDescriptorSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 15); + +/** + * Layout contains a mapping from a group name to number of peers + * that are needed for fulfilling an endorsement policy + * + * @generated from message discovery.Layout + */ +export type Layout = Message<"discovery.Layout"> & { + /** + * Specifies how many non repeated signatures of each group + * are needed for endorsement + * + * @generated from field: map quantities_by_group = 1; + */ + quantitiesByGroup: { [key: string]: number }; +}; + +/** + * Describes the message discovery.Layout. + * Use `create(LayoutSchema)` to create a new message. + */ +export const LayoutSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 16); + +/** + * Peers contains a list of Peer(s) + * + * @generated from message discovery.Peers + */ +export type Peers = Message<"discovery.Peers"> & { + /** + * @generated from field: repeated discovery.Peer peers = 1; + */ + peers: Peer[]; +}; + +/** + * Describes the message discovery.Peers. + * Use `create(PeersSchema)` to create a new message. + */ +export const PeersSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 17); + +/** + * Peer contains information about the peer such as its channel specific + * state, and membership information. + * + * @generated from message discovery.Peer + */ +export type Peer = Message<"discovery.Peer"> & { + /** + * This is an Envelope of a GossipMessage with a gossip.StateInfo message + * + * @generated from field: gossip.Envelope state_info = 1; + */ + stateInfo?: Envelope; + + /** + * This is an Envelope of a GossipMessage with a gossip.AliveMessage message + * + * @generated from field: gossip.Envelope membership_info = 2; + */ + membershipInfo?: Envelope; + + /** + * This is the msp.SerializedIdentity of the peer, represented in bytes. + * + * @generated from field: bytes identity = 3; + */ + identity: Uint8Array; +}; + +/** + * Describes the message discovery.Peer. + * Use `create(PeerSchema)` to create a new message. + */ +export const PeerSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 18); + +/** + * Error denotes that something went wrong and contains the error message + * + * @generated from message discovery.Error + */ +export type Error = Message<"discovery.Error"> & { + /** + * @generated from field: string content = 1; + */ + content: string; +}; + +/** + * Describes the message discovery.Error. + * Use `create(ErrorSchema)` to create a new message. + */ +export const ErrorSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 19); + +/** + * Endpoints is a list of Endpoint(s) + * + * @generated from message discovery.Endpoints + */ +export type Endpoints = Message<"discovery.Endpoints"> & { + /** + * @generated from field: repeated discovery.Endpoint endpoint = 1; + */ + endpoint: Endpoint[]; +}; + +/** + * Describes the message discovery.Endpoints. + * Use `create(EndpointsSchema)` to create a new message. + */ +export const EndpointsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 20); + +/** + * Endpoint is a combination of a host and a port + * + * @generated from message discovery.Endpoint + */ +export type Endpoint = Message<"discovery.Endpoint"> & { + /** + * @generated from field: string host = 1; + */ + host: string; + + /** + * @generated from field: uint32 port = 2; + */ + port: number; +}; + +/** + * Describes the message discovery.Endpoint. + * Use `create(EndpointSchema)` to create a new message. + */ +export const EndpointSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_discovery_protocol, 21); + +/** + * Discovery defines a service that serves information about the fabric network + * like which peers, orderers, chaincodes, etc. + * + * @generated from service discovery.Discovery + */ +export const Discovery: GenService<{ + /** + * Discover receives a signed request, and returns a response. + * + * @generated from rpc discovery.Discovery.Discover + */ + discover: { + methodKind: "unary"; + input: typeof SignedRequestSchema; + output: typeof ResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_discovery_protocol, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_connect.ts new file mode 100644 index 0000000000..4baac9fa85 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_connect.ts @@ -0,0 +1,122 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file driver/driver.proto (package driver.driver, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Query } from "../common/query_pb.js"; +import { Ack } from "../common/ack_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; +import { EventSubscription } from "../common/events_pb.js"; +import { AssignAssetRequest, CreateAssetRequest, ExtinguishRequest, PerformLockRequest, WriteExternalStateMessage } from "./driver_pb.js"; + +/** + * @generated from service driver.driver.DriverCommunication + */ +export const DriverCommunication = { + typeName: "driver.driver.DriverCommunication", + methods: { + /** + * Data Sharing + * the remote relay sends a RequestDriverState request to its driver with a + * query defining the data it wants to receive + * + * @generated from rpc driver.driver.DriverCommunication.RequestDriverState + */ + requestDriverState: { + name: "RequestDriverState", + I: Query, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * Events Subscription + * the src-relay uses this endpoint to forward the event subscription request from dest-relay to driver + * + * @generated from rpc driver.driver.DriverCommunication.SubscribeEvent + */ + subscribeEvent: { + name: "SubscribeEvent", + I: EventSubscription, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * Recommended to have TLS mode on for this unsafe endpoint + * Relay uses this to get Query.requestor_signature and + * Query.certificate required for event subscription + * + * @generated from rpc driver.driver.DriverCommunication.RequestSignedEventSubscriptionQuery + */ + requestSignedEventSubscriptionQuery: { + name: "RequestSignedEventSubscriptionQuery", + I: EventSubscription, + O: Query, + kind: MethodKind.Unary, + }, + /** + * Events Publication + * the dest-relay calls the dest-driver on this end point to write the remote network state to the local ledger + * + * @generated from rpc driver.driver.DriverCommunication.WriteExternalState + */ + writeExternalState: { + name: "WriteExternalState", + I: WriteExternalStateMessage, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * As part of SATP, the source reply (sender gateway) sends a PerformLock request to its driver + * to lock a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.PerformLock + */ + performLock: { + name: "PerformLock", + I: PerformLockRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * As part of SATP, the destination reply (receiver gateway) sends a CreateAsset request to its driver + * to create a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.CreateAsset + */ + createAsset: { + name: "CreateAsset", + I: CreateAssetRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * As part of SATP, the source reply (sender gateway) sends a Extinguish request to its driver + * to extinguish a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.Extinguish + */ + extinguish: { + name: "Extinguish", + I: ExtinguishRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * As part of SATP, the destination reply (receiver gateway) sends a AssignAsset request to its driver + * to assign a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.AssignAsset + */ + assignAsset: { + name: "AssignAsset", + I: AssignAssetRequest, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_pb.ts new file mode 100644 index 0000000000..47ed9d344b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/driver/driver_pb.ts @@ -0,0 +1,215 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file driver/driver.proto (package driver.driver, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { AckSchema } from "../common/ack_pb"; +import { file_common_ack } from "../common/ack_pb"; +import type { QuerySchema } from "../common/query_pb"; +import { file_common_query } from "../common/query_pb"; +import type { ContractTransaction, EventSubscriptionSchema } from "../common/events_pb"; +import { file_common_events } from "../common/events_pb"; +import type { ViewPayload } from "../common/state_pb"; +import { file_common_state } from "../common/state_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file driver/driver.proto. + */ +export const file_driver_driver: GenFile = /*@__PURE__*/ + fileDesc("ChNkcml2ZXIvZHJpdmVyLnByb3RvEg1kcml2ZXIuZHJpdmVyIn0KGVdyaXRlRXh0ZXJuYWxTdGF0ZU1lc3NhZ2USLwoMdmlld19wYXlsb2FkGAEgASgLMhkuY29tbW9uLnN0YXRlLlZpZXdQYXlsb2FkEi8KA2N0eBgCIAEoCzIiLmNvbW1vbi5ldmVudHMuQ29udHJhY3RUcmFuc2FjdGlvbiIoChJQZXJmb3JtTG9ja1JlcXVlc3QSEgoKc2Vzc2lvbl9pZBgBIAEoCSIoChJDcmVhdGVBc3NldFJlcXVlc3QSEgoKc2Vzc2lvbl9pZBgBIAEoCSInChFFeHRpbmd1aXNoUmVxdWVzdBISCgpzZXNzaW9uX2lkGAEgASgJIigKEkFzc2lnbkFzc2V0UmVxdWVzdBISCgpzZXNzaW9uX2lkGAEgASgJMt8EChNEcml2ZXJDb21tdW5pY2F0aW9uEjwKElJlcXVlc3REcml2ZXJTdGF0ZRITLmNvbW1vbi5xdWVyeS5RdWVyeRoPLmNvbW1vbi5hY2suQWNrIgASRQoOU3Vic2NyaWJlRXZlbnQSIC5jb21tb24uZXZlbnRzLkV2ZW50U3Vic2NyaXB0aW9uGg8uY29tbW9uLmFjay5BY2siABJeCiNSZXF1ZXN0U2lnbmVkRXZlbnRTdWJzY3JpcHRpb25RdWVyeRIgLmNvbW1vbi5ldmVudHMuRXZlbnRTdWJzY3JpcHRpb24aEy5jb21tb24ucXVlcnkuUXVlcnkiABJRChJXcml0ZUV4dGVybmFsU3RhdGUSKC5kcml2ZXIuZHJpdmVyLldyaXRlRXh0ZXJuYWxTdGF0ZU1lc3NhZ2UaDy5jb21tb24uYWNrLkFjayIAEkMKC1BlcmZvcm1Mb2NrEiEuZHJpdmVyLmRyaXZlci5QZXJmb3JtTG9ja1JlcXVlc3QaDy5jb21tb24uYWNrLkFjayIAEkMKC0NyZWF0ZUFzc2V0EiEuZHJpdmVyLmRyaXZlci5DcmVhdGVBc3NldFJlcXVlc3QaDy5jb21tb24uYWNrLkFjayIAEkEKCkV4dGluZ3Vpc2gSIC5kcml2ZXIuZHJpdmVyLkV4dGluZ3Vpc2hSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJDCgtBc3NpZ25Bc3NldBIhLmRyaXZlci5kcml2ZXIuQXNzaWduQXNzZXRSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siAEJ5CjFvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5kcml2ZXIuZHJpdmVyWkRnaXRodWIuY29tL2h5cGVybGVkZ2VyLWNhY3RpL2NhY3RpL3dlYXZlci9jb21tb24vcHJvdG9zLWdvL3YyL2RyaXZlcmIGcHJvdG8z", [file_common_ack, file_common_query, file_common_events, file_common_state]); + +/** + * Data for a View processing by dest-driver + * + * @generated from message driver.driver.WriteExternalStateMessage + */ +export type WriteExternalStateMessage = Message<"driver.driver.WriteExternalStateMessage"> & { + /** + * @generated from field: common.state.ViewPayload view_payload = 1; + */ + viewPayload?: ViewPayload; + + /** + * @generated from field: common.events.ContractTransaction ctx = 2; + */ + ctx?: ContractTransaction; +}; + +/** + * Describes the message driver.driver.WriteExternalStateMessage. + * Use `create(WriteExternalStateMessageSchema)` to create a new message. + */ +export const WriteExternalStateMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_driver_driver, 0); + +/** + * @generated from message driver.driver.PerformLockRequest + */ +export type PerformLockRequest = Message<"driver.driver.PerformLockRequest"> & { + /** + * @generated from field: string session_id = 1; + */ + sessionId: string; +}; + +/** + * Describes the message driver.driver.PerformLockRequest. + * Use `create(PerformLockRequestSchema)` to create a new message. + */ +export const PerformLockRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_driver_driver, 1); + +/** + * @generated from message driver.driver.CreateAssetRequest + */ +export type CreateAssetRequest = Message<"driver.driver.CreateAssetRequest"> & { + /** + * @generated from field: string session_id = 1; + */ + sessionId: string; +}; + +/** + * Describes the message driver.driver.CreateAssetRequest. + * Use `create(CreateAssetRequestSchema)` to create a new message. + */ +export const CreateAssetRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_driver_driver, 2); + +/** + * @generated from message driver.driver.ExtinguishRequest + */ +export type ExtinguishRequest = Message<"driver.driver.ExtinguishRequest"> & { + /** + * @generated from field: string session_id = 1; + */ + sessionId: string; +}; + +/** + * Describes the message driver.driver.ExtinguishRequest. + * Use `create(ExtinguishRequestSchema)` to create a new message. + */ +export const ExtinguishRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_driver_driver, 3); + +/** + * @generated from message driver.driver.AssignAssetRequest + */ +export type AssignAssetRequest = Message<"driver.driver.AssignAssetRequest"> & { + /** + * @generated from field: string session_id = 1; + */ + sessionId: string; +}; + +/** + * Describes the message driver.driver.AssignAssetRequest. + * Use `create(AssignAssetRequestSchema)` to create a new message. + */ +export const AssignAssetRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_driver_driver, 4); + +/** + * @generated from service driver.driver.DriverCommunication + */ +export const DriverCommunication: GenService<{ + /** + * Data Sharing + * the remote relay sends a RequestDriverState request to its driver with a + * query defining the data it wants to receive + * + * @generated from rpc driver.driver.DriverCommunication.RequestDriverState + */ + requestDriverState: { + methodKind: "unary"; + input: typeof QuerySchema; + output: typeof AckSchema; + }, + /** + * Events Subscription + * the src-relay uses this endpoint to forward the event subscription request from dest-relay to driver + * + * @generated from rpc driver.driver.DriverCommunication.SubscribeEvent + */ + subscribeEvent: { + methodKind: "unary"; + input: typeof EventSubscriptionSchema; + output: typeof AckSchema; + }, + /** + * Recommended to have TLS mode on for this unsafe endpoint + * Relay uses this to get Query.requestor_signature and + * Query.certificate required for event subscription + * + * @generated from rpc driver.driver.DriverCommunication.RequestSignedEventSubscriptionQuery + */ + requestSignedEventSubscriptionQuery: { + methodKind: "unary"; + input: typeof EventSubscriptionSchema; + output: typeof QuerySchema; + }, + /** + * Events Publication + * the dest-relay calls the dest-driver on this end point to write the remote network state to the local ledger + * + * @generated from rpc driver.driver.DriverCommunication.WriteExternalState + */ + writeExternalState: { + methodKind: "unary"; + input: typeof WriteExternalStateMessageSchema; + output: typeof AckSchema; + }, + /** + * As part of SATP, the source reply (sender gateway) sends a PerformLock request to its driver + * to lock a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.PerformLock + */ + performLock: { + methodKind: "unary"; + input: typeof PerformLockRequestSchema; + output: typeof AckSchema; + }, + /** + * As part of SATP, the destination reply (receiver gateway) sends a CreateAsset request to its driver + * to create a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.CreateAsset + */ + createAsset: { + methodKind: "unary"; + input: typeof CreateAssetRequestSchema; + output: typeof AckSchema; + }, + /** + * As part of SATP, the source reply (sender gateway) sends a Extinguish request to its driver + * to extinguish a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.Extinguish + */ + extinguish: { + methodKind: "unary"; + input: typeof ExtinguishRequestSchema; + output: typeof AckSchema; + }, + /** + * As part of SATP, the destination reply (receiver gateway) sends a AssignAsset request to its driver + * to assign a specific asset + * + * @generated from rpc driver.driver.DriverCommunication.AssignAsset + */ + assignAsset: { + methodKind: "unary"; + input: typeof AssignAssetRequestSchema; + output: typeof AckSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_driver_driver, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/fabric/view_data_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/fabric/view_data_pb.ts new file mode 100644 index 0000000000..601c54a8f4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/fabric/view_data_pb.ts @@ -0,0 +1,68 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file fabric/view_data.proto (package fabric.view_data, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Endorsement, ProposalResponsePayload } from "../peer/proposal_response_pb"; +import { file_peer_proposal_response } from "../peer/proposal_response_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file fabric/view_data.proto. + */ +export const file_fabric_view_data: GenFile = /*@__PURE__*/ + fileDesc("ChZmYWJyaWMvdmlld19kYXRhLnByb3RvEhBmYWJyaWMudmlld19kYXRhIuABCgpGYWJyaWNWaWV3EloKG2VuZG9yc2VkX3Byb3Bvc2FsX3Jlc3BvbnNlcxgBIAMoCzI1LmZhYnJpYy52aWV3X2RhdGEuRmFicmljVmlldy5FbmRvcnNlZFByb3Bvc2FsUmVzcG9uc2UadgoYRW5kb3JzZWRQcm9wb3NhbFJlc3BvbnNlEjAKB3BheWxvYWQYASABKAsyHy5wcm90b3MuUHJvcG9zYWxSZXNwb25zZVBheWxvYWQSKAoLZW5kb3JzZW1lbnQYAiABKAsyEy5wcm90b3MuRW5kb3JzZW1lbnRCfAo0b3JnLmh5cGVybGVkZ2VyLmNhY3RpLndlYXZlci5wcm90b3MuZmFicmljLnZpZXdfZGF0YVpEZ2l0aHViLmNvbS9oeXBlcmxlZGdlci1jYWN0aS9jYWN0aS93ZWF2ZXIvY29tbW9uL3Byb3Rvcy1nby92Mi9mYWJyaWNiBnByb3RvMw", [file_peer_proposal_response]); + +/** + * @generated from message fabric.view_data.FabricView + */ +export type FabricView = Message<"fabric.view_data.FabricView"> & { + /** + * @generated from field: repeated fabric.view_data.FabricView.EndorsedProposalResponse endorsed_proposal_responses = 1; + */ + endorsedProposalResponses: FabricView_EndorsedProposalResponse[]; +}; + +/** + * Describes the message fabric.view_data.FabricView. + * Use `create(FabricViewSchema)` to create a new message. + */ +export const FabricViewSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_fabric_view_data, 0); + +/** + * @generated from message fabric.view_data.FabricView.EndorsedProposalResponse + */ +export type FabricView_EndorsedProposalResponse = Message<"fabric.view_data.FabricView.EndorsedProposalResponse"> & { + /** + * `ProposalResponsePayload` is the output produced by each peer and signed as a serialized blob + * https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal_response.pb.go#L176 + * `ProposalResponsePayload` contains an `Extension` field which is of type `ChaincodeAction` + * https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal.pb.go#L280 + * We only need the `ProposalHash`, `ChaincodeId` and `Response` fields. + * + * @generated from field: protos.ProposalResponsePayload payload = 1; + */ + payload?: ProposalResponsePayload; + + /** + * Each `Endorsement` is an identity coupled with a signature + * https://github.com/hyperledger/fabric-protos-go/blob/main/peer/proposal_response.pb.go#L242 + * + * @generated from field: protos.Endorsement endorsement = 2; + */ + endorsement?: Endorsement; +}; + +/** + * Describes the message fabric.view_data.FabricView.EndorsedProposalResponse. + * Use `create(FabricView_EndorsedProposalResponseSchema)` to create a new message. + */ +export const FabricView_EndorsedProposalResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_fabric_view_data, 0, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_connect.ts new file mode 100644 index 0000000000..b84c9f9012 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_connect.ts @@ -0,0 +1,45 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file gossip/message.proto (package gossip, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Empty, Envelope } from "./message_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Gossip + * + * @generated from service gossip.Gossip + */ +export const Gossip = { + typeName: "gossip.Gossip", + methods: { + /** + * GossipStream is the gRPC stream used for sending and receiving messages + * + * @generated from rpc gossip.Gossip.GossipStream + */ + gossipStream: { + name: "GossipStream", + I: Envelope, + O: Envelope, + kind: MethodKind.BiDiStreaming, + }, + /** + * Ping is used to probe a remote peer's aliveness + * + * @generated from rpc gossip.Gossip.Ping + */ + ping: { + name: "Ping", + I: Empty, + O: Empty, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_pb.ts new file mode 100644 index 0000000000..0a72537095 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/gossip/message_pb.ts @@ -0,0 +1,1219 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file gossip/message.proto (package gossip, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { CollectionConfigPackage } from "../peer/collection_pb"; +import { file_peer_collection } from "../peer/collection_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file gossip/message.proto. + */ +export const file_gossip_message: GenFile = /*@__PURE__*/ + fileDesc("ChRnb3NzaXAvbWVzc2FnZS5wcm90bxIGZ29zc2lwIl8KCEVudmVsb3BlEg8KB3BheWxvYWQYASABKAwSEQoJc2lnbmF0dXJlGAIgASgMEi8KD3NlY3JldF9lbnZlbG9wZRgDIAEoCzIWLmdvc3NpcC5TZWNyZXRFbnZlbG9wZSI0Cg5TZWNyZXRFbnZlbG9wZRIPCgdwYXlsb2FkGAEgASgMEhEKCXNpZ25hdHVyZRgCIAEoDCIvCgZTZWNyZXQSGgoQaW50ZXJuYWxFbmRwb2ludBgBIAEoCUgAQgkKB2NvbnRlbnQijQkKDUdvc3NpcE1lc3NhZ2USDQoFbm9uY2UYASABKAQSDwoHY2hhbm5lbBgCIAEoDBImCgN0YWcYAyABKA4yGS5nb3NzaXAuR29zc2lwTWVzc2FnZS5UYWcSKQoJYWxpdmVfbXNnGAUgASgLMhQuZ29zc2lwLkFsaXZlTWVzc2FnZUgAEiwKB21lbV9yZXEYBiABKAsyGS5nb3NzaXAuTWVtYmVyc2hpcFJlcXVlc3RIABItCgdtZW1fcmVzGAcgASgLMhouZ29zc2lwLk1lbWJlcnNoaXBSZXNwb25zZUgAEicKCGRhdGFfbXNnGAggASgLMhMuZ29zc2lwLkRhdGFNZXNzYWdlSAASJAoFaGVsbG8YCSABKAsyEy5nb3NzaXAuR29zc2lwSGVsbG9IABImCghkYXRhX2RpZxgKIAEoCzISLmdvc3NpcC5EYXRhRGlnZXN0SAASJwoIZGF0YV9yZXEYCyABKAsyEy5nb3NzaXAuRGF0YVJlcXVlc3RIABIpCgtkYXRhX3VwZGF0ZRgMIAEoCzISLmdvc3NpcC5EYXRhVXBkYXRlSAASHgoFZW1wdHkYDSABKAsyDS5nb3NzaXAuRW1wdHlIABIlCgRjb25uGA4gASgLMhUuZ29zc2lwLkNvbm5Fc3RhYmxpc2hIABInCgpzdGF0ZV9pbmZvGA8gASgLMhEuZ29zc2lwLlN0YXRlSW5mb0gAEjMKDnN0YXRlX3NuYXBzaG90GBAgASgLMhkuZ29zc2lwLlN0YXRlSW5mb1NuYXBzaG90SAASOwoTc3RhdGVfaW5mb19wdWxsX3JlcRgRIAEoCzIcLmdvc3NpcC5TdGF0ZUluZm9QdWxsUmVxdWVzdEgAEjMKDXN0YXRlX3JlcXVlc3QYEiABKAsyGi5nb3NzaXAuUmVtb3RlU3RhdGVSZXF1ZXN0SAASNQoOc3RhdGVfcmVzcG9uc2UYEyABKAsyGy5nb3NzaXAuUmVtb3RlU3RhdGVSZXNwb25zZUgAEjMKDmxlYWRlcnNoaXBfbXNnGBQgASgLMhkuZ29zc2lwLkxlYWRlcnNoaXBNZXNzYWdlSAASLQoNcGVlcl9pZGVudGl0eRgVIAEoCzIULmdvc3NpcC5QZWVySWRlbnRpdHlIABImCgNhY2sYFiABKAsyFy5nb3NzaXAuQWNrbm93bGVkZ2VtZW50SAASMgoKcHJpdmF0ZVJlcRgXIAEoCzIcLmdvc3NpcC5SZW1vdGVQdnREYXRhUmVxdWVzdEgAEjMKCnByaXZhdGVSZXMYGCABKAsyHS5nb3NzaXAuUmVtb3RlUHZ0RGF0YVJlc3BvbnNlSAASMgoMcHJpdmF0ZV9kYXRhGBkgASgLMhouZ29zc2lwLlByaXZhdGVEYXRhTWVzc2FnZUgAIl8KA1RhZxINCglVTkRFRklORUQQABIJCgVFTVBUWRABEgwKCE9SR19PTkxZEAISDQoJQ0hBTl9PTkxZEAMSEAoMQ0hBTl9BTkRfT1JHEAQSDwoLQ0hBTl9PUl9PUkcQBUIJCgdjb250ZW50In0KCVN0YXRlSW5mbxIjCgl0aW1lc3RhbXAYAiABKAsyEC5nb3NzaXAuUGVlclRpbWUSDgoGcGtpX2lkGAMgASgMEhMKC2NoYW5uZWxfTUFDGAQgASgMEiYKCnByb3BlcnRpZXMYBSABKAsyEi5nb3NzaXAuUHJvcGVydGllcyJgCgpQcm9wZXJ0aWVzEhUKDWxlZGdlcl9oZWlnaHQYASABKAQSFAoMbGVmdF9jaGFubmVsGAIgASgIEiUKCmNoYWluY29kZXMYAyADKAsyES5nb3NzaXAuQ2hhaW5jb2RlIjcKEVN0YXRlSW5mb1NuYXBzaG90EiIKCGVsZW1lbnRzGAEgAygLMhAuZ29zc2lwLkVudmVsb3BlIisKFFN0YXRlSW5mb1B1bGxSZXF1ZXN0EhMKC2NoYW5uZWxfTUFDGAEgASgMIlcKDUNvbm5Fc3RhYmxpc2gSDgoGcGtpX2lkGAEgASgMEhAKCGlkZW50aXR5GAIgASgMEhUKDXRsc19jZXJ0X2hhc2gYAyABKAwSDQoFcHJvYmUYBCABKAgiPgoMUGVlcklkZW50aXR5Eg4KBnBraV9pZBgBIAEoDBIMCgRjZXJ0GAIgASgMEhAKCG1ldGFkYXRhGAMgASgMIlQKC0RhdGFSZXF1ZXN0Eg0KBW5vbmNlGAEgASgEEg8KB2RpZ2VzdHMYAiADKAwSJQoIbXNnX3R5cGUYAyABKA4yEy5nb3NzaXAuUHVsbE1zZ1R5cGUiVQoLR29zc2lwSGVsbG8SDQoFbm9uY2UYASABKAQSEAoIbWV0YWRhdGEYAiABKAwSJQoIbXNnX3R5cGUYAyABKA4yEy5nb3NzaXAuUHVsbE1zZ1R5cGUiYgoKRGF0YVVwZGF0ZRINCgVub25jZRgBIAEoBBIeCgRkYXRhGAIgAygLMhAuZ29zc2lwLkVudmVsb3BlEiUKCG1zZ190eXBlGAMgASgOMhMuZ29zc2lwLlB1bGxNc2dUeXBlIlMKCkRhdGFEaWdlc3QSDQoFbm9uY2UYASABKAQSDwoHZGlnZXN0cxgCIAMoDBIlCghtc2dfdHlwZRgDIAEoDjITLmdvc3NpcC5QdWxsTXNnVHlwZSIvCgtEYXRhTWVzc2FnZRIgCgdwYXlsb2FkGAEgASgLMg8uZ29zc2lwLlBheWxvYWQiPQoSUHJpdmF0ZURhdGFNZXNzYWdlEicKB3BheWxvYWQYASABKAsyFi5nb3NzaXAuUHJpdmF0ZVBheWxvYWQiPgoHUGF5bG9hZBIPCgdzZXFfbnVtGAEgASgEEgwKBGRhdGEYAiABKAwSFAoMcHJpdmF0ZV9kYXRhGAMgAygMIrsBCg5Qcml2YXRlUGF5bG9hZBIXCg9jb2xsZWN0aW9uX25hbWUYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEg0KBXR4X2lkGAMgASgJEhUKDXByaXZhdGVfcndzZXQYBCABKAwSGgoScHJpdmF0ZV9zaW1faGVpZ2h0GAUgASgEEjsKEmNvbGxlY3Rpb25fY29uZmlncxgGIAEoCzIfLnByb3Rvcy5Db2xsZWN0aW9uQ29uZmlnUGFja2FnZSJpCgxBbGl2ZU1lc3NhZ2USIgoKbWVtYmVyc2hpcBgBIAEoCzIOLmdvc3NpcC5NZW1iZXISIwoJdGltZXN0YW1wGAIgASgLMhAuZ29zc2lwLlBlZXJUaW1lEhAKCGlkZW50aXR5GAQgASgMImAKEUxlYWRlcnNoaXBNZXNzYWdlEg4KBnBraV9pZBgBIAEoDBIjCgl0aW1lc3RhbXAYAiABKAsyEC5nb3NzaXAuUGVlclRpbWUSFgoOaXNfZGVjbGFyYXRpb24YAyABKAgiLAoIUGVlclRpbWUSDwoHaW5jX251bRgBIAEoBBIPCgdzZXFfbnVtGAIgASgEIk4KEU1lbWJlcnNoaXBSZXF1ZXN0EioKEHNlbGZfaW5mb3JtYXRpb24YASABKAsyEC5nb3NzaXAuRW52ZWxvcGUSDQoFa25vd24YAiADKAwiVQoSTWVtYmVyc2hpcFJlc3BvbnNlEh8KBWFsaXZlGAEgAygLMhAuZ29zc2lwLkVudmVsb3BlEh4KBGRlYWQYAiADKAsyEC5nb3NzaXAuRW52ZWxvcGUiPAoGTWVtYmVyEhAKCGVuZHBvaW50GAEgASgJEhAKCG1ldGFkYXRhGAIgASgMEg4KBnBraV9pZBgDIAEoDCIHCgVFbXB0eSJAChJSZW1vdGVTdGF0ZVJlcXVlc3QSFQoNc3RhcnRfc2VxX251bRgBIAEoBBITCgtlbmRfc2VxX251bRgCIAEoBCI4ChNSZW1vdGVTdGF0ZVJlc3BvbnNlEiEKCHBheWxvYWRzGAEgAygLMg8uZ29zc2lwLlBheWxvYWQiPgoUUmVtb3RlUHZ0RGF0YVJlcXVlc3QSJgoHZGlnZXN0cxgBIAMoCzIVLmdvc3NpcC5QdnREYXRhRGlnZXN0Im4KDVB2dERhdGFEaWdlc3QSDQoFdHhfaWQYASABKAkSEQoJbmFtZXNwYWNlGAIgASgJEhIKCmNvbGxlY3Rpb24YAyABKAkSEQoJYmxvY2tfc2VxGAQgASgEEhQKDHNlcV9pbl9ibG9jaxgFIAEoBCJBChVSZW1vdGVQdnREYXRhUmVzcG9uc2USKAoIZWxlbWVudHMYASADKAsyFi5nb3NzaXAuUHZ0RGF0YUVsZW1lbnQiSAoOUHZ0RGF0YUVsZW1lbnQSJQoGZGlnZXN0GAEgASgLMhUuZ29zc2lwLlB2dERhdGFEaWdlc3QSDwoHcGF5bG9hZBgCIAMoDCI6Cg5QdnREYXRhUGF5bG9hZBIXCg90eF9zZXFfaW5fYmxvY2sYASABKAQSDwoHcGF5bG9hZBgCIAEoDCIgCg9BY2tub3dsZWRnZW1lbnQSDQoFZXJyb3IYASABKAkiPAoJQ2hhaW5jb2RlEgwKBG5hbWUYASABKAkSDwoHdmVyc2lvbhgCIAEoCRIQCghtZXRhZGF0YRgDIAEoDCo9CgtQdWxsTXNnVHlwZRINCglVTkRFRklORUQQABINCglCTE9DS19NU0cQARIQCgxJREVOVElUWV9NU0cQAjJmCgZHb3NzaXASNgoMR29zc2lwU3RyZWFtEhAuZ29zc2lwLkVudmVsb3BlGhAuZ29zc2lwLkVudmVsb3BlKAEwARIkCgRQaW5nEg0uZ29zc2lwLkVtcHR5Gg0uZ29zc2lwLkVtcHR5QlYKJG9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLmdvc3NpcFouZ2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL2dvc3NpcGIGcHJvdG8z", [file_peer_collection]); + +/** + * Envelope contains a marshalled + * GossipMessage and a signature over it. + * It may also contain a SecretEnvelope + * which is a marshalled Secret + * + * @generated from message gossip.Envelope + */ +export type Envelope = Message<"gossip.Envelope"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; + + /** + * @generated from field: gossip.SecretEnvelope secret_envelope = 3; + */ + secretEnvelope?: SecretEnvelope; +}; + +/** + * Describes the message gossip.Envelope. + * Use `create(EnvelopeSchema)` to create a new message. + */ +export const EnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 0); + +/** + * SecretEnvelope is a marshalled Secret + * and a signature over it. + * The signature should be validated by the peer + * that signed the Envelope the SecretEnvelope + * came with + * + * @generated from message gossip.SecretEnvelope + */ +export type SecretEnvelope = Message<"gossip.SecretEnvelope"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message gossip.SecretEnvelope. + * Use `create(SecretEnvelopeSchema)` to create a new message. + */ +export const SecretEnvelopeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 1); + +/** + * Secret is an entity that might be omitted + * from an Envelope when the remote peer that is receiving + * the Envelope shouldn't know the secret's content. + * + * @generated from message gossip.Secret + */ +export type Secret = Message<"gossip.Secret"> & { + /** + * @generated from oneof gossip.Secret.content + */ + content: { + /** + * @generated from field: string internalEndpoint = 1; + */ + value: string; + case: "internalEndpoint"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message gossip.Secret. + * Use `create(SecretSchema)` to create a new message. + */ +export const SecretSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 2); + +/** + * GossipMessage defines the message sent in a gossip network + * + * @generated from message gossip.GossipMessage + */ +export type GossipMessage = Message<"gossip.GossipMessage"> & { + /** + * used mainly for testing, but will might be used in the future + * for ensuring message delivery by acking + * + * @generated from field: uint64 nonce = 1; + */ + nonce: bigint; + + /** + * The channel of the message. + * Some GossipMessages may set this to nil, because + * they are cross-channels but some may not + * + * @generated from field: bytes channel = 2; + */ + channel: Uint8Array; + + /** + * determines to which peers it is allowed + * to forward the message + * + * @generated from field: gossip.GossipMessage.Tag tag = 3; + */ + tag: GossipMessage_Tag; + + /** + * @generated from oneof gossip.GossipMessage.content + */ + content: { + /** + * Membership + * + * @generated from field: gossip.AliveMessage alive_msg = 5; + */ + value: AliveMessage; + case: "aliveMsg"; + } | { + /** + * @generated from field: gossip.MembershipRequest mem_req = 6; + */ + value: MembershipRequest; + case: "memReq"; + } | { + /** + * @generated from field: gossip.MembershipResponse mem_res = 7; + */ + value: MembershipResponse; + case: "memRes"; + } | { + /** + * Contains a ledger block + * + * @generated from field: gossip.DataMessage data_msg = 8; + */ + value: DataMessage; + case: "dataMsg"; + } | { + /** + * Used for push&pull + * + * @generated from field: gossip.GossipHello hello = 9; + */ + value: GossipHello; + case: "hello"; + } | { + /** + * @generated from field: gossip.DataDigest data_dig = 10; + */ + value: DataDigest; + case: "dataDig"; + } | { + /** + * @generated from field: gossip.DataRequest data_req = 11; + */ + value: DataRequest; + case: "dataReq"; + } | { + /** + * @generated from field: gossip.DataUpdate data_update = 12; + */ + value: DataUpdate; + case: "dataUpdate"; + } | { + /** + * Empty message, used for pinging + * + * @generated from field: gossip.Empty empty = 13; + */ + value: Empty; + case: "empty"; + } | { + /** + * ConnEstablish, used for establishing a connection + * + * @generated from field: gossip.ConnEstablish conn = 14; + */ + value: ConnEstablish; + case: "conn"; + } | { + /** + * Used for relaying information + * about state + * + * @generated from field: gossip.StateInfo state_info = 15; + */ + value: StateInfo; + case: "stateInfo"; + } | { + /** + * Used for sending sets of StateInfo messages + * + * @generated from field: gossip.StateInfoSnapshot state_snapshot = 16; + */ + value: StateInfoSnapshot; + case: "stateSnapshot"; + } | { + /** + * Used for asking for StateInfoSnapshots + * + * @generated from field: gossip.StateInfoPullRequest state_info_pull_req = 17; + */ + value: StateInfoPullRequest; + case: "stateInfoPullReq"; + } | { + /** + * Used to ask from a remote peer a set of blocks + * + * @generated from field: gossip.RemoteStateRequest state_request = 18; + */ + value: RemoteStateRequest; + case: "stateRequest"; + } | { + /** + * Used to send a set of blocks to a remote peer + * + * @generated from field: gossip.RemoteStateResponse state_response = 19; + */ + value: RemoteStateResponse; + case: "stateResponse"; + } | { + /** + * Used to indicate intent of peer to become leader + * + * @generated from field: gossip.LeadershipMessage leadership_msg = 20; + */ + value: LeadershipMessage; + case: "leadershipMsg"; + } | { + /** + * Used to learn of a peer's certificate + * + * @generated from field: gossip.PeerIdentity peer_identity = 21; + */ + value: PeerIdentity; + case: "peerIdentity"; + } | { + /** + * @generated from field: gossip.Acknowledgement ack = 22; + */ + value: Acknowledgement; + case: "ack"; + } | { + /** + * Used to request private data + * + * @generated from field: gossip.RemotePvtDataRequest privateReq = 23; + */ + value: RemotePvtDataRequest; + case: "privateReq"; + } | { + /** + * Used to respond to private data requests + * + * @generated from field: gossip.RemotePvtDataResponse privateRes = 24; + */ + value: RemotePvtDataResponse; + case: "privateRes"; + } | { + /** + * Encapsulates private data used to distribute + * private rwset after the endorsement + * + * @generated from field: gossip.PrivateDataMessage private_data = 25; + */ + value: PrivateDataMessage; + case: "privateData"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message gossip.GossipMessage. + * Use `create(GossipMessageSchema)` to create a new message. + */ +export const GossipMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 3); + +/** + * @generated from enum gossip.GossipMessage.Tag + */ +export enum GossipMessage_Tag { + /** + * @generated from enum value: UNDEFINED = 0; + */ + UNDEFINED = 0, + + /** + * @generated from enum value: EMPTY = 1; + */ + EMPTY = 1, + + /** + * @generated from enum value: ORG_ONLY = 2; + */ + ORG_ONLY = 2, + + /** + * @generated from enum value: CHAN_ONLY = 3; + */ + CHAN_ONLY = 3, + + /** + * @generated from enum value: CHAN_AND_ORG = 4; + */ + CHAN_AND_ORG = 4, + + /** + * @generated from enum value: CHAN_OR_ORG = 5; + */ + CHAN_OR_ORG = 5, +} + +/** + * Describes the enum gossip.GossipMessage.Tag. + */ +export const GossipMessage_TagSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_gossip_message, 3, 0); + +/** + * StateInfo is used for a peer to relay its state information + * to other peers + * + * @generated from message gossip.StateInfo + */ +export type StateInfo = Message<"gossip.StateInfo"> & { + /** + * @generated from field: gossip.PeerTime timestamp = 2; + */ + timestamp?: PeerTime; + + /** + * @generated from field: bytes pki_id = 3; + */ + pkiId: Uint8Array; + + /** + * channel_MAC is an authentication code that proves + * that the peer that sent this message knows + * the name of the channel. + * + * @generated from field: bytes channel_MAC = 4; + */ + channelMAC: Uint8Array; + + /** + * @generated from field: gossip.Properties properties = 5; + */ + properties?: Properties; +}; + +/** + * Describes the message gossip.StateInfo. + * Use `create(StateInfoSchema)` to create a new message. + */ +export const StateInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 4); + +/** + * @generated from message gossip.Properties + */ +export type Properties = Message<"gossip.Properties"> & { + /** + * @generated from field: uint64 ledger_height = 1; + */ + ledgerHeight: bigint; + + /** + * @generated from field: bool left_channel = 2; + */ + leftChannel: boolean; + + /** + * @generated from field: repeated gossip.Chaincode chaincodes = 3; + */ + chaincodes: Chaincode[]; +}; + +/** + * Describes the message gossip.Properties. + * Use `create(PropertiesSchema)` to create a new message. + */ +export const PropertiesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 5); + +/** + * StateInfoSnapshot is an aggregation of StateInfo messages + * + * @generated from message gossip.StateInfoSnapshot + */ +export type StateInfoSnapshot = Message<"gossip.StateInfoSnapshot"> & { + /** + * @generated from field: repeated gossip.Envelope elements = 1; + */ + elements: Envelope[]; +}; + +/** + * Describes the message gossip.StateInfoSnapshot. + * Use `create(StateInfoSnapshotSchema)` to create a new message. + */ +export const StateInfoSnapshotSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 6); + +/** + * StateInfoPullRequest is used to fetch a StateInfoSnapshot + * from a remote peer + * + * @generated from message gossip.StateInfoPullRequest + */ +export type StateInfoPullRequest = Message<"gossip.StateInfoPullRequest"> & { + /** + * channel_MAC is an authentication code that proves + * that the peer that sent this message knows + * the name of the channel. + * + * @generated from field: bytes channel_MAC = 1; + */ + channelMAC: Uint8Array; +}; + +/** + * Describes the message gossip.StateInfoPullRequest. + * Use `create(StateInfoPullRequestSchema)` to create a new message. + */ +export const StateInfoPullRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 7); + +/** + * ConnEstablish is the message used for the gossip handshake + * Whenever a peer connects to another peer, it handshakes + * with it by sending this message that proves its identity + * + * @generated from message gossip.ConnEstablish + */ +export type ConnEstablish = Message<"gossip.ConnEstablish"> & { + /** + * @generated from field: bytes pki_id = 1; + */ + pkiId: Uint8Array; + + /** + * @generated from field: bytes identity = 2; + */ + identity: Uint8Array; + + /** + * @generated from field: bytes tls_cert_hash = 3; + */ + tlsCertHash: Uint8Array; + + /** + * @generated from field: bool probe = 4; + */ + probe: boolean; +}; + +/** + * Describes the message gossip.ConnEstablish. + * Use `create(ConnEstablishSchema)` to create a new message. + */ +export const ConnEstablishSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 8); + +/** + * PeerIdentity defines the identity of the peer + * Used to make other peers learn of the identity + * of a certain peer + * + * @generated from message gossip.PeerIdentity + */ +export type PeerIdentity = Message<"gossip.PeerIdentity"> & { + /** + * @generated from field: bytes pki_id = 1; + */ + pkiId: Uint8Array; + + /** + * @generated from field: bytes cert = 2; + */ + cert: Uint8Array; + + /** + * @generated from field: bytes metadata = 3; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message gossip.PeerIdentity. + * Use `create(PeerIdentitySchema)` to create a new message. + */ +export const PeerIdentitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 9); + +/** + * DataRequest is a message used for a peer to request + * certain data blocks from a remote peer + * + * @generated from message gossip.DataRequest + */ +export type DataRequest = Message<"gossip.DataRequest"> & { + /** + * @generated from field: uint64 nonce = 1; + */ + nonce: bigint; + + /** + * @generated from field: repeated bytes digests = 2; + */ + digests: Uint8Array[]; + + /** + * @generated from field: gossip.PullMsgType msg_type = 3; + */ + msgType: PullMsgType; +}; + +/** + * Describes the message gossip.DataRequest. + * Use `create(DataRequestSchema)` to create a new message. + */ +export const DataRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 10); + +/** + * GossipHello is the message that is used for the peer to initiate + * a pull round with another peer + * + * @generated from message gossip.GossipHello + */ +export type GossipHello = Message<"gossip.GossipHello"> & { + /** + * @generated from field: uint64 nonce = 1; + */ + nonce: bigint; + + /** + * @generated from field: bytes metadata = 2; + */ + metadata: Uint8Array; + + /** + * @generated from field: gossip.PullMsgType msg_type = 3; + */ + msgType: PullMsgType; +}; + +/** + * Describes the message gossip.GossipHello. + * Use `create(GossipHelloSchema)` to create a new message. + */ +export const GossipHelloSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 11); + +/** + * DataUpdate is the final message in the pull phase + * sent from the receiver to the initiator + * + * @generated from message gossip.DataUpdate + */ +export type DataUpdate = Message<"gossip.DataUpdate"> & { + /** + * @generated from field: uint64 nonce = 1; + */ + nonce: bigint; + + /** + * @generated from field: repeated gossip.Envelope data = 2; + */ + data: Envelope[]; + + /** + * @generated from field: gossip.PullMsgType msg_type = 3; + */ + msgType: PullMsgType; +}; + +/** + * Describes the message gossip.DataUpdate. + * Use `create(DataUpdateSchema)` to create a new message. + */ +export const DataUpdateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 12); + +/** + * DataDigest is the message sent from the receiver peer + * to the initator peer and contains the data items it has + * + * @generated from message gossip.DataDigest + */ +export type DataDigest = Message<"gossip.DataDigest"> & { + /** + * @generated from field: uint64 nonce = 1; + */ + nonce: bigint; + + /** + * Maybe change this to bitmap later on + * + * @generated from field: repeated bytes digests = 2; + */ + digests: Uint8Array[]; + + /** + * @generated from field: gossip.PullMsgType msg_type = 3; + */ + msgType: PullMsgType; +}; + +/** + * Describes the message gossip.DataDigest. + * Use `create(DataDigestSchema)` to create a new message. + */ +export const DataDigestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 13); + +/** + * DataMessage is the message that contains a block + * + * @generated from message gossip.DataMessage + */ +export type DataMessage = Message<"gossip.DataMessage"> & { + /** + * @generated from field: gossip.Payload payload = 1; + */ + payload?: Payload; +}; + +/** + * Describes the message gossip.DataMessage. + * Use `create(DataMessageSchema)` to create a new message. + */ +export const DataMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 14); + +/** + * PrivateDataMessage message which includes private + * data information to distributed once transaction + * has been endorsed + * + * @generated from message gossip.PrivateDataMessage + */ +export type PrivateDataMessage = Message<"gossip.PrivateDataMessage"> & { + /** + * @generated from field: gossip.PrivatePayload payload = 1; + */ + payload?: PrivatePayload; +}; + +/** + * Describes the message gossip.PrivateDataMessage. + * Use `create(PrivateDataMessageSchema)` to create a new message. + */ +export const PrivateDataMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 15); + +/** + * Payload contains a block + * + * @generated from message gossip.Payload + */ +export type Payload = Message<"gossip.Payload"> & { + /** + * @generated from field: uint64 seq_num = 1; + */ + seqNum: bigint; + + /** + * @generated from field: bytes data = 2; + */ + data: Uint8Array; + + /** + * @generated from field: repeated bytes private_data = 3; + */ + privateData: Uint8Array[]; +}; + +/** + * Describes the message gossip.Payload. + * Use `create(PayloadSchema)` to create a new message. + */ +export const PayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 16); + +/** + * PrivatePayload payload to encapsulate private + * data with collection name to enable routing + * based on collection partitioning + * + * @generated from message gossip.PrivatePayload + */ +export type PrivatePayload = Message<"gossip.PrivatePayload"> & { + /** + * @generated from field: string collection_name = 1; + */ + collectionName: string; + + /** + * @generated from field: string namespace = 2; + */ + namespace: string; + + /** + * @generated from field: string tx_id = 3; + */ + txId: string; + + /** + * @generated from field: bytes private_rwset = 4; + */ + privateRwset: Uint8Array; + + /** + * @generated from field: uint64 private_sim_height = 5; + */ + privateSimHeight: bigint; + + /** + * @generated from field: protos.CollectionConfigPackage collection_configs = 6; + */ + collectionConfigs?: CollectionConfigPackage; +}; + +/** + * Describes the message gossip.PrivatePayload. + * Use `create(PrivatePayloadSchema)` to create a new message. + */ +export const PrivatePayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 17); + +/** + * AliveMessage is sent to inform remote peers + * of a peer's existence and activity + * + * @generated from message gossip.AliveMessage + */ +export type AliveMessage = Message<"gossip.AliveMessage"> & { + /** + * @generated from field: gossip.Member membership = 1; + */ + membership?: Member; + + /** + * @generated from field: gossip.PeerTime timestamp = 2; + */ + timestamp?: PeerTime; + + /** + * @generated from field: bytes identity = 4; + */ + identity: Uint8Array; +}; + +/** + * Describes the message gossip.AliveMessage. + * Use `create(AliveMessageSchema)` to create a new message. + */ +export const AliveMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 18); + +/** + * Leadership Message is sent during leader election to inform + * remote peers about intent of peer to proclaim itself as leader + * + * @generated from message gossip.LeadershipMessage + */ +export type LeadershipMessage = Message<"gossip.LeadershipMessage"> & { + /** + * @generated from field: bytes pki_id = 1; + */ + pkiId: Uint8Array; + + /** + * @generated from field: gossip.PeerTime timestamp = 2; + */ + timestamp?: PeerTime; + + /** + * @generated from field: bool is_declaration = 3; + */ + isDeclaration: boolean; +}; + +/** + * Describes the message gossip.LeadershipMessage. + * Use `create(LeadershipMessageSchema)` to create a new message. + */ +export const LeadershipMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 19); + +/** + * PeerTime defines the logical time of a peer's life + * + * @generated from message gossip.PeerTime + */ +export type PeerTime = Message<"gossip.PeerTime"> & { + /** + * @generated from field: uint64 inc_num = 1; + */ + incNum: bigint; + + /** + * @generated from field: uint64 seq_num = 2; + */ + seqNum: bigint; +}; + +/** + * Describes the message gossip.PeerTime. + * Use `create(PeerTimeSchema)` to create a new message. + */ +export const PeerTimeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 20); + +/** + * MembershipRequest is used to ask membership information + * from a remote peer + * + * @generated from message gossip.MembershipRequest + */ +export type MembershipRequest = Message<"gossip.MembershipRequest"> & { + /** + * @generated from field: gossip.Envelope self_information = 1; + */ + selfInformation?: Envelope; + + /** + * @generated from field: repeated bytes known = 2; + */ + known: Uint8Array[]; +}; + +/** + * Describes the message gossip.MembershipRequest. + * Use `create(MembershipRequestSchema)` to create a new message. + */ +export const MembershipRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 21); + +/** + * MembershipResponse is used for replying to MembershipRequests + * + * @generated from message gossip.MembershipResponse + */ +export type MembershipResponse = Message<"gossip.MembershipResponse"> & { + /** + * @generated from field: repeated gossip.Envelope alive = 1; + */ + alive: Envelope[]; + + /** + * @generated from field: repeated gossip.Envelope dead = 2; + */ + dead: Envelope[]; +}; + +/** + * Describes the message gossip.MembershipResponse. + * Use `create(MembershipResponseSchema)` to create a new message. + */ +export const MembershipResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 22); + +/** + * Member holds membership-related information + * about a peer + * + * @generated from message gossip.Member + */ +export type Member = Message<"gossip.Member"> & { + /** + * @generated from field: string endpoint = 1; + */ + endpoint: string; + + /** + * @generated from field: bytes metadata = 2; + */ + metadata: Uint8Array; + + /** + * @generated from field: bytes pki_id = 3; + */ + pkiId: Uint8Array; +}; + +/** + * Describes the message gossip.Member. + * Use `create(MemberSchema)` to create a new message. + */ +export const MemberSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 23); + +/** + * Empty is used for pinging and in tests + * + * @generated from message gossip.Empty + */ +export type Empty = Message<"gossip.Empty"> & { +}; + +/** + * Describes the message gossip.Empty. + * Use `create(EmptySchema)` to create a new message. + */ +export const EmptySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 24); + +/** + * RemoteStateRequest is used to ask a set of blocks + * from a remote peer + * + * @generated from message gossip.RemoteStateRequest + */ +export type RemoteStateRequest = Message<"gossip.RemoteStateRequest"> & { + /** + * @generated from field: uint64 start_seq_num = 1; + */ + startSeqNum: bigint; + + /** + * @generated from field: uint64 end_seq_num = 2; + */ + endSeqNum: bigint; +}; + +/** + * Describes the message gossip.RemoteStateRequest. + * Use `create(RemoteStateRequestSchema)` to create a new message. + */ +export const RemoteStateRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 25); + +/** + * RemoteStateResponse is used to send a set of blocks + * to a remote peer + * + * @generated from message gossip.RemoteStateResponse + */ +export type RemoteStateResponse = Message<"gossip.RemoteStateResponse"> & { + /** + * @generated from field: repeated gossip.Payload payloads = 1; + */ + payloads: Payload[]; +}; + +/** + * Describes the message gossip.RemoteStateResponse. + * Use `create(RemoteStateResponseSchema)` to create a new message. + */ +export const RemoteStateResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 26); + +/** + * RemotePrivateDataRequest message used to request + * missing private rwset + * + * @generated from message gossip.RemotePvtDataRequest + */ +export type RemotePvtDataRequest = Message<"gossip.RemotePvtDataRequest"> & { + /** + * @generated from field: repeated gossip.PvtDataDigest digests = 1; + */ + digests: PvtDataDigest[]; +}; + +/** + * Describes the message gossip.RemotePvtDataRequest. + * Use `create(RemotePvtDataRequestSchema)` to create a new message. + */ +export const RemotePvtDataRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 27); + +/** + * PvtDataDigest defines a digest of private data + * + * @generated from message gossip.PvtDataDigest + */ +export type PvtDataDigest = Message<"gossip.PvtDataDigest"> & { + /** + * @generated from field: string tx_id = 1; + */ + txId: string; + + /** + * @generated from field: string namespace = 2; + */ + namespace: string; + + /** + * @generated from field: string collection = 3; + */ + collection: string; + + /** + * @generated from field: uint64 block_seq = 4; + */ + blockSeq: bigint; + + /** + * @generated from field: uint64 seq_in_block = 5; + */ + seqInBlock: bigint; +}; + +/** + * Describes the message gossip.PvtDataDigest. + * Use `create(PvtDataDigestSchema)` to create a new message. + */ +export const PvtDataDigestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 28); + +/** + * RemotePrivateData message to response on private + * data replication request + * + * @generated from message gossip.RemotePvtDataResponse + */ +export type RemotePvtDataResponse = Message<"gossip.RemotePvtDataResponse"> & { + /** + * @generated from field: repeated gossip.PvtDataElement elements = 1; + */ + elements: PvtDataElement[]; +}; + +/** + * Describes the message gossip.RemotePvtDataResponse. + * Use `create(RemotePvtDataResponseSchema)` to create a new message. + */ +export const RemotePvtDataResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 29); + +/** + * @generated from message gossip.PvtDataElement + */ +export type PvtDataElement = Message<"gossip.PvtDataElement"> & { + /** + * @generated from field: gossip.PvtDataDigest digest = 1; + */ + digest?: PvtDataDigest; + + /** + * the payload is a marshaled kvrwset.KVRWSet + * + * @generated from field: repeated bytes payload = 2; + */ + payload: Uint8Array[]; +}; + +/** + * Describes the message gossip.PvtDataElement. + * Use `create(PvtDataElementSchema)` to create a new message. + */ +export const PvtDataElementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 30); + +/** + * PvtPayload augments private rwset data and tx index + * inside the block + * + * @generated from message gossip.PvtDataPayload + */ +export type PvtDataPayload = Message<"gossip.PvtDataPayload"> & { + /** + * @generated from field: uint64 tx_seq_in_block = 1; + */ + txSeqInBlock: bigint; + + /** + * Encodes marhslaed bytes of rwset.TxPvtReadWriteSet + * defined in rwset.proto + * + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; +}; + +/** + * Describes the message gossip.PvtDataPayload. + * Use `create(PvtDataPayloadSchema)` to create a new message. + */ +export const PvtDataPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 31); + +/** + * @generated from message gossip.Acknowledgement + */ +export type Acknowledgement = Message<"gossip.Acknowledgement"> & { + /** + * @generated from field: string error = 1; + */ + error: string; +}; + +/** + * Describes the message gossip.Acknowledgement. + * Use `create(AcknowledgementSchema)` to create a new message. + */ +export const AcknowledgementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 32); + +/** + * Chaincode represents a Chaincode that is installed + * on a peer + * + * @generated from message gossip.Chaincode + */ +export type Chaincode = Message<"gossip.Chaincode"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: string version = 2; + */ + version: string; + + /** + * @generated from field: bytes metadata = 3; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message gossip.Chaincode. + * Use `create(ChaincodeSchema)` to create a new message. + */ +export const ChaincodeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_gossip_message, 33); + +/** + * @generated from enum gossip.PullMsgType + */ +export enum PullMsgType { + /** + * @generated from enum value: UNDEFINED = 0; + */ + UNDEFINED = 0, + + /** + * @generated from enum value: BLOCK_MSG = 1; + */ + BLOCK_MSG = 1, + + /** + * @generated from enum value: IDENTITY_MSG = 2; + */ + IDENTITY_MSG = 2, +} + +/** + * Describes the enum gossip.PullMsgType. + */ +export const PullMsgTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_gossip_message, 0); + +/** + * Gossip + * + * @generated from service gossip.Gossip + */ +export const Gossip: GenService<{ + /** + * GossipStream is the gRPC stream used for sending and receiving messages + * + * @generated from rpc gossip.Gossip.GossipStream + */ + gossipStream: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof EnvelopeSchema; + }, + /** + * Ping is used to probe a remote peer's aliveness + * + * @generated from rpc gossip.Gossip.Ping + */ + ping: { + methodKind: "unary"; + input: typeof EmptySchema; + output: typeof EmptySchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_gossip_message, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/queryresult/kv_query_result_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/queryresult/kv_query_result_pb.ts new file mode 100644 index 0000000000..67b039b534 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/queryresult/kv_query_result_pb.ts @@ -0,0 +1,84 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file ledger/queryresult/kv_query_result.proto (package queryresult, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file ledger/queryresult/kv_query_result.proto. + */ +export const file_ledger_queryresult_kv_query_result: GenFile = /*@__PURE__*/ + fileDesc("CihsZWRnZXIvcXVlcnlyZXN1bHQva3ZfcXVlcnlfcmVzdWx0LnByb3RvEgtxdWVyeXJlc3VsdCIzCgJLVhIRCgluYW1lc3BhY2UYASABKAkSCwoDa2V5GAIgASgJEg0KBXZhbHVlGAMgASgMInEKD0tleU1vZGlmaWNhdGlvbhINCgV0eF9pZBgBIAEoCRINCgV2YWx1ZRgCIAEoDBItCgl0aW1lc3RhbXAYAyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhEKCWlzX2RlbGV0ZRgEIAEoCEJuCjBvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5sZWRnZXIucXVlcnlyZXN1bHRaOmdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9sZWRnZXIvcXVlcnlyZXN1bHRiBnByb3RvMw", [file_google_protobuf_timestamp]); + +/** + * KV -- QueryResult for range/execute query. Holds a key and corresponding value. + * + * @generated from message queryresult.KV + */ +export type KV = Message<"queryresult.KV"> & { + /** + * @generated from field: string namespace = 1; + */ + namespace: string; + + /** + * @generated from field: string key = 2; + */ + key: string; + + /** + * @generated from field: bytes value = 3; + */ + value: Uint8Array; +}; + +/** + * Describes the message queryresult.KV. + * Use `create(KVSchema)` to create a new message. + */ +export const KVSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_queryresult_kv_query_result, 0); + +/** + * KeyModification -- QueryResult for history query. Holds a transaction ID, value, + * timestamp, and delete marker which resulted from a history query. + * + * @generated from message queryresult.KeyModification + */ +export type KeyModification = Message<"queryresult.KeyModification"> & { + /** + * @generated from field: string tx_id = 1; + */ + txId: string; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @generated from field: google.protobuf.Timestamp timestamp = 3; + */ + timestamp?: Timestamp; + + /** + * @generated from field: bool is_delete = 4; + */ + isDelete: boolean; +}; + +/** + * Describes the message queryresult.KeyModification. + * Use `create(KeyModificationSchema)` to create a new message. + */ +export const KeyModificationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_queryresult_kv_query_result, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/kvrwset/kv_rwset_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/kvrwset/kv_rwset_pb.ts new file mode 100644 index 0000000000..44d49b9e8a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/kvrwset/kv_rwset_pb.ts @@ -0,0 +1,393 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file ledger/rwset/kvrwset/kv_rwset.proto (package kvrwset, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file ledger/rwset/kvrwset/kv_rwset.proto. + */ +export const file_ledger_rwset_kvrwset_kv_rwset: GenFile = /*@__PURE__*/ + fileDesc("CiNsZWRnZXIvcndzZXQva3Zyd3NldC9rdl9yd3NldC5wcm90bxIHa3Zyd3NldCKzAQoHS1ZSV1NldBIeCgVyZWFkcxgBIAMoCzIPLmt2cndzZXQuS1ZSZWFkEjMKEnJhbmdlX3F1ZXJpZXNfaW5mbxgCIAMoCzIXLmt2cndzZXQuUmFuZ2VRdWVyeUluZm8SIAoGd3JpdGVzGAMgAygLMhAua3Zyd3NldC5LVldyaXRlEjEKD21ldGFkYXRhX3dyaXRlcxgEIAMoCzIYLmt2cndzZXQuS1ZNZXRhZGF0YVdyaXRlIpwBCgtIYXNoZWRSV1NldBIpCgxoYXNoZWRfcmVhZHMYASADKAsyEy5rdnJ3c2V0LktWUmVhZEhhc2gSKwoNaGFzaGVkX3dyaXRlcxgCIAMoCzIULmt2cndzZXQuS1ZXcml0ZUhhc2gSNQoPbWV0YWRhdGFfd3JpdGVzGAMgAygLMhwua3Zyd3NldC5LVk1ldGFkYXRhV3JpdGVIYXNoIjgKBktWUmVhZBILCgNrZXkYASABKAkSIQoHdmVyc2lvbhgCIAEoCzIQLmt2cndzZXQuVmVyc2lvbiI4CgdLVldyaXRlEgsKA2tleRgBIAEoCRIRCglpc19kZWxldGUYAiABKAgSDQoFdmFsdWUYAyABKAwiSQoPS1ZNZXRhZGF0YVdyaXRlEgsKA2tleRgBIAEoCRIpCgdlbnRyaWVzGAIgAygLMhgua3Zyd3NldC5LVk1ldGFkYXRhRW50cnkiQQoKS1ZSZWFkSGFzaBIQCghrZXlfaGFzaBgBIAEoDBIhCgd2ZXJzaW9uGAIgASgLMhAua3Zyd3NldC5WZXJzaW9uIkYKC0tWV3JpdGVIYXNoEhAKCGtleV9oYXNoGAEgASgMEhEKCWlzX2RlbGV0ZRgCIAEoCBISCgp2YWx1ZV9oYXNoGAMgASgMIlIKE0tWTWV0YWRhdGFXcml0ZUhhc2gSEAoIa2V5X2hhc2gYASABKAwSKQoHZW50cmllcxgCIAMoCzIYLmt2cndzZXQuS1ZNZXRhZGF0YUVudHJ5Ii4KD0tWTWV0YWRhdGFFbnRyeRIMCgRuYW1lGAEgASgJEg0KBXZhbHVlGAIgASgMIiwKB1ZlcnNpb24SEQoJYmxvY2tfbnVtGAEgASgEEg4KBnR4X251bRgCIAEoBCLEAQoOUmFuZ2VRdWVyeUluZm8SEQoJc3RhcnRfa2V5GAEgASgJEg8KB2VuZF9rZXkYAiABKAkSFQoNaXRyX2V4aGF1c3RlZBgDIAEoCBIoCglyYXdfcmVhZHMYBCABKAsyEy5rdnJ3c2V0LlF1ZXJ5UmVhZHNIABI/ChNyZWFkc19tZXJrbGVfaGFzaGVzGAUgASgLMiAua3Zyd3NldC5RdWVyeVJlYWRzTWVya2xlU3VtbWFyeUgAQgwKCnJlYWRzX2luZm8iLwoKUXVlcnlSZWFkcxIhCghrdl9yZWFkcxgBIAMoCzIPLmt2cndzZXQuS1ZSZWFkIloKF1F1ZXJ5UmVhZHNNZXJrbGVTdW1tYXJ5EhIKCm1heF9kZWdyZWUYASABKA0SEQoJbWF4X2xldmVsGAIgASgNEhgKEG1heF9sZXZlbF9oYXNoZXMYAyADKAxCcgoyb3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MubGVkZ2VyLnJ3c2V0Lmt2cndzZXRaPGdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9sZWRnZXIvcndzZXQva3Zyd3NldGIGcHJvdG8z"); + +/** + * KVRWSet encapsulates the read-write set for a chaincode that operates upon a KV or Document data model + * This structure is used for both the public data and the private data + * + * @generated from message kvrwset.KVRWSet + */ +export type KVRWSet = Message<"kvrwset.KVRWSet"> & { + /** + * @generated from field: repeated kvrwset.KVRead reads = 1; + */ + reads: KVRead[]; + + /** + * @generated from field: repeated kvrwset.RangeQueryInfo range_queries_info = 2; + */ + rangeQueriesInfo: RangeQueryInfo[]; + + /** + * @generated from field: repeated kvrwset.KVWrite writes = 3; + */ + writes: KVWrite[]; + + /** + * @generated from field: repeated kvrwset.KVMetadataWrite metadata_writes = 4; + */ + metadataWrites: KVMetadataWrite[]; +}; + +/** + * Describes the message kvrwset.KVRWSet. + * Use `create(KVRWSetSchema)` to create a new message. + */ +export const KVRWSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 0); + +/** + * HashedRWSet encapsulates hashed representation of a private read-write set for KV or Document data model + * + * @generated from message kvrwset.HashedRWSet + */ +export type HashedRWSet = Message<"kvrwset.HashedRWSet"> & { + /** + * @generated from field: repeated kvrwset.KVReadHash hashed_reads = 1; + */ + hashedReads: KVReadHash[]; + + /** + * @generated from field: repeated kvrwset.KVWriteHash hashed_writes = 2; + */ + hashedWrites: KVWriteHash[]; + + /** + * @generated from field: repeated kvrwset.KVMetadataWriteHash metadata_writes = 3; + */ + metadataWrites: KVMetadataWriteHash[]; +}; + +/** + * Describes the message kvrwset.HashedRWSet. + * Use `create(HashedRWSetSchema)` to create a new message. + */ +export const HashedRWSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 1); + +/** + * KVRead captures a read operation performed during transaction simulation + * A 'nil' version indicates a non-existing key read by the transaction + * + * @generated from message kvrwset.KVRead + */ +export type KVRead = Message<"kvrwset.KVRead"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: kvrwset.Version version = 2; + */ + version?: Version; +}; + +/** + * Describes the message kvrwset.KVRead. + * Use `create(KVReadSchema)` to create a new message. + */ +export const KVReadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 2); + +/** + * KVWrite captures a write (update/delete) operation performed during transaction simulation + * + * @generated from message kvrwset.KVWrite + */ +export type KVWrite = Message<"kvrwset.KVWrite"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: bool is_delete = 2; + */ + isDelete: boolean; + + /** + * @generated from field: bytes value = 3; + */ + value: Uint8Array; +}; + +/** + * Describes the message kvrwset.KVWrite. + * Use `create(KVWriteSchema)` to create a new message. + */ +export const KVWriteSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 3); + +/** + * KVMetadataWrite captures all the entries in the metadata associated with a key + * + * @generated from message kvrwset.KVMetadataWrite + */ +export type KVMetadataWrite = Message<"kvrwset.KVMetadataWrite"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: repeated kvrwset.KVMetadataEntry entries = 2; + */ + entries: KVMetadataEntry[]; +}; + +/** + * Describes the message kvrwset.KVMetadataWrite. + * Use `create(KVMetadataWriteSchema)` to create a new message. + */ +export const KVMetadataWriteSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 4); + +/** + * KVReadHash is similar to the KVRead in spirit. However, it captures the hash of the key instead of the key itself + * version is kept as is for now. However, if the version also needs to be privacy-protected, it would need to be the + * hash of the version and hence of 'bytes' type + * + * @generated from message kvrwset.KVReadHash + */ +export type KVReadHash = Message<"kvrwset.KVReadHash"> & { + /** + * @generated from field: bytes key_hash = 1; + */ + keyHash: Uint8Array; + + /** + * @generated from field: kvrwset.Version version = 2; + */ + version?: Version; +}; + +/** + * Describes the message kvrwset.KVReadHash. + * Use `create(KVReadHashSchema)` to create a new message. + */ +export const KVReadHashSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 5); + +/** + * KVWriteHash is similar to the KVWrite. It captures a write (update/delete) operation performed during transaction simulation + * + * @generated from message kvrwset.KVWriteHash + */ +export type KVWriteHash = Message<"kvrwset.KVWriteHash"> & { + /** + * @generated from field: bytes key_hash = 1; + */ + keyHash: Uint8Array; + + /** + * @generated from field: bool is_delete = 2; + */ + isDelete: boolean; + + /** + * @generated from field: bytes value_hash = 3; + */ + valueHash: Uint8Array; +}; + +/** + * Describes the message kvrwset.KVWriteHash. + * Use `create(KVWriteHashSchema)` to create a new message. + */ +export const KVWriteHashSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 6); + +/** + * KVMetadataWriteHash captures all the upserts to the metadata associated with a key hash + * + * @generated from message kvrwset.KVMetadataWriteHash + */ +export type KVMetadataWriteHash = Message<"kvrwset.KVMetadataWriteHash"> & { + /** + * @generated from field: bytes key_hash = 1; + */ + keyHash: Uint8Array; + + /** + * @generated from field: repeated kvrwset.KVMetadataEntry entries = 2; + */ + entries: KVMetadataEntry[]; +}; + +/** + * Describes the message kvrwset.KVMetadataWriteHash. + * Use `create(KVMetadataWriteHashSchema)` to create a new message. + */ +export const KVMetadataWriteHashSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 7); + +/** + * KVMetadataEntry captures a 'name'ed entry in the metadata of a key/key-hash. + * + * @generated from message kvrwset.KVMetadataEntry + */ +export type KVMetadataEntry = Message<"kvrwset.KVMetadataEntry"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; +}; + +/** + * Describes the message kvrwset.KVMetadataEntry. + * Use `create(KVMetadataEntrySchema)` to create a new message. + */ +export const KVMetadataEntrySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 8); + +/** + * Version encapsulates the version of a Key + * A version of a committed key is maintained as the height of the transaction that committed the key. + * The height is represenetd as a tuple where the txNum is the position of the transaction + * (starting with 0) within block + * + * @generated from message kvrwset.Version + */ +export type Version = Message<"kvrwset.Version"> & { + /** + * @generated from field: uint64 block_num = 1; + */ + blockNum: bigint; + + /** + * @generated from field: uint64 tx_num = 2; + */ + txNum: bigint; +}; + +/** + * Describes the message kvrwset.Version. + * Use `create(VersionSchema)` to create a new message. + */ +export const VersionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 9); + +/** + * RangeQueryInfo encapsulates the details of a range query performed by a transaction during simulation. + * This helps protect transactions from phantom reads by varifying during validation whether any new items + * got committed within the given range between transaction simuation and validation + * (in addition to regular checks for updates/deletes of the existing items). + * readInfo field contains either the KVReads (for the items read by the range query) or a merkle-tree hash + * if the KVReads exceeds a pre-configured numbers + * + * @generated from message kvrwset.RangeQueryInfo + */ +export type RangeQueryInfo = Message<"kvrwset.RangeQueryInfo"> & { + /** + * @generated from field: string start_key = 1; + */ + startKey: string; + + /** + * @generated from field: string end_key = 2; + */ + endKey: string; + + /** + * @generated from field: bool itr_exhausted = 3; + */ + itrExhausted: boolean; + + /** + * @generated from oneof kvrwset.RangeQueryInfo.reads_info + */ + readsInfo: { + /** + * @generated from field: kvrwset.QueryReads raw_reads = 4; + */ + value: QueryReads; + case: "rawReads"; + } | { + /** + * @generated from field: kvrwset.QueryReadsMerkleSummary reads_merkle_hashes = 5; + */ + value: QueryReadsMerkleSummary; + case: "readsMerkleHashes"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message kvrwset.RangeQueryInfo. + * Use `create(RangeQueryInfoSchema)` to create a new message. + */ +export const RangeQueryInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 10); + +/** + * QueryReads encapsulates the KVReads for the items read by a transaction as a result of a query execution + * + * @generated from message kvrwset.QueryReads + */ +export type QueryReads = Message<"kvrwset.QueryReads"> & { + /** + * @generated from field: repeated kvrwset.KVRead kv_reads = 1; + */ + kvReads: KVRead[]; +}; + +/** + * Describes the message kvrwset.QueryReads. + * Use `create(QueryReadsSchema)` to create a new message. + */ +export const QueryReadsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 11); + +/** + * QueryReadsMerkleSummary encapsulates the Merkle-tree hashes for the QueryReads + * This allows to reduce the size of RWSet in the presence of query results + * by storing certain hashes instead of actual results. + * maxDegree field refers to the maximum number of children in the tree at any level + * maxLevel field contains the lowest level which has lesser nodes than maxDegree (starting from leaf level) + * + * @generated from message kvrwset.QueryReadsMerkleSummary + */ +export type QueryReadsMerkleSummary = Message<"kvrwset.QueryReadsMerkleSummary"> & { + /** + * @generated from field: uint32 max_degree = 1; + */ + maxDegree: number; + + /** + * @generated from field: uint32 max_level = 2; + */ + maxLevel: number; + + /** + * @generated from field: repeated bytes max_level_hashes = 3; + */ + maxLevelHashes: Uint8Array[]; +}; + +/** + * Describes the message kvrwset.QueryReadsMerkleSummary. + * Use `create(QueryReadsMerkleSummarySchema)` to create a new message. + */ +export const QueryReadsMerkleSummarySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_kvrwset_kv_rwset, 12); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/rwset_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/rwset_pb.ts new file mode 100644 index 0000000000..b8af587256 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/ledger/rwset/rwset_pb.ts @@ -0,0 +1,198 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file ledger/rwset/rwset.proto (package rwset, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file ledger/rwset/rwset.proto. + */ +export const file_ledger_rwset_rwset: GenFile = /*@__PURE__*/ + fileDesc("ChhsZWRnZXIvcndzZXQvcndzZXQucHJvdG8SBXJ3c2V0IoMBCg5UeFJlYWRXcml0ZVNldBIzCgpkYXRhX21vZGVsGAEgASgOMh8ucndzZXQuVHhSZWFkV3JpdGVTZXQuRGF0YU1vZGVsEicKCG5zX3J3c2V0GAIgAygLMhUucndzZXQuTnNSZWFkV3JpdGVTZXQiEwoJRGF0YU1vZGVsEgYKAktWEAAieAoOTnNSZWFkV3JpdGVTZXQSEQoJbmFtZXNwYWNlGAEgASgJEg0KBXJ3c2V0GAIgASgMEkQKF2NvbGxlY3Rpb25faGFzaGVkX3J3c2V0GAMgAygLMiMucndzZXQuQ29sbGVjdGlvbkhhc2hlZFJlYWRXcml0ZVNldCJlChxDb2xsZWN0aW9uSGFzaGVkUmVhZFdyaXRlU2V0EhcKD2NvbGxlY3Rpb25fbmFtZRgBIAEoCRIUCgxoYXNoZWRfcndzZXQYAiABKAwSFgoOcHZ0X3J3c2V0X2hhc2gYAyABKAwieAoRVHhQdnRSZWFkV3JpdGVTZXQSMwoKZGF0YV9tb2RlbBgBIAEoDjIfLnJ3c2V0LlR4UmVhZFdyaXRlU2V0LkRhdGFNb2RlbBIuCgxuc19wdnRfcndzZXQYAiADKAsyGC5yd3NldC5Oc1B2dFJlYWRXcml0ZVNldCJmChFOc1B2dFJlYWRXcml0ZVNldBIRCgluYW1lc3BhY2UYASABKAkSPgoUY29sbGVjdGlvbl9wdnRfcndzZXQYAiADKAsyIC5yd3NldC5Db2xsZWN0aW9uUHZ0UmVhZFdyaXRlU2V0IkMKGUNvbGxlY3Rpb25QdnRSZWFkV3JpdGVTZXQSFwoPY29sbGVjdGlvbl9uYW1lGAEgASgJEg0KBXJ3c2V0GAIgASgMQmIKKm9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLmxlZGdlci5yd3NldFo0Z2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL2xlZGdlci9yd3NldGIGcHJvdG8z"); + +/** + * TxReadWriteSet encapsulates a read-write set for a transaction + * DataModel specifies the enum value of the data model + * ns_rwset field specifies a list of chaincode specific read-write set (one for each chaincode) + * + * @generated from message rwset.TxReadWriteSet + */ +export type TxReadWriteSet = Message<"rwset.TxReadWriteSet"> & { + /** + * @generated from field: rwset.TxReadWriteSet.DataModel data_model = 1; + */ + dataModel: TxReadWriteSet_DataModel; + + /** + * @generated from field: repeated rwset.NsReadWriteSet ns_rwset = 2; + */ + nsRwset: NsReadWriteSet[]; +}; + +/** + * Describes the message rwset.TxReadWriteSet. + * Use `create(TxReadWriteSetSchema)` to create a new message. + */ +export const TxReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 0); + +/** + * @generated from enum rwset.TxReadWriteSet.DataModel + */ +export enum TxReadWriteSet_DataModel { + /** + * @generated from enum value: KV = 0; + */ + KV = 0, +} + +/** + * Describes the enum rwset.TxReadWriteSet.DataModel. + */ +export const TxReadWriteSet_DataModelSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_ledger_rwset_rwset, 0, 0); + +/** + * NsReadWriteSet encapsulates the read-write set for a chaincode + * + * @generated from message rwset.NsReadWriteSet + */ +export type NsReadWriteSet = Message<"rwset.NsReadWriteSet"> & { + /** + * @generated from field: string namespace = 1; + */ + namespace: string; + + /** + * Data model specific serialized proto message (e.g., kvrwset.KVRWSet for KV and Document data models) + * + * @generated from field: bytes rwset = 2; + */ + rwset: Uint8Array; + + /** + * @generated from field: repeated rwset.CollectionHashedReadWriteSet collection_hashed_rwset = 3; + */ + collectionHashedRwset: CollectionHashedReadWriteSet[]; +}; + +/** + * Describes the message rwset.NsReadWriteSet. + * Use `create(NsReadWriteSetSchema)` to create a new message. + */ +export const NsReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 1); + +/** + * CollectionHashedReadWriteSet encapsulate the hashed representation for the private read-write set for a collection + * + * @generated from message rwset.CollectionHashedReadWriteSet + */ +export type CollectionHashedReadWriteSet = Message<"rwset.CollectionHashedReadWriteSet"> & { + /** + * @generated from field: string collection_name = 1; + */ + collectionName: string; + + /** + * Data model specific serialized proto message (e.g., kvrwset.HashedRWSet for KV and Document data models) + * + * @generated from field: bytes hashed_rwset = 2; + */ + hashedRwset: Uint8Array; + + /** + * Hash of entire private read-write set for a specific collection. This helps in authenticating the private read-write set efficiently + * + * @generated from field: bytes pvt_rwset_hash = 3; + */ + pvtRwsetHash: Uint8Array; +}; + +/** + * Describes the message rwset.CollectionHashedReadWriteSet. + * Use `create(CollectionHashedReadWriteSetSchema)` to create a new message. + */ +export const CollectionHashedReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 2); + +/** + * TxPvtReadWriteSet encapsulate the private read-write set for a transaction + * + * @generated from message rwset.TxPvtReadWriteSet + */ +export type TxPvtReadWriteSet = Message<"rwset.TxPvtReadWriteSet"> & { + /** + * @generated from field: rwset.TxReadWriteSet.DataModel data_model = 1; + */ + dataModel: TxReadWriteSet_DataModel; + + /** + * @generated from field: repeated rwset.NsPvtReadWriteSet ns_pvt_rwset = 2; + */ + nsPvtRwset: NsPvtReadWriteSet[]; +}; + +/** + * Describes the message rwset.TxPvtReadWriteSet. + * Use `create(TxPvtReadWriteSetSchema)` to create a new message. + */ +export const TxPvtReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 3); + +/** + * NsPvtReadWriteSet encapsulates the private read-write set for a chaincode + * + * @generated from message rwset.NsPvtReadWriteSet + */ +export type NsPvtReadWriteSet = Message<"rwset.NsPvtReadWriteSet"> & { + /** + * @generated from field: string namespace = 1; + */ + namespace: string; + + /** + * @generated from field: repeated rwset.CollectionPvtReadWriteSet collection_pvt_rwset = 2; + */ + collectionPvtRwset: CollectionPvtReadWriteSet[]; +}; + +/** + * Describes the message rwset.NsPvtReadWriteSet. + * Use `create(NsPvtReadWriteSetSchema)` to create a new message. + */ +export const NsPvtReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 4); + +/** + * CollectionPvtReadWriteSet encapsulates the private read-write set for a collection + * + * @generated from message rwset.CollectionPvtReadWriteSet + */ +export type CollectionPvtReadWriteSet = Message<"rwset.CollectionPvtReadWriteSet"> & { + /** + * @generated from field: string collection_name = 1; + */ + collectionName: string; + + /** + * Data model specific serialized proto message (e.g., kvrwset.KVRWSet for KV and Document data models) + * + * @generated from field: bytes rwset = 2; + */ + rwset: Uint8Array; +}; + +/** + * Describes the message rwset.CollectionPvtReadWriteSet. + * Use `create(CollectionPvtReadWriteSetSchema)` to create a new message. + */ +export const CollectionPvtReadWriteSetSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_ledger_rwset_rwset, 5); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/identities_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/identities_pb.ts new file mode 100644 index 0000000000..ca04457833 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/identities_pb.ts @@ -0,0 +1,104 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file msp/identities.proto (package msp, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file msp/identities.proto. + */ +export const file_msp_identities: GenFile = /*@__PURE__*/ + fileDesc("ChRtc3AvaWRlbnRpdGllcy5wcm90bxIDbXNwIjUKElNlcmlhbGl6ZWRJZGVudGl0eRINCgVtc3BpZBgBIAEoCRIQCghpZF9ieXRlcxgCIAEoDCJhChhTZXJpYWxpemVkSWRlbWl4SWRlbnRpdHkSDQoFbnltX3gYASABKAwSDQoFbnltX3kYAiABKAwSCgoCb3UYAyABKAwSDAoEcm9sZRgEIAEoDBINCgVwcm9vZhgFIAEoDEJQCiFvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5tc3BaK2dpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9tc3BiBnByb3RvMw"); + +/** + * This struct represents an Identity + * (with its MSP identifier) to be used + * to serialize it and deserialize it + * + * @generated from message msp.SerializedIdentity + */ +export type SerializedIdentity = Message<"msp.SerializedIdentity"> & { + /** + * The identifier of the associated membership service provider + * + * @generated from field: string mspid = 1; + */ + mspid: string; + + /** + * the Identity, serialized according to the rules of its MPS + * + * @generated from field: bytes id_bytes = 2; + */ + idBytes: Uint8Array; +}; + +/** + * Describes the message msp.SerializedIdentity. + * Use `create(SerializedIdentitySchema)` to create a new message. + */ +export const SerializedIdentitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_identities, 0); + +/** + * This struct represents an Idemix Identity + * to be used to serialize it and deserialize it. + * The IdemixMSP will first serialize an idemix identity to bytes using + * this proto, and then uses these bytes as id_bytes in SerializedIdentity + * + * @generated from message msp.SerializedIdemixIdentity + */ +export type SerializedIdemixIdentity = Message<"msp.SerializedIdemixIdentity"> & { + /** + * nym_x is the X-component of the pseudonym elliptic curve point. + * It is a []byte representation of an amcl.BIG + * The pseudonym can be seen as a public key of the identity, it is used to verify signatures. + * + * @generated from field: bytes nym_x = 1; + */ + nymX: Uint8Array; + + /** + * nym_y is the Y-component of the pseudonym elliptic curve point. + * It is a []byte representation of an amcl.BIG + * The pseudonym can be seen as a public key of the identity, it is used to verify signatures. + * + * @generated from field: bytes nym_y = 2; + */ + nymY: Uint8Array; + + /** + * ou contains the organizational unit of the idemix identity + * + * @generated from field: bytes ou = 3; + */ + ou: Uint8Array; + + /** + * role contains the role of this identity (e.g., ADMIN or MEMBER) + * + * @generated from field: bytes role = 4; + */ + role: Uint8Array; + + /** + * proof contains the cryptographic evidence that this identity is valid + * + * @generated from field: bytes proof = 5; + */ + proof: Uint8Array; +}; + +/** + * Describes the message msp.SerializedIdemixIdentity. + * Use `create(SerializedIdemixIdentitySchema)` to create a new message. + */ +export const SerializedIdemixIdentitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_identities, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_config_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_config_pb.ts new file mode 100644 index 0000000000..9a77c1252e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_config_pb.ts @@ -0,0 +1,462 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file msp/msp_config.proto (package msp, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file msp/msp_config.proto. + */ +export const file_msp_msp_config: GenFile = /*@__PURE__*/ + fileDesc("ChRtc3AvbXNwX2NvbmZpZy5wcm90bxIDbXNwIikKCU1TUENvbmZpZxIMCgR0eXBlGAEgASgFEg4KBmNvbmZpZxgCIAEoDCKDAwoPRmFicmljTVNQQ29uZmlnEgwKBG5hbWUYASABKAkSEgoKcm9vdF9jZXJ0cxgCIAMoDBIaChJpbnRlcm1lZGlhdGVfY2VydHMYAyADKAwSDgoGYWRtaW5zGAQgAygMEhcKD3Jldm9jYXRpb25fbGlzdBgFIAMoDBIyChBzaWduaW5nX2lkZW50aXR5GAYgASgLMhgubXNwLlNpZ25pbmdJZGVudGl0eUluZm8SQAofb3JnYW5pemF0aW9uYWxfdW5pdF9pZGVudGlmaWVycxgHIAMoCzIXLm1zcC5GYWJyaWNPVUlkZW50aWZpZXISLgoNY3J5cHRvX2NvbmZpZxgIIAEoCzIXLm1zcC5GYWJyaWNDcnlwdG9Db25maWcSFgoOdGxzX3Jvb3RfY2VydHMYCSADKAwSHgoWdGxzX2ludGVybWVkaWF0ZV9jZXJ0cxgKIAMoDBIrCg9mYWJyaWNfbm9kZV9vdXMYCyABKAsyEi5tc3AuRmFicmljTm9kZU9VcyJeChJGYWJyaWNDcnlwdG9Db25maWcSHQoVc2lnbmF0dXJlX2hhc2hfZmFtaWx5GAEgASgJEikKIWlkZW50aXR5X2lkZW50aWZpZXJfaGFzaF9mdW5jdGlvbhgCIAEoCSJ+Cg9JZGVtaXhNU1BDb25maWcSDAoEbmFtZRgBIAEoCRILCgNpcGsYAiABKAwSKgoGc2lnbmVyGAMgASgLMhoubXNwLklkZW1peE1TUFNpZ25lckNvbmZpZxIVCg1yZXZvY2F0aW9uX3BrGAQgASgMEg0KBWVwb2NoGAUgASgDIqkBChVJZGVtaXhNU1BTaWduZXJDb25maWcSDAoEY3JlZBgBIAEoDBIKCgJzaxgCIAEoDBImCh5vcmdhbml6YXRpb25hbF91bml0X2lkZW50aWZpZXIYAyABKAkSDAoEcm9sZRgEIAEoBRIVCg1lbnJvbGxtZW50X2lkGAUgASgJEikKIWNyZWRlbnRpYWxfcmV2b2NhdGlvbl9pbmZvcm1hdGlvbhgGIAEoDCJSChNTaWduaW5nSWRlbnRpdHlJbmZvEhUKDXB1YmxpY19zaWduZXIYASABKAwSJAoOcHJpdmF0ZV9zaWduZXIYAiABKAsyDC5tc3AuS2V5SW5mbyI3CgdLZXlJbmZvEhYKDmtleV9pZGVudGlmaWVyGAEgASgJEhQKDGtleV9tYXRlcmlhbBgCIAEoDCJRChJGYWJyaWNPVUlkZW50aWZpZXISEwoLY2VydGlmaWNhdGUYASABKAwSJgoeb3JnYW5pemF0aW9uYWxfdW5pdF9pZGVudGlmaWVyGAIgASgJIvkBCg1GYWJyaWNOb2RlT1VzEg4KBmVuYWJsZRgBIAEoCBI1ChRjbGllbnRfb3VfaWRlbnRpZmllchgCIAEoCzIXLm1zcC5GYWJyaWNPVUlkZW50aWZpZXISMwoScGVlcl9vdV9pZGVudGlmaWVyGAMgASgLMhcubXNwLkZhYnJpY09VSWRlbnRpZmllchI0ChNhZG1pbl9vdV9pZGVudGlmaWVyGAQgASgLMhcubXNwLkZhYnJpY09VSWRlbnRpZmllchI2ChVvcmRlcmVyX291X2lkZW50aWZpZXIYBSABKAsyFy5tc3AuRmFicmljT1VJZGVudGlmaWVyQmIKIW9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLm1zcEIQTXNwQ29uZmlnUGFja2FnZVorZ2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL21zcGIGcHJvdG8z"); + +/** + * MSPConfig collects all the configuration information for + * an MSP. The Config field should be unmarshalled in a way + * that depends on the Type + * + * @generated from message msp.MSPConfig + */ +export type MSPConfig = Message<"msp.MSPConfig"> & { + /** + * Type holds the type of the MSP; the default one would + * be of type FABRIC implementing an X.509 based provider + * + * @generated from field: int32 type = 1; + */ + type: number; + + /** + * Config is MSP dependent configuration info + * + * @generated from field: bytes config = 2; + */ + config: Uint8Array; +}; + +/** + * Describes the message msp.MSPConfig. + * Use `create(MSPConfigSchema)` to create a new message. + */ +export const MSPConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 0); + +/** + * FabricMSPConfig collects all the configuration information for + * a Fabric MSP. + * Here we assume a default certificate validation policy, where + * any certificate signed by any of the listed rootCA certs would + * be considered as valid under this MSP. + * This MSP may or may not come with a signing identity. If it does, + * it can also issue signing identities. If it does not, it can only + * be used to validate and verify certificates. + * + * @generated from message msp.FabricMSPConfig + */ +export type FabricMSPConfig = Message<"msp.FabricMSPConfig"> & { + /** + * Name holds the identifier of the MSP; MSP identifier + * is chosen by the application that governs this MSP. + * For example, and assuming the default implementation of MSP, + * that is X.509-based and considers a single Issuer, + * this can refer to the Subject OU field or the Issuer OU field. + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * List of root certificates trusted by this MSP + * they are used upon certificate validation (see + * comment for IntermediateCerts below) + * + * @generated from field: repeated bytes root_certs = 2; + */ + rootCerts: Uint8Array[]; + + /** + * List of intermediate certificates trusted by this MSP; + * they are used upon certificate validation as follows: + * validation attempts to build a path from the certificate + * to be validated (which is at one end of the path) and + * one of the certs in the RootCerts field (which is at + * the other end of the path). If the path is longer than + * 2, certificates in the middle are searched within the + * IntermediateCerts pool + * + * @generated from field: repeated bytes intermediate_certs = 3; + */ + intermediateCerts: Uint8Array[]; + + /** + * Identity denoting the administrator of this MSP + * + * @generated from field: repeated bytes admins = 4; + */ + admins: Uint8Array[]; + + /** + * Identity revocation list + * + * @generated from field: repeated bytes revocation_list = 5; + */ + revocationList: Uint8Array[]; + + /** + * SigningIdentity holds information on the signing identity + * this peer is to use, and which is to be imported by the + * MSP defined before + * + * @generated from field: msp.SigningIdentityInfo signing_identity = 6; + */ + signingIdentity?: SigningIdentityInfo; + + /** + * OrganizationalUnitIdentifiers holds one or more + * fabric organizational unit identifiers that belong to + * this MSP configuration + * + * @generated from field: repeated msp.FabricOUIdentifier organizational_unit_identifiers = 7; + */ + organizationalUnitIdentifiers: FabricOUIdentifier[]; + + /** + * FabricCryptoConfig contains the configuration parameters + * for the cryptographic algorithms used by this MSP + * + * @generated from field: msp.FabricCryptoConfig crypto_config = 8; + */ + cryptoConfig?: FabricCryptoConfig; + + /** + * List of TLS root certificates trusted by this MSP. + * They are returned by GetTLSRootCerts. + * + * @generated from field: repeated bytes tls_root_certs = 9; + */ + tlsRootCerts: Uint8Array[]; + + /** + * List of TLS intermediate certificates trusted by this MSP; + * They are returned by GetTLSIntermediateCerts. + * + * @generated from field: repeated bytes tls_intermediate_certs = 10; + */ + tlsIntermediateCerts: Uint8Array[]; + + /** + * fabric_node_ous contains the configuration to distinguish clients from peers from orderers + * based on the OUs. + * + * @generated from field: msp.FabricNodeOUs fabric_node_ous = 11; + */ + fabricNodeOus?: FabricNodeOUs; +}; + +/** + * Describes the message msp.FabricMSPConfig. + * Use `create(FabricMSPConfigSchema)` to create a new message. + */ +export const FabricMSPConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 1); + +/** + * FabricCryptoConfig contains configuration parameters + * for the cryptographic algorithms used by the MSP + * this configuration refers to + * + * @generated from message msp.FabricCryptoConfig + */ +export type FabricCryptoConfig = Message<"msp.FabricCryptoConfig"> & { + /** + * SignatureHashFamily is a string representing the hash family to be used + * during sign and verify operations. + * Allowed values are "SHA2" and "SHA3". + * + * @generated from field: string signature_hash_family = 1; + */ + signatureHashFamily: string; + + /** + * IdentityIdentifierHashFunction is a string representing the hash function + * to be used during the computation of the identity identifier of an MSP identity. + * Allowed values are "SHA256", "SHA384" and "SHA3_256", "SHA3_384". + * + * @generated from field: string identity_identifier_hash_function = 2; + */ + identityIdentifierHashFunction: string; +}; + +/** + * Describes the message msp.FabricCryptoConfig. + * Use `create(FabricCryptoConfigSchema)` to create a new message. + */ +export const FabricCryptoConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 2); + +/** + * IdemixMSPConfig collects all the configuration information for + * an Idemix MSP. + * + * @generated from message msp.IdemixMSPConfig + */ +export type IdemixMSPConfig = Message<"msp.IdemixMSPConfig"> & { + /** + * Name holds the identifier of the MSP + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * ipk represents the (serialized) issuer public key + * + * @generated from field: bytes ipk = 2; + */ + ipk: Uint8Array; + + /** + * signer may contain crypto material to configure a default signer + * + * @generated from field: msp.IdemixMSPSignerConfig signer = 3; + */ + signer?: IdemixMSPSignerConfig; + + /** + * revocation_pk is the public key used for revocation of credentials + * + * @generated from field: bytes revocation_pk = 4; + */ + revocationPk: Uint8Array; + + /** + * epoch represents the current epoch (time interval) used for revocation + * + * @generated from field: int64 epoch = 5; + */ + epoch: bigint; +}; + +/** + * Describes the message msp.IdemixMSPConfig. + * Use `create(IdemixMSPConfigSchema)` to create a new message. + */ +export const IdemixMSPConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 3); + +/** + * IdemixMSPSIgnerConfig contains the crypto material to set up an idemix signing identity + * + * @generated from message msp.IdemixMSPSignerConfig + */ +export type IdemixMSPSignerConfig = Message<"msp.IdemixMSPSignerConfig"> & { + /** + * cred represents the serialized idemix credential of the default signer + * + * @generated from field: bytes cred = 1; + */ + cred: Uint8Array; + + /** + * sk is the secret key of the default signer, corresponding to credential Cred + * + * @generated from field: bytes sk = 2; + */ + sk: Uint8Array; + + /** + * organizational_unit_identifier defines the organizational unit the default signer is in + * + * @generated from field: string organizational_unit_identifier = 3; + */ + organizationalUnitIdentifier: string; + + /** + * role defines whether the default signer is admin, peer, member or client + * + * @generated from field: int32 role = 4; + */ + role: number; + + /** + * enrollment_id contains the enrollment id of this signer + * + * @generated from field: string enrollment_id = 5; + */ + enrollmentId: string; + + /** + * credential_revocation_information contains a serialized CredentialRevocationInformation + * + * @generated from field: bytes credential_revocation_information = 6; + */ + credentialRevocationInformation: Uint8Array; +}; + +/** + * Describes the message msp.IdemixMSPSignerConfig. + * Use `create(IdemixMSPSignerConfigSchema)` to create a new message. + */ +export const IdemixMSPSignerConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 4); + +/** + * SigningIdentityInfo represents the configuration information + * related to the signing identity the peer is to use for generating + * endorsements + * + * @generated from message msp.SigningIdentityInfo + */ +export type SigningIdentityInfo = Message<"msp.SigningIdentityInfo"> & { + /** + * PublicSigner carries the public information of the signing + * identity. For an X.509 provider this would be represented by + * an X.509 certificate + * + * @generated from field: bytes public_signer = 1; + */ + publicSigner: Uint8Array; + + /** + * PrivateSigner denotes a reference to the private key of the + * peer's signing identity + * + * @generated from field: msp.KeyInfo private_signer = 2; + */ + privateSigner?: KeyInfo; +}; + +/** + * Describes the message msp.SigningIdentityInfo. + * Use `create(SigningIdentityInfoSchema)` to create a new message. + */ +export const SigningIdentityInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 5); + +/** + * KeyInfo represents a (secret) key that is either already stored + * in the bccsp/keystore or key material to be imported to the + * bccsp key-store. In later versions it may contain also a + * keystore identifier + * + * @generated from message msp.KeyInfo + */ +export type KeyInfo = Message<"msp.KeyInfo"> & { + /** + * Identifier of the key inside the default keystore; this for + * the case of Software BCCSP as well as the HSM BCCSP would be + * the SKI of the key + * + * @generated from field: string key_identifier = 1; + */ + keyIdentifier: string; + + /** + * KeyMaterial (optional) for the key to be imported; this is + * properly encoded key bytes, prefixed by the type of the key + * + * @generated from field: bytes key_material = 2; + */ + keyMaterial: Uint8Array; +}; + +/** + * Describes the message msp.KeyInfo. + * Use `create(KeyInfoSchema)` to create a new message. + */ +export const KeyInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 6); + +/** + * FabricOUIdentifier represents an organizational unit and + * its related chain of trust identifier. + * + * @generated from message msp.FabricOUIdentifier + */ +export type FabricOUIdentifier = Message<"msp.FabricOUIdentifier"> & { + /** + * Certificate represents the second certificate in a certification chain. + * (Notice that the first certificate in a certification chain is supposed + * to be the certificate of an identity). + * It must correspond to the certificate of root or intermediate CA + * recognized by the MSP this message belongs to. + * Starting from this certificate, a certification chain is computed + * and bound to the OrganizationUnitIdentifier specified + * + * @generated from field: bytes certificate = 1; + */ + certificate: Uint8Array; + + /** + * OrganizationUnitIdentifier defines the organizational unit under the + * MSP identified with MSPIdentifier + * + * @generated from field: string organizational_unit_identifier = 2; + */ + organizationalUnitIdentifier: string; +}; + +/** + * Describes the message msp.FabricOUIdentifier. + * Use `create(FabricOUIdentifierSchema)` to create a new message. + */ +export const FabricOUIdentifierSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 7); + +/** + * FabricNodeOUs contains configuration to tell apart clients from peers from orderers + * based on OUs. If NodeOUs recognition is enabled then an msp identity + * that does not contain any of the specified OU will be considered invalid. + * + * @generated from message msp.FabricNodeOUs + */ +export type FabricNodeOUs = Message<"msp.FabricNodeOUs"> & { + /** + * If true then an msp identity that does not contain any of the specified OU will be considered invalid. + * + * @generated from field: bool enable = 1; + */ + enable: boolean; + + /** + * OU Identifier of the clients + * + * @generated from field: msp.FabricOUIdentifier client_ou_identifier = 2; + */ + clientOuIdentifier?: FabricOUIdentifier; + + /** + * OU Identifier of the peers + * + * @generated from field: msp.FabricOUIdentifier peer_ou_identifier = 3; + */ + peerOuIdentifier?: FabricOUIdentifier; + + /** + * OU Identifier of the admins + * + * @generated from field: msp.FabricOUIdentifier admin_ou_identifier = 4; + */ + adminOuIdentifier?: FabricOUIdentifier; + + /** + * OU Identifier of the orderers + * + * @generated from field: msp.FabricOUIdentifier orderer_ou_identifier = 5; + */ + ordererOuIdentifier?: FabricOUIdentifier; +}; + +/** + * Describes the message msp.FabricNodeOUs. + * Use `create(FabricNodeOUsSchema)` to create a new message. + */ +export const FabricNodeOUsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_config, 8); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_principal_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_principal_pb.ts new file mode 100644 index 0000000000..b1d876f87a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/msp/msp_principal_pb.ts @@ -0,0 +1,317 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file msp/msp_principal.proto (package common, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file msp/msp_principal.proto. + */ +export const file_msp_msp_principal: GenFile = /*@__PURE__*/ + fileDesc("Chdtc3AvbXNwX3ByaW5jaXBhbC5wcm90bxIGY29tbW9uIsYBCgxNU1BQcmluY2lwYWwSRQoYcHJpbmNpcGFsX2NsYXNzaWZpY2F0aW9uGAEgASgOMiMuY29tbW9uLk1TUFByaW5jaXBhbC5DbGFzc2lmaWNhdGlvbhIRCglwcmluY2lwYWwYAiABKAwiXAoOQ2xhc3NpZmljYXRpb24SCAoEUk9MRRAAEhUKEU9SR0FOSVpBVElPTl9VTklUEAESDAoISURFTlRJVFkQAhINCglBTk9OWU1JVFkQAxIMCghDT01CSU5FRBAEInEKEE9yZ2FuaXphdGlvblVuaXQSFgoObXNwX2lkZW50aWZpZXIYASABKAkSJgoeb3JnYW5pemF0aW9uYWxfdW5pdF9pZGVudGlmaWVyGAIgASgJEh0KFWNlcnRpZmllcnNfaWRlbnRpZmllchgDIAEoDCKVAQoHTVNQUm9sZRIWCg5tc3BfaWRlbnRpZmllchgBIAEoCRIpCgRyb2xlGAIgASgOMhsuY29tbW9uLk1TUFJvbGUuTVNQUm9sZVR5cGUiRwoLTVNQUm9sZVR5cGUSCgoGTUVNQkVSEAASCQoFQURNSU4QARIKCgZDTElFTlQQAhIICgRQRUVSEAMSCwoHT1JERVJFUhAEIp0BChRNU1BJZGVudGl0eUFub255bWl0eRJNCg5hbm9ueW1pdHlfdHlwZRgBIAEoDjI1LmNvbW1vbi5NU1BJZGVudGl0eUFub255bWl0eS5NU1BJZGVudGl0eUFub255bWl0eVR5cGUiNgoYTVNQSWRlbnRpdHlBbm9ueW1pdHlUeXBlEgsKB05PTUlOQUwQABINCglBTk9OWU1PVVMQASI9ChFDb21iaW5lZFByaW5jaXBhbBIoCgpwcmluY2lwYWxzGAEgAygLMhQuY29tbW9uLk1TUFByaW5jaXBhbEJTCiRvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5jb21tb25aK2dpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9tc3BiBnByb3RvMw"); + +/** + * MSPPrincipal aims to represent an MSP-centric set of identities. + * In particular, this structure allows for definition of + * - a group of identities that are member of the same MSP + * - a group of identities that are member of the same organization unit + * in the same MSP + * - a group of identities that are administering a specific MSP + * - a specific identity + * Expressing these groups is done given two fields of the fields below + * - Classification, that defines the type of classification of identities + * in an MSP this principal would be defined on; Classification can take + * three values: + * (i) ByMSPRole: that represents a classification of identities within + * MSP based on one of the two pre-defined MSP rules, "member" and "admin" + * (ii) ByOrganizationUnit: that represents a classification of identities + * within MSP based on the organization unit an identity belongs to + * (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single + * identity/certificate; this would mean that the Principal bytes + * message + * + * @generated from message common.MSPPrincipal + */ +export type MSPPrincipal = Message<"common.MSPPrincipal"> & { + /** + * Classification describes the way that one should process + * Principal. An Classification value of "ByOrganizationUnit" reflects + * that "Principal" contains the name of an organization this MSP + * handles. A Classification value "ByIdentity" means that + * "Principal" contains a specific identity. Default value + * denotes that Principal contains one of the groups by + * default supported by all MSPs ("admin" or "member"). + * + * @generated from field: common.MSPPrincipal.Classification principal_classification = 1; + */ + principalClassification: MSPPrincipal_Classification; + + /** + * Principal completes the policy principal definition. For the default + * principal types, Principal can be either "Admin" or "Member". + * For the ByOrganizationUnit/ByIdentity values of Classification, + * PolicyPrincipal acquires its value from an organization unit or + * identity, respectively. + * For the Combined Classification type, the Principal is a marshalled + * CombinedPrincipal. + * + * @generated from field: bytes principal = 2; + */ + principal: Uint8Array; +}; + +/** + * Describes the message common.MSPPrincipal. + * Use `create(MSPPrincipalSchema)` to create a new message. + */ +export const MSPPrincipalSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_principal, 0); + +/** + * @generated from enum common.MSPPrincipal.Classification + */ +export enum MSPPrincipal_Classification { + /** + * Represents the one of the dedicated MSP roles, the + * + * @generated from enum value: ROLE = 0; + */ + ROLE = 0, + + /** + * one of a member of MSP network, and the one of an + * administrator of an MSP network + * + * Denotes a finer grained (affiliation-based) + * + * @generated from enum value: ORGANIZATION_UNIT = 1; + */ + ORGANIZATION_UNIT = 1, + + /** + * groupping of entities, per MSP affiliation + * E.g., this can well be represented by an MSP's + * Organization unit + * + * Denotes a principal that consists of a single + * + * @generated from enum value: IDENTITY = 2; + */ + IDENTITY = 2, + + /** + * identity + * + * Denotes a principal that can be used to enforce + * + * @generated from enum value: ANONYMITY = 3; + */ + ANONYMITY = 3, + + /** + * an identity to be anonymous or nominal. + * + * Denotes a combined principal + * + * @generated from enum value: COMBINED = 4; + */ + COMBINED = 4, +} + +/** + * Describes the enum common.MSPPrincipal.Classification. + */ +export const MSPPrincipal_ClassificationSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_msp_msp_principal, 0, 0); + +/** + * OrganizationUnit governs the organization of the Principal + * field of a policy principal when a specific organization unity members + * are to be defined within a policy principal. + * + * @generated from message common.OrganizationUnit + */ +export type OrganizationUnit = Message<"common.OrganizationUnit"> & { + /** + * MSPIdentifier represents the identifier of the MSP this organization unit + * refers to + * + * @generated from field: string msp_identifier = 1; + */ + mspIdentifier: string; + + /** + * OrganizationUnitIdentifier defines the organizational unit under the + * MSP identified with MSPIdentifier + * + * @generated from field: string organizational_unit_identifier = 2; + */ + organizationalUnitIdentifier: string; + + /** + * CertifiersIdentifier is the hash of certificates chain of trust + * related to this organizational unit + * + * @generated from field: bytes certifiers_identifier = 3; + */ + certifiersIdentifier: Uint8Array; +}; + +/** + * Describes the message common.OrganizationUnit. + * Use `create(OrganizationUnitSchema)` to create a new message. + */ +export const OrganizationUnitSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_principal, 1); + +/** + * MSPRole governs the organization of the Principal + * field of an MSPPrincipal when it aims to define one of the + * two dedicated roles within an MSP: Admin and Members. + * + * @generated from message common.MSPRole + */ +export type MSPRole = Message<"common.MSPRole"> & { + /** + * MSPIdentifier represents the identifier of the MSP this principal + * refers to + * + * @generated from field: string msp_identifier = 1; + */ + mspIdentifier: string; + + /** + * MSPRoleType defines which of the available, pre-defined MSP-roles + * an identiy should posess inside the MSP with identifier MSPidentifier + * + * @generated from field: common.MSPRole.MSPRoleType role = 2; + */ + role: MSPRole_MSPRoleType; +}; + +/** + * Describes the message common.MSPRole. + * Use `create(MSPRoleSchema)` to create a new message. + */ +export const MSPRoleSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_principal, 2); + +/** + * @generated from enum common.MSPRole.MSPRoleType + */ +export enum MSPRole_MSPRoleType { + /** + * Represents an MSP Member + * + * @generated from enum value: MEMBER = 0; + */ + MEMBER = 0, + + /** + * Represents an MSP Admin + * + * @generated from enum value: ADMIN = 1; + */ + ADMIN = 1, + + /** + * Represents an MSP Client + * + * @generated from enum value: CLIENT = 2; + */ + CLIENT = 2, + + /** + * Represents an MSP Peer + * + * @generated from enum value: PEER = 3; + */ + PEER = 3, + + /** + * Represents an MSP Orderer + * + * @generated from enum value: ORDERER = 4; + */ + ORDERER = 4, +} + +/** + * Describes the enum common.MSPRole.MSPRoleType. + */ +export const MSPRole_MSPRoleTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_msp_msp_principal, 2, 0); + +/** + * MSPIdentityAnonymity can be used to enforce an identity to be anonymous or nominal. + * + * @generated from message common.MSPIdentityAnonymity + */ +export type MSPIdentityAnonymity = Message<"common.MSPIdentityAnonymity"> & { + /** + * @generated from field: common.MSPIdentityAnonymity.MSPIdentityAnonymityType anonymity_type = 1; + */ + anonymityType: MSPIdentityAnonymity_MSPIdentityAnonymityType; +}; + +/** + * Describes the message common.MSPIdentityAnonymity. + * Use `create(MSPIdentityAnonymitySchema)` to create a new message. + */ +export const MSPIdentityAnonymitySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_principal, 3); + +/** + * @generated from enum common.MSPIdentityAnonymity.MSPIdentityAnonymityType + */ +export enum MSPIdentityAnonymity_MSPIdentityAnonymityType { + /** + * Represents a nominal MSP Identity + * + * @generated from enum value: NOMINAL = 0; + */ + NOMINAL = 0, + + /** + * Represents an anonymous MSP Identity + * + * @generated from enum value: ANONYMOUS = 1; + */ + ANONYMOUS = 1, +} + +/** + * Describes the enum common.MSPIdentityAnonymity.MSPIdentityAnonymityType. + */ +export const MSPIdentityAnonymity_MSPIdentityAnonymityTypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_msp_msp_principal, 3, 0); + +/** + * CombinedPrincipal governs the organization of the Principal + * field of a policy principal when principal_classification has + * indicated that a combined form of principals is required + * + * @generated from message common.CombinedPrincipal + */ +export type CombinedPrincipal = Message<"common.CombinedPrincipal"> & { + /** + * Principals refer to combined principals + * + * @generated from field: repeated common.MSPPrincipal principals = 1; + */ + principals: MSPPrincipal[]; +}; + +/** + * Describes the message common.CombinedPrincipal. + * Use `create(CombinedPrincipalSchema)` to create a new message. + */ +export const CombinedPrincipalSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_msp_msp_principal, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_connect.ts new file mode 100644 index 0000000000..da48b01c80 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_connect.ts @@ -0,0 +1,44 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file orderer/ab.proto (package orderer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Envelope } from "../common/common_pb.js"; +import { BroadcastResponse, DeliverResponse } from "./ab_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service orderer.AtomicBroadcast + */ +export const AtomicBroadcast = { + typeName: "orderer.AtomicBroadcast", + methods: { + /** + * broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure + * + * @generated from rpc orderer.AtomicBroadcast.Broadcast + */ + broadcast: { + name: "Broadcast", + I: Envelope, + O: BroadcastResponse, + kind: MethodKind.BiDiStreaming, + }, + /** + * deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received. + * + * @generated from rpc orderer.AtomicBroadcast.Deliver + */ + deliver: { + name: "Deliver", + I: Envelope, + O: DeliverResponse, + kind: MethodKind.BiDiStreaming, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_pb.ts new file mode 100644 index 0000000000..2f3b074833 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/ab_pb.ts @@ -0,0 +1,281 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/ab.proto (package orderer, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Block, EnvelopeSchema, Status } from "../common/common_pb"; +import { file_common_common } from "../common/common_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/ab.proto. + */ +export const file_orderer_ab: GenFile = /*@__PURE__*/ + fileDesc("ChBvcmRlcmVyL2FiLnByb3RvEgdvcmRlcmVyIkEKEUJyb2FkY2FzdFJlc3BvbnNlEh4KBnN0YXR1cxgBIAEoDjIOLmNvbW1vbi5TdGF0dXMSDAoEaW5mbxgCIAEoCSIMCgpTZWVrTmV3ZXN0IgwKClNlZWtPbGRlc3QiHwoNU2Vla1NwZWNpZmllZBIOCgZudW1iZXIYASABKAQikQEKDFNlZWtQb3NpdGlvbhIlCgZuZXdlc3QYASABKAsyEy5vcmRlcmVyLlNlZWtOZXdlc3RIABIlCgZvbGRlc3QYAiABKAsyEy5vcmRlcmVyLlNlZWtPbGRlc3RIABIrCglzcGVjaWZpZWQYAyABKAsyFi5vcmRlcmVyLlNlZWtTcGVjaWZpZWRIAEIGCgRUeXBlIrQCCghTZWVrSW5mbxIkCgVzdGFydBgBIAEoCzIVLm9yZGVyZXIuU2Vla1Bvc2l0aW9uEiMKBHN0b3AYAiABKAsyFS5vcmRlcmVyLlNlZWtQb3NpdGlvbhIwCghiZWhhdmlvchgDIAEoDjIeLm9yZGVyZXIuU2Vla0luZm8uU2Vla0JlaGF2aW9yEjsKDmVycm9yX3Jlc3BvbnNlGAQgASgOMiMub3JkZXJlci5TZWVrSW5mby5TZWVrRXJyb3JSZXNwb25zZSI8CgxTZWVrQmVoYXZpb3ISFQoRQkxPQ0tfVU5USUxfUkVBRFkQABIVChFGQUlMX0lGX05PVF9SRUFEWRABIjAKEVNlZWtFcnJvclJlc3BvbnNlEgoKBlNUUklDVBAAEg8KC0JFU1RfRUZGT1JUEAEiWwoPRGVsaXZlclJlc3BvbnNlEiAKBnN0YXR1cxgBIAEoDjIOLmNvbW1vbi5TdGF0dXNIABIeCgVibG9jaxgCIAEoCzINLmNvbW1vbi5CbG9ja0gAQgYKBFR5cGUyiwEKD0F0b21pY0Jyb2FkY2FzdBI9CglCcm9hZGNhc3QSEC5jb21tb24uRW52ZWxvcGUaGi5vcmRlcmVyLkJyb2FkY2FzdFJlc3BvbnNlKAEwARI5CgdEZWxpdmVyEhAuY29tbW9uLkVudmVsb3BlGhgub3JkZXJlci5EZWxpdmVyUmVzcG9uc2UoATABQlgKJW9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLm9yZGVyZXJaL2dpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9vcmRlcmVyYgZwcm90bzM", [file_common_common]); + +/** + * @generated from message orderer.BroadcastResponse + */ +export type BroadcastResponse = Message<"orderer.BroadcastResponse"> & { + /** + * Status code, which may be used to programatically respond to success/failure + * + * @generated from field: common.Status status = 1; + */ + status: Status; + + /** + * Info string which may contain additional information about the status returned + * + * @generated from field: string info = 2; + */ + info: string; +}; + +/** + * Describes the message orderer.BroadcastResponse. + * Use `create(BroadcastResponseSchema)` to create a new message. + */ +export const BroadcastResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 0); + +/** + * @generated from message orderer.SeekNewest + */ +export type SeekNewest = Message<"orderer.SeekNewest"> & { +}; + +/** + * Describes the message orderer.SeekNewest. + * Use `create(SeekNewestSchema)` to create a new message. + */ +export const SeekNewestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 1); + +/** + * @generated from message orderer.SeekOldest + */ +export type SeekOldest = Message<"orderer.SeekOldest"> & { +}; + +/** + * Describes the message orderer.SeekOldest. + * Use `create(SeekOldestSchema)` to create a new message. + */ +export const SeekOldestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 2); + +/** + * @generated from message orderer.SeekSpecified + */ +export type SeekSpecified = Message<"orderer.SeekSpecified"> & { + /** + * @generated from field: uint64 number = 1; + */ + number: bigint; +}; + +/** + * Describes the message orderer.SeekSpecified. + * Use `create(SeekSpecifiedSchema)` to create a new message. + */ +export const SeekSpecifiedSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 3); + +/** + * @generated from message orderer.SeekPosition + */ +export type SeekPosition = Message<"orderer.SeekPosition"> & { + /** + * @generated from oneof orderer.SeekPosition.Type + */ + Type: { + /** + * @generated from field: orderer.SeekNewest newest = 1; + */ + value: SeekNewest; + case: "newest"; + } | { + /** + * @generated from field: orderer.SeekOldest oldest = 2; + */ + value: SeekOldest; + case: "oldest"; + } | { + /** + * @generated from field: orderer.SeekSpecified specified = 3; + */ + value: SeekSpecified; + case: "specified"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message orderer.SeekPosition. + * Use `create(SeekPositionSchema)` to create a new message. + */ +export const SeekPositionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 4); + +/** + * SeekInfo specifies the range of requested blocks to return + * If the start position is not found, an error is immediately returned + * Otherwise, blocks are returned until a missing block is encountered, then behavior is dictated + * by the SeekBehavior specified. + * + * @generated from message orderer.SeekInfo + */ +export type SeekInfo = Message<"orderer.SeekInfo"> & { + /** + * The position to start the deliver from + * + * @generated from field: orderer.SeekPosition start = 1; + */ + start?: SeekPosition; + + /** + * The position to stop the deliver + * + * @generated from field: orderer.SeekPosition stop = 2; + */ + stop?: SeekPosition; + + /** + * The behavior when a missing block is encountered + * + * @generated from field: orderer.SeekInfo.SeekBehavior behavior = 3; + */ + behavior: SeekInfo_SeekBehavior; + + /** + * How to respond to errors reported to the deliver service + * + * @generated from field: orderer.SeekInfo.SeekErrorResponse error_response = 4; + */ + errorResponse: SeekInfo_SeekErrorResponse; +}; + +/** + * Describes the message orderer.SeekInfo. + * Use `create(SeekInfoSchema)` to create a new message. + */ +export const SeekInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 5); + +/** + * If BLOCK_UNTIL_READY is specified, the reply will block until the requested blocks are available, + * if FAIL_IF_NOT_READY is specified, the reply will return an error indicating that the block is not + * found. To request that all blocks be returned indefinitely as they are created, behavior should be + * set to BLOCK_UNTIL_READY and the stop should be set to specified with a number of MAX_UINT64 + * + * @generated from enum orderer.SeekInfo.SeekBehavior + */ +export enum SeekInfo_SeekBehavior { + /** + * @generated from enum value: BLOCK_UNTIL_READY = 0; + */ + BLOCK_UNTIL_READY = 0, + + /** + * @generated from enum value: FAIL_IF_NOT_READY = 1; + */ + FAIL_IF_NOT_READY = 1, +} + +/** + * Describes the enum orderer.SeekInfo.SeekBehavior. + */ +export const SeekInfo_SeekBehaviorSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_orderer_ab, 5, 0); + +/** + * SeekErrorTolerance indicates to the server how block provider errors should be tolerated. By default, + * if the deliver service detects a problem in the underlying block source (typically, in the orderer, + * a consenter error), it will begin to reject deliver requests. This is to prevent a client from waiting + * for blocks from an orderer which is stuck in an errored state. This is almost always the desired behavior + * and clients should stick with the default STRICT checking behavior. However, in some scenarios, particularly + * when attempting to recover from a crash or other corruption, it's desirable to force an orderer to respond + * with blocks on a best effort basis, even if the backing consensus implementation is in an errored state. + * In this case, set the SeekErrorResponse to BEST_EFFORT to ignore the consenter errors. + * + * @generated from enum orderer.SeekInfo.SeekErrorResponse + */ +export enum SeekInfo_SeekErrorResponse { + /** + * @generated from enum value: STRICT = 0; + */ + STRICT = 0, + + /** + * @generated from enum value: BEST_EFFORT = 1; + */ + BEST_EFFORT = 1, +} + +/** + * Describes the enum orderer.SeekInfo.SeekErrorResponse. + */ +export const SeekInfo_SeekErrorResponseSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_orderer_ab, 5, 1); + +/** + * @generated from message orderer.DeliverResponse + */ +export type DeliverResponse = Message<"orderer.DeliverResponse"> & { + /** + * @generated from oneof orderer.DeliverResponse.Type + */ + Type: { + /** + * @generated from field: common.Status status = 1; + */ + value: Status; + case: "status"; + } | { + /** + * @generated from field: common.Block block = 2; + */ + value: Block; + case: "block"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message orderer.DeliverResponse. + * Use `create(DeliverResponseSchema)` to create a new message. + */ +export const DeliverResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_ab, 6); + +/** + * @generated from service orderer.AtomicBroadcast + */ +export const AtomicBroadcast: GenService<{ + /** + * broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure + * + * @generated from rpc orderer.AtomicBroadcast.Broadcast + */ + broadcast: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof BroadcastResponseSchema; + }, + /** + * deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received. + * + * @generated from rpc orderer.AtomicBroadcast.Deliver + */ + deliver: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof DeliverResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_orderer_ab, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_connect.ts new file mode 100644 index 0000000000..9407ed9c95 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_connect.ts @@ -0,0 +1,34 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file orderer/cluster.proto (package orderer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { StepRequest, StepResponse } from "./cluster_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Cluster defines communication between cluster members. + * + * @generated from service orderer.Cluster + */ +export const Cluster = { + typeName: "orderer.Cluster", + methods: { + /** + * Step passes an implementation-specific message to another cluster member. + * + * @generated from rpc orderer.Cluster.Step + */ + step: { + name: "Step", + I: StepRequest, + O: StepResponse, + kind: MethodKind.BiDiStreaming, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_pb.ts new file mode 100644 index 0000000000..af48533f2e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/cluster_pb.ts @@ -0,0 +1,198 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/cluster.proto (package orderer, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Envelope, Status } from "../common/common_pb"; +import { file_common_common } from "../common/common_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/cluster.proto. + */ +export const file_orderer_cluster: GenFile = /*@__PURE__*/ + fileDesc("ChVvcmRlcmVyL2NsdXN0ZXIucHJvdG8SB29yZGVyZXIiggEKC1N0ZXBSZXF1ZXN0EjYKEWNvbnNlbnN1c19yZXF1ZXN0GAEgASgLMhkub3JkZXJlci5Db25zZW5zdXNSZXF1ZXN0SAASMAoOc3VibWl0X3JlcXVlc3QYAiABKAsyFi5vcmRlcmVyLlN1Ym1pdFJlcXVlc3RIAEIJCgdwYXlsb2FkIkgKDFN0ZXBSZXNwb25zZRItCgpzdWJtaXRfcmVzGAEgASgLMhcub3JkZXJlci5TdWJtaXRSZXNwb25zZUgAQgkKB3BheWxvYWQiRgoQQ29uc2Vuc3VzUmVxdWVzdBIPCgdjaGFubmVsGAEgASgJEg8KB3BheWxvYWQYAiABKAwSEAoIbWV0YWRhdGEYAyABKAwiYAoNU3VibWl0UmVxdWVzdBIPCgdjaGFubmVsGAEgASgJEhsKE2xhc3RfdmFsaWRhdGlvbl9zZXEYAiABKAQSIQoHcGF5bG9hZBgDIAEoCzIQLmNvbW1vbi5FbnZlbG9wZSJPCg5TdWJtaXRSZXNwb25zZRIPCgdjaGFubmVsGAEgASgJEh4KBnN0YXR1cxgCIAEoDjIOLmNvbW1vbi5TdGF0dXMSDAoEaW5mbxgDIAEoCTJCCgdDbHVzdGVyEjcKBFN0ZXASFC5vcmRlcmVyLlN0ZXBSZXF1ZXN0GhUub3JkZXJlci5TdGVwUmVzcG9uc2UoATABQlgKJW9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLm9yZGVyZXJaL2dpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9vcmRlcmVyYgZwcm90bzM", [file_common_common]); + +/** + * StepRequest wraps a message that is sent to a cluster member. + * + * @generated from message orderer.StepRequest + */ +export type StepRequest = Message<"orderer.StepRequest"> & { + /** + * @generated from oneof orderer.StepRequest.payload + */ + payload: { + /** + * consensus_request is a consensus specific message. + * + * @generated from field: orderer.ConsensusRequest consensus_request = 1; + */ + value: ConsensusRequest; + case: "consensusRequest"; + } | { + /** + * submit_request is a relay of a transaction. + * + * @generated from field: orderer.SubmitRequest submit_request = 2; + */ + value: SubmitRequest; + case: "submitRequest"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message orderer.StepRequest. + * Use `create(StepRequestSchema)` to create a new message. + */ +export const StepRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_cluster, 0); + +/** + * StepResponse is a message received from a cluster member. + * + * @generated from message orderer.StepResponse + */ +export type StepResponse = Message<"orderer.StepResponse"> & { + /** + * @generated from oneof orderer.StepResponse.payload + */ + payload: { + /** + * @generated from field: orderer.SubmitResponse submit_res = 1; + */ + value: SubmitResponse; + case: "submitRes"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message orderer.StepResponse. + * Use `create(StepResponseSchema)` to create a new message. + */ +export const StepResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_cluster, 1); + +/** + * ConsensusRequest is a consensus specific message sent to a cluster member. + * + * @generated from message orderer.ConsensusRequest + */ +export type ConsensusRequest = Message<"orderer.ConsensusRequest"> & { + /** + * @generated from field: string channel = 1; + */ + channel: string; + + /** + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; + + /** + * @generated from field: bytes metadata = 3; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message orderer.ConsensusRequest. + * Use `create(ConsensusRequestSchema)` to create a new message. + */ +export const ConsensusRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_cluster, 2); + +/** + * SubmitRequest wraps a transaction to be sent for ordering. + * + * @generated from message orderer.SubmitRequest + */ +export type SubmitRequest = Message<"orderer.SubmitRequest"> & { + /** + * @generated from field: string channel = 1; + */ + channel: string; + + /** + * last_validation_seq denotes the last + * configuration sequence at which the + * sender validated this message. + * + * @generated from field: uint64 last_validation_seq = 2; + */ + lastValidationSeq: bigint; + + /** + * content is the fabric transaction + * that is forwarded to the cluster member. + * + * @generated from field: common.Envelope payload = 3; + */ + payload?: Envelope; +}; + +/** + * Describes the message orderer.SubmitRequest. + * Use `create(SubmitRequestSchema)` to create a new message. + */ +export const SubmitRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_cluster, 3); + +/** + * SubmitResponse returns a success + * or failure status to the sender. + * + * @generated from message orderer.SubmitResponse + */ +export type SubmitResponse = Message<"orderer.SubmitResponse"> & { + /** + * @generated from field: string channel = 1; + */ + channel: string; + + /** + * Status code, which may be used to programatically respond to success/failure. + * + * @generated from field: common.Status status = 2; + */ + status: Status; + + /** + * Info string which may contain additional information about the returned status. + * + * @generated from field: string info = 3; + */ + info: string; +}; + +/** + * Describes the message orderer.SubmitResponse. + * Use `create(SubmitResponseSchema)` to create a new message. + */ +export const SubmitResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_cluster, 4); + +/** + * Cluster defines communication between cluster members. + * + * @generated from service orderer.Cluster + */ +export const Cluster: GenService<{ + /** + * Step passes an implementation-specific message to another cluster member. + * + * @generated from rpc orderer.Cluster.Step + */ + step: { + methodKind: "bidi_streaming"; + input: typeof StepRequestSchema; + output: typeof StepResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_orderer_cluster, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/configuration_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/configuration_pb.ts new file mode 100644 index 0000000000..2bfb31f793 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/configuration_pb.ts @@ -0,0 +1,176 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/configuration.proto (package orderer, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/configuration.proto. + */ +export const file_orderer_configuration: GenFile = /*@__PURE__*/ + fileDesc("ChtvcmRlcmVyL2NvbmZpZ3VyYXRpb24ucHJvdG8SB29yZGVyZXIijgEKDUNvbnNlbnN1c1R5cGUSDAoEdHlwZRgBIAEoCRIQCghtZXRhZGF0YRgCIAEoDBIrCgVzdGF0ZRgDIAEoDjIcLm9yZGVyZXIuQ29uc2Vuc3VzVHlwZS5TdGF0ZSIwCgVTdGF0ZRIQCgxTVEFURV9OT1JNQUwQABIVChFTVEFURV9NQUlOVEVOQU5DRRABIl8KCUJhdGNoU2l6ZRIZChFtYXhfbWVzc2FnZV9jb3VudBgBIAEoDRIaChJhYnNvbHV0ZV9tYXhfYnl0ZXMYAiABKA0SGwoTcHJlZmVycmVkX21heF9ieXRlcxgDIAEoDSIfCgxCYXRjaFRpbWVvdXQSDwoHdGltZW91dBgBIAEoCSIfCgxLYWZrYUJyb2tlcnMSDwoHYnJva2VycxgBIAMoCSIoChNDaGFubmVsUmVzdHJpY3Rpb25zEhEKCW1heF9jb3VudBgBIAEoBEJYCiVvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5vcmRlcmVyWi9naXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vb3JkZXJlcmIGcHJvdG8z"); + +/** + * @generated from message orderer.ConsensusType + */ +export type ConsensusType = Message<"orderer.ConsensusType"> & { + /** + * The consensus type: "solo", "kafka" or "etcdraft". + * + * @generated from field: string type = 1; + */ + type: string; + + /** + * Opaque metadata, dependent on the consensus type. + * + * @generated from field: bytes metadata = 2; + */ + metadata: Uint8Array; + + /** + * The state signals the ordering service to go into maintenance mode, typically for consensus-type migration. + * + * @generated from field: orderer.ConsensusType.State state = 3; + */ + state: ConsensusType_State; +}; + +/** + * Describes the message orderer.ConsensusType. + * Use `create(ConsensusTypeSchema)` to create a new message. + */ +export const ConsensusTypeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_configuration, 0); + +/** + * State defines the orderer mode of operation, typically for consensus-type migration. + * NORMAL is during normal operation, when consensus-type migration is not, and can not, take place. + * MAINTENANCE is when the consensus-type can be changed. + * + * @generated from enum orderer.ConsensusType.State + */ +export enum ConsensusType_State { + /** + * @generated from enum value: STATE_NORMAL = 0; + */ + NORMAL = 0, + + /** + * @generated from enum value: STATE_MAINTENANCE = 1; + */ + MAINTENANCE = 1, +} + +/** + * Describes the enum orderer.ConsensusType.State. + */ +export const ConsensusType_StateSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_orderer_configuration, 0, 0); + +/** + * @generated from message orderer.BatchSize + */ +export type BatchSize = Message<"orderer.BatchSize"> & { + /** + * Simply specified as number of messages for now, in the future + * we may want to allow this to be specified by size in bytes + * + * @generated from field: uint32 max_message_count = 1; + */ + maxMessageCount: number; + + /** + * The byte count of the serialized messages in a batch cannot + * exceed this value. + * + * @generated from field: uint32 absolute_max_bytes = 2; + */ + absoluteMaxBytes: number; + + /** + * The byte count of the serialized messages in a batch should not + * exceed this value. + * + * @generated from field: uint32 preferred_max_bytes = 3; + */ + preferredMaxBytes: number; +}; + +/** + * Describes the message orderer.BatchSize. + * Use `create(BatchSizeSchema)` to create a new message. + */ +export const BatchSizeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_configuration, 1); + +/** + * @generated from message orderer.BatchTimeout + */ +export type BatchTimeout = Message<"orderer.BatchTimeout"> & { + /** + * Any duration string parseable by ParseDuration(): + * https://golang.org/pkg/time/#ParseDuration + * + * @generated from field: string timeout = 1; + */ + timeout: string; +}; + +/** + * Describes the message orderer.BatchTimeout. + * Use `create(BatchTimeoutSchema)` to create a new message. + */ +export const BatchTimeoutSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_configuration, 2); + +/** + * Carries a list of bootstrap brokers, i.e. this is not the exclusive set of + * brokers an ordering service + * + * @generated from message orderer.KafkaBrokers + */ +export type KafkaBrokers = Message<"orderer.KafkaBrokers"> & { + /** + * Each broker here should be identified using the (IP|host):port notation, + * e.g. 127.0.0.1:7050, or localhost:7050 are valid entries + * + * @generated from field: repeated string brokers = 1; + */ + brokers: string[]; +}; + +/** + * Describes the message orderer.KafkaBrokers. + * Use `create(KafkaBrokersSchema)` to create a new message. + */ +export const KafkaBrokersSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_configuration, 3); + +/** + * ChannelRestrictions is the mssage which conveys restrictions on channel creation for an orderer + * + * @generated from message orderer.ChannelRestrictions + */ +export type ChannelRestrictions = Message<"orderer.ChannelRestrictions"> & { + /** + * The max count of channels to allow to be created, a value of 0 indicates no limit + * + * @generated from field: uint64 max_count = 1; + */ + maxCount: bigint; +}; + +/** + * Describes the message orderer.ChannelRestrictions. + * Use `create(ChannelRestrictionsSchema)` to create a new message. + */ +export const ChannelRestrictionsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_configuration, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/configuration_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/configuration_pb.ts new file mode 100644 index 0000000000..1d9491533b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/configuration_pb.ts @@ -0,0 +1,121 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/etcdraft/configuration.proto (package etcdraft, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/etcdraft/configuration.proto. + */ +export const file_orderer_etcdraft_configuration: GenFile = /*@__PURE__*/ + fileDesc("CiRvcmRlcmVyL2V0Y2RyYWZ0L2NvbmZpZ3VyYXRpb24ucHJvdG8SCGV0Y2RyYWZ0Il0KDkNvbmZpZ01ldGFkYXRhEicKCmNvbnNlbnRlcnMYASADKAsyEy5ldGNkcmFmdC5Db25zZW50ZXISIgoHb3B0aW9ucxgCIAEoCzIRLmV0Y2RyYWZ0Lk9wdGlvbnMiWQoJQ29uc2VudGVyEgwKBGhvc3QYASABKAkSDAoEcG9ydBgCIAEoDRIXCg9jbGllbnRfdGxzX2NlcnQYAyABKAwSFwoPc2VydmVyX3Rsc19jZXJ0GAQgASgMIowBCgdPcHRpb25zEhUKDXRpY2tfaW50ZXJ2YWwYASABKAkSFQoNZWxlY3Rpb25fdGljaxgCIAEoDRIWCg5oZWFydGJlYXRfdGljaxgDIAEoDRIbChNtYXhfaW5mbGlnaHRfYmxvY2tzGAQgASgNEh4KFnNuYXBzaG90X2ludGVydmFsX3NpemUYBSABKA1Cagoub3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3Mub3JkZXJlci5ldGNkcmFmdFo4Z2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL29yZGVyZXIvZXRjZHJhZnRiBnByb3RvMw"); + +/** + * ConfigMetadata is serialized and set as the value of ConsensusType.Metadata in + * a channel configuration when the ConsensusType.Type is set "etcdraft". + * + * @generated from message etcdraft.ConfigMetadata + */ +export type ConfigMetadata = Message<"etcdraft.ConfigMetadata"> & { + /** + * @generated from field: repeated etcdraft.Consenter consenters = 1; + */ + consenters: Consenter[]; + + /** + * @generated from field: etcdraft.Options options = 2; + */ + options?: Options; +}; + +/** + * Describes the message etcdraft.ConfigMetadata. + * Use `create(ConfigMetadataSchema)` to create a new message. + */ +export const ConfigMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_etcdraft_configuration, 0); + +/** + * Consenter represents a consenting node (i.e. replica). + * + * @generated from message etcdraft.Consenter + */ +export type Consenter = Message<"etcdraft.Consenter"> & { + /** + * @generated from field: string host = 1; + */ + host: string; + + /** + * @generated from field: uint32 port = 2; + */ + port: number; + + /** + * @generated from field: bytes client_tls_cert = 3; + */ + clientTlsCert: Uint8Array; + + /** + * @generated from field: bytes server_tls_cert = 4; + */ + serverTlsCert: Uint8Array; +}; + +/** + * Describes the message etcdraft.Consenter. + * Use `create(ConsenterSchema)` to create a new message. + */ +export const ConsenterSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_etcdraft_configuration, 1); + +/** + * Options to be specified for all the etcd/raft nodes. These can be modified on a + * per-channel basis. + * + * @generated from message etcdraft.Options + */ +export type Options = Message<"etcdraft.Options"> & { + /** + * time duration format, e.g. 500ms + * + * @generated from field: string tick_interval = 1; + */ + tickInterval: string; + + /** + * @generated from field: uint32 election_tick = 2; + */ + electionTick: number; + + /** + * @generated from field: uint32 heartbeat_tick = 3; + */ + heartbeatTick: number; + + /** + * @generated from field: uint32 max_inflight_blocks = 4; + */ + maxInflightBlocks: number; + + /** + * Take snapshot when cumulative data exceeds certain size in bytes. + * + * @generated from field: uint32 snapshot_interval_size = 5; + */ + snapshotIntervalSize: number; +}; + +/** + * Describes the message etcdraft.Options. + * Use `create(OptionsSchema)` to create a new message. + */ +export const OptionsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_etcdraft_configuration, 2); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/metadata_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/metadata_pb.ts new file mode 100644 index 0000000000..4cee4df93b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/etcdraft/metadata_pb.ts @@ -0,0 +1,78 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/etcdraft/metadata.proto (package etcdraft, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/etcdraft/metadata.proto. + */ +export const file_orderer_etcdraft_metadata: GenFile = /*@__PURE__*/ + fileDesc("Ch9vcmRlcmVyL2V0Y2RyYWZ0L21ldGFkYXRhLnByb3RvEghldGNkcmFmdCJVCg1CbG9ja01ldGFkYXRhEhUKDWNvbnNlbnRlcl9pZHMYASADKAQSGQoRbmV4dF9jb25zZW50ZXJfaWQYAiABKAQSEgoKcmFmdF9pbmRleBgDIAEoBCInCg9DbHVzdGVyTWV0YWRhdGESFAoMYWN0aXZlX25vZGVzGAEgAygEQmoKLm9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLm9yZGVyZXIuZXRjZHJhZnRaOGdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9vcmRlcmVyL2V0Y2RyYWZ0YgZwcm90bzM"); + +/** + * BlockMetadata stores data used by the Raft OSNs when + * coordinating with each other, to be serialized into + * block meta dta field and used after failres and restarts. + * + * @generated from message etcdraft.BlockMetadata + */ +export type BlockMetadata = Message<"etcdraft.BlockMetadata"> & { + /** + * Maintains a mapping between the cluster's OSNs + * and their Raft IDs. + * + * @generated from field: repeated uint64 consenter_ids = 1; + */ + consenterIds: bigint[]; + + /** + * Carries the Raft ID value that will be assigned + * to the next OSN that will join this cluster. + * + * @generated from field: uint64 next_consenter_id = 2; + */ + nextConsenterId: bigint; + + /** + * Index of etcd/raft entry for current block. + * + * @generated from field: uint64 raft_index = 3; + */ + raftIndex: bigint; +}; + +/** + * Describes the message etcdraft.BlockMetadata. + * Use `create(BlockMetadataSchema)` to create a new message. + */ +export const BlockMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_etcdraft_metadata, 0); + +/** + * ClusterMetadata encapsulates metadata that is exchanged among cluster nodes + * + * @generated from message etcdraft.ClusterMetadata + */ +export type ClusterMetadata = Message<"etcdraft.ClusterMetadata"> & { + /** + * Indicates active nodes in cluster that are reacheable by Raft leader + * + * @generated from field: repeated uint64 active_nodes = 1; + */ + activeNodes: bigint[]; +}; + +/** + * Describes the message etcdraft.ClusterMetadata. + * Use `create(ClusterMetadataSchema)` to create a new message. + */ +export const ClusterMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_etcdraft_metadata, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/kafka_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/kafka_pb.ts new file mode 100644 index 0000000000..1bb5472841 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/orderer/kafka_pb.ts @@ -0,0 +1,205 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file orderer/kafka.proto (package orderer, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file orderer/kafka.proto. + */ +export const file_orderer_kafka: GenFile = /*@__PURE__*/ + fileDesc("ChNvcmRlcmVyL2thZmthLnByb3RvEgdvcmRlcmVyIq8BCgxLYWZrYU1lc3NhZ2USLwoHcmVndWxhchgBIAEoCzIcLm9yZGVyZXIuS2Fma2FNZXNzYWdlUmVndWxhckgAEjUKC3RpbWVfdG9fY3V0GAIgASgLMh4ub3JkZXJlci5LYWZrYU1lc3NhZ2VUaW1lVG9DdXRIABIvCgdjb25uZWN0GAMgASgLMhwub3JkZXJlci5LYWZrYU1lc3NhZ2VDb25uZWN0SABCBgoEVHlwZSK0AQoTS2Fma2FNZXNzYWdlUmVndWxhchIPCgdwYXlsb2FkGAEgASgMEhIKCmNvbmZpZ19zZXEYAiABKAQSMQoFY2xhc3MYAyABKA4yIi5vcmRlcmVyLkthZmthTWVzc2FnZVJlZ3VsYXIuQ2xhc3MSFwoPb3JpZ2luYWxfb2Zmc2V0GAQgASgDIiwKBUNsYXNzEgsKB1VOS05PV04QABIKCgZOT1JNQUwQARIKCgZDT05GSUcQAiItChVLYWZrYU1lc3NhZ2VUaW1lVG9DdXQSFAoMYmxvY2tfbnVtYmVyGAEgASgEIiYKE0thZmthTWVzc2FnZUNvbm5lY3QSDwoHcGF5bG9hZBgBIAEoDCJ+Cg1LYWZrYU1ldGFkYXRhEh0KFWxhc3Rfb2Zmc2V0X3BlcnNpc3RlZBgBIAEoAxImCh5sYXN0X29yaWdpbmFsX29mZnNldF9wcm9jZXNzZWQYAiABKAMSJgoebGFzdF9yZXN1Ym1pdHRlZF9jb25maWdfb2Zmc2V0GAMgASgDQlgKJW9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLm9yZGVyZXJaL2dpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9vcmRlcmVyYgZwcm90bzM"); + +/** + * KafkaMessage is a wrapper type for the messages + * that the Kafka-based orderer deals with. + * + * @generated from message orderer.KafkaMessage + */ +export type KafkaMessage = Message<"orderer.KafkaMessage"> & { + /** + * @generated from oneof orderer.KafkaMessage.Type + */ + Type: { + /** + * @generated from field: orderer.KafkaMessageRegular regular = 1; + */ + value: KafkaMessageRegular; + case: "regular"; + } | { + /** + * @generated from field: orderer.KafkaMessageTimeToCut time_to_cut = 2; + */ + value: KafkaMessageTimeToCut; + case: "timeToCut"; + } | { + /** + * @generated from field: orderer.KafkaMessageConnect connect = 3; + */ + value: KafkaMessageConnect; + case: "connect"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message orderer.KafkaMessage. + * Use `create(KafkaMessageSchema)` to create a new message. + */ +export const KafkaMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_kafka, 0); + +/** + * KafkaMessageRegular wraps a marshalled envelope. + * + * @generated from message orderer.KafkaMessageRegular + */ +export type KafkaMessageRegular = Message<"orderer.KafkaMessageRegular"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; + + /** + * @generated from field: uint64 config_seq = 2; + */ + configSeq: bigint; + + /** + * @generated from field: orderer.KafkaMessageRegular.Class class = 3; + */ + class: KafkaMessageRegular_Class; + + /** + * @generated from field: int64 original_offset = 4; + */ + originalOffset: bigint; +}; + +/** + * Describes the message orderer.KafkaMessageRegular. + * Use `create(KafkaMessageRegularSchema)` to create a new message. + */ +export const KafkaMessageRegularSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_kafka, 1); + +/** + * @generated from enum orderer.KafkaMessageRegular.Class + */ +export enum KafkaMessageRegular_Class { + /** + * @generated from enum value: UNKNOWN = 0; + */ + UNKNOWN = 0, + + /** + * @generated from enum value: NORMAL = 1; + */ + NORMAL = 1, + + /** + * @generated from enum value: CONFIG = 2; + */ + CONFIG = 2, +} + +/** + * Describes the enum orderer.KafkaMessageRegular.Class. + */ +export const KafkaMessageRegular_ClassSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_orderer_kafka, 1, 0); + +/** + * KafkaMessageTimeToCut is used to signal to the orderers + * that it is time to cut block . + * + * @generated from message orderer.KafkaMessageTimeToCut + */ +export type KafkaMessageTimeToCut = Message<"orderer.KafkaMessageTimeToCut"> & { + /** + * @generated from field: uint64 block_number = 1; + */ + blockNumber: bigint; +}; + +/** + * Describes the message orderer.KafkaMessageTimeToCut. + * Use `create(KafkaMessageTimeToCutSchema)` to create a new message. + */ +export const KafkaMessageTimeToCutSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_kafka, 2); + +/** + * KafkaMessageConnect is posted by an orderer upon booting up. + * It is used to prevent the panic that would be caused if we + * were to consume an empty partition. It is ignored by all + * orderers when processing the partition. + * + * @generated from message orderer.KafkaMessageConnect + */ +export type KafkaMessageConnect = Message<"orderer.KafkaMessageConnect"> & { + /** + * @generated from field: bytes payload = 1; + */ + payload: Uint8Array; +}; + +/** + * Describes the message orderer.KafkaMessageConnect. + * Use `create(KafkaMessageConnectSchema)` to create a new message. + */ +export const KafkaMessageConnectSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_kafka, 3); + +/** + * KafkaMetadata is encoded into the ORDERER block to keep track of + * Kafka-related metadata associated with this block. + * + * @generated from message orderer.KafkaMetadata + */ +export type KafkaMetadata = Message<"orderer.KafkaMetadata"> & { + /** + * LastOffsetPersisted is the encoded value for the Metadata message + * which is encoded in the ORDERER block metadata index for the case + * of the Kafka-based orderer. + * + * @generated from field: int64 last_offset_persisted = 1; + */ + lastOffsetPersisted: bigint; + + /** + * LastOriginalOffsetProcessed is used to keep track of the newest + * offset processed if a message is re-validated and re-ordered. + * This value is used to deduplicate re-submitted messages from + * multiple orderer so that we don't bother re-processing it again. + * + * @generated from field: int64 last_original_offset_processed = 2; + */ + lastOriginalOffsetProcessed: bigint; + + /** + * LastResubmittedConfigOffset is used to capture the newest offset of + * CONFIG kafka message, which is revalidated and resubmitted. By comparing + * this with LastOriginalOffsetProcessed, we could detemine whether there + * are still CONFIG messages that have been resubmitted but NOT processed + * yet. It's used as condition to block ingress messages, so we could reduce + * the overhead of repeatedly resubmitting messages as config seq keeps + * advancing. + * + * @generated from field: int64 last_resubmitted_config_offset = 3; + */ + lastResubmittedConfigOffset: bigint; +}; + +/** + * Describes the message orderer.KafkaMetadata. + * Use `create(KafkaMetadataSchema)` to create a new message. + */ +export const KafkaMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_orderer_kafka, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_event_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_event_pb.ts new file mode 100644 index 0000000000..9a6f74de85 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_event_pb.ts @@ -0,0 +1,53 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/chaincode_event.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/chaincode_event.proto. + */ +export const file_peer_chaincode_event: GenFile = /*@__PURE__*/ + fileDesc("ChpwZWVyL2NoYWluY29kZV9ldmVudC5wcm90bxIGcHJvdG9zIloKDkNoYWluY29kZUV2ZW50EhQKDGNoYWluY29kZV9pZBgBIAEoCRINCgV0eF9pZBgCIAEoCRISCgpldmVudF9uYW1lGAMgASgJEg8KB3BheWxvYWQYBCABKAxCaQoib3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MucGVlckIVQ2hhaW5jb2RlRXZlbnRQYWNrYWdlWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z"); + +/** + * ChaincodeEvent is used for events and registrations that are specific to chaincode + * string type - "chaincode" + * + * @generated from message protos.ChaincodeEvent + */ +export type ChaincodeEvent = Message<"protos.ChaincodeEvent"> & { + /** + * @generated from field: string chaincode_id = 1; + */ + chaincodeId: string; + + /** + * @generated from field: string tx_id = 2; + */ + txId: string; + + /** + * @generated from field: string event_name = 3; + */ + eventName: string; + + /** + * @generated from field: bytes payload = 4; + */ + payload: Uint8Array; +}; + +/** + * Describes the message protos.ChaincodeEvent. + * Use `create(ChaincodeEventSchema)` to create a new message. + */ +export const ChaincodeEventSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_event, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_pb.ts new file mode 100644 index 0000000000..7c606e0893 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_pb.ts @@ -0,0 +1,335 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/chaincode.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { SignaturePolicyEnvelope } from "../common/policies_pb"; +import { file_common_policies } from "../common/policies_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/chaincode.proto. + */ +export const file_peer_chaincode: GenFile = /*@__PURE__*/ + fileDesc("ChRwZWVyL2NoYWluY29kZS5wcm90bxIGcHJvdG9zIjoKC0NoYWluY29kZUlEEgwKBHBhdGgYASABKAkSDAoEbmFtZRgCIAEoCRIPCgd2ZXJzaW9uGAMgASgJIqEBCg5DaGFpbmNvZGVJbnB1dBIMCgRhcmdzGAEgAygMEjwKC2RlY29yYXRpb25zGAIgAygLMicucHJvdG9zLkNoYWluY29kZUlucHV0LkRlY29yYXRpb25zRW50cnkSDwoHaXNfaW5pdBgDIAEoCBoyChBEZWNvcmF0aW9uc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoDDoCOAEi3AEKDUNoYWluY29kZVNwZWMSKAoEdHlwZRgBIAEoDjIaLnByb3Rvcy5DaGFpbmNvZGVTcGVjLlR5cGUSKQoMY2hhaW5jb2RlX2lkGAIgASgLMhMucHJvdG9zLkNoYWluY29kZUlEEiUKBWlucHV0GAMgASgLMhYucHJvdG9zLkNoYWluY29kZUlucHV0Eg8KB3RpbWVvdXQYBCABKAUiPgoEVHlwZRINCglVTkRFRklORUQQABIKCgZHT0xBTkcQARIICgROT0RFEAISBwoDQ0FSEAMSCAoESkFWQRAEIoQBChdDaGFpbmNvZGVEZXBsb3ltZW50U3BlYxItCg5jaGFpbmNvZGVfc3BlYxgBIAEoCzIVLnByb3Rvcy5DaGFpbmNvZGVTcGVjEhQKDGNvZGVfcGFja2FnZRgDIAEoDEoECAIQA0oECAQQBVIOZWZmZWN0aXZlX2RhdGVSCGV4ZWNfZW52ImEKF0NoYWluY29kZUludm9jYXRpb25TcGVjEi0KDmNoYWluY29kZV9zcGVjGAEgASgLMhUucHJvdG9zLkNoYWluY29kZVNwZWNKBAgCEANSEWlkX2dlbmVyYXRpb25fYWxnIigKDkxpZmVjeWNsZUV2ZW50EhYKDmNoYWluY29kZV9uYW1lGAEgASgJIi0KB0NEU0RhdGESDAoEaGFzaBgBIAEoDBIUCgxtZXRhZGF0YWhhc2gYAiABKAwi1AEKDUNoYWluY29kZURhdGESDAoEbmFtZRgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJEgwKBGVzY2MYAyABKAkSDAoEdnNjYxgEIAEoCRIvCgZwb2xpY3kYBSABKAsyHy5jb21tb24uU2lnbmF0dXJlUG9saWN5RW52ZWxvcGUSDAoEZGF0YRgGIAEoDBIKCgJpZBgHIAEoDBI9ChRpbnN0YW50aWF0aW9uX3BvbGljeRgIIAEoCzIfLmNvbW1vbi5TaWduYXR1cmVQb2xpY3lFbnZlbG9wZUJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_common_policies]); + +/** + * ChaincodeID contains the path as specified by the deploy transaction + * that created it as well as the hashCode that is generated by the + * system for the path. From the user level (ie, CLI, REST API and so on) + * deploy transaction is expected to provide the path and other requests + * are expected to provide the hashCode. The other value will be ignored. + * Internally, the structure could contain both values. For instance, the + * hashCode will be set when first generated using the path + * + * @generated from message protos.ChaincodeID + */ +export type ChaincodeID = Message<"protos.ChaincodeID"> & { + /** + * deploy transaction will use the path + * + * @generated from field: string path = 1; + */ + path: string; + + /** + * all other requests will use the name (really a hashcode) generated by + * the deploy transaction + * + * @generated from field: string name = 2; + */ + name: string; + + /** + * user friendly version name for the chaincode + * + * @generated from field: string version = 3; + */ + version: string; +}; + +/** + * Describes the message protos.ChaincodeID. + * Use `create(ChaincodeIDSchema)` to create a new message. + */ +export const ChaincodeIDSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 0); + +/** + * Carries the chaincode function and its arguments. + * UnmarshalJSON in transaction.go converts the string-based REST/JSON input to + * the []byte-based current ChaincodeInput structure. + * + * @generated from message protos.ChaincodeInput + */ +export type ChaincodeInput = Message<"protos.ChaincodeInput"> & { + /** + * @generated from field: repeated bytes args = 1; + */ + args: Uint8Array[]; + + /** + * @generated from field: map decorations = 2; + */ + decorations: { [key: string]: Uint8Array }; + + /** + * is_init is used for the application to signal that an invocation is to be routed + * to the legacy 'Init' function for compatibility with chaincodes which handled + * Init in the old way. New applications should manage their initialized state + * themselves. + * + * @generated from field: bool is_init = 3; + */ + isInit: boolean; +}; + +/** + * Describes the message protos.ChaincodeInput. + * Use `create(ChaincodeInputSchema)` to create a new message. + */ +export const ChaincodeInputSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 1); + +/** + * Carries the chaincode specification. This is the actual metadata required for + * defining a chaincode. + * + * @generated from message protos.ChaincodeSpec + */ +export type ChaincodeSpec = Message<"protos.ChaincodeSpec"> & { + /** + * @generated from field: protos.ChaincodeSpec.Type type = 1; + */ + type: ChaincodeSpec_Type; + + /** + * @generated from field: protos.ChaincodeID chaincode_id = 2; + */ + chaincodeId?: ChaincodeID; + + /** + * @generated from field: protos.ChaincodeInput input = 3; + */ + input?: ChaincodeInput; + + /** + * @generated from field: int32 timeout = 4; + */ + timeout: number; +}; + +/** + * Describes the message protos.ChaincodeSpec. + * Use `create(ChaincodeSpecSchema)` to create a new message. + */ +export const ChaincodeSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 2); + +/** + * @generated from enum protos.ChaincodeSpec.Type + */ +export enum ChaincodeSpec_Type { + /** + * @generated from enum value: UNDEFINED = 0; + */ + UNDEFINED = 0, + + /** + * @generated from enum value: GOLANG = 1; + */ + GOLANG = 1, + + /** + * @generated from enum value: NODE = 2; + */ + NODE = 2, + + /** + * @generated from enum value: CAR = 3; + */ + CAR = 3, + + /** + * @generated from enum value: JAVA = 4; + */ + JAVA = 4, +} + +/** + * Describes the enum protos.ChaincodeSpec.Type. + */ +export const ChaincodeSpec_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_peer_chaincode, 2, 0); + +/** + * Specify the deployment of a chaincode. + * TODO: Define `codePackage`. + * + * @generated from message protos.ChaincodeDeploymentSpec + */ +export type ChaincodeDeploymentSpec = Message<"protos.ChaincodeDeploymentSpec"> & { + /** + * @generated from field: protos.ChaincodeSpec chaincode_spec = 1; + */ + chaincodeSpec?: ChaincodeSpec; + + /** + * @generated from field: bytes code_package = 3; + */ + codePackage: Uint8Array; +}; + +/** + * Describes the message protos.ChaincodeDeploymentSpec. + * Use `create(ChaincodeDeploymentSpecSchema)` to create a new message. + */ +export const ChaincodeDeploymentSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 3); + +/** + * Carries the chaincode function and its arguments. + * + * @generated from message protos.ChaincodeInvocationSpec + */ +export type ChaincodeInvocationSpec = Message<"protos.ChaincodeInvocationSpec"> & { + /** + * @generated from field: protos.ChaincodeSpec chaincode_spec = 1; + */ + chaincodeSpec?: ChaincodeSpec; +}; + +/** + * Describes the message protos.ChaincodeInvocationSpec. + * Use `create(ChaincodeInvocationSpecSchema)` to create a new message. + */ +export const ChaincodeInvocationSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 4); + +/** + * LifecycleEvent is used as the payload of the chaincode event emitted by LSCC + * + * @generated from message protos.LifecycleEvent + */ +export type LifecycleEvent = Message<"protos.LifecycleEvent"> & { + /** + * @generated from field: string chaincode_name = 1; + */ + chaincodeName: string; +}; + +/** + * Describes the message protos.LifecycleEvent. + * Use `create(LifecycleEventSchema)` to create a new message. + */ +export const LifecycleEventSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 5); + +/** + * CDSData is data stored in the LSCC on instantiation of a CC + * for CDSPackage. This needs to be serialized for ChaincodeData + * hence the protobuf format + * + * @generated from message protos.CDSData + */ +export type CDSData = Message<"protos.CDSData"> & { + /** + * hash of ChaincodeDeploymentSpec.code_package + * + * @generated from field: bytes hash = 1; + */ + hash: Uint8Array; + + /** + * hash of ChaincodeID.name + ChaincodeID.version + * + * @generated from field: bytes metadatahash = 2; + */ + metadatahash: Uint8Array; +}; + +/** + * Describes the message protos.CDSData. + * Use `create(CDSDataSchema)` to create a new message. + */ +export const CDSDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 6); + +/** + * ChaincodeData defines the datastructure for chaincodes to be serialized by proto + * Type provides an additional check by directing to use a specific package after instantiation + * Data is Type specific (see CDSPackage and SignedCDSPackage) + * + * @generated from message protos.ChaincodeData + */ +export type ChaincodeData = Message<"protos.ChaincodeData"> & { + /** + * Name of the chaincode + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * Version of the chaincode + * + * @generated from field: string version = 2; + */ + version: string; + + /** + * Escc for the chaincode instance + * + * @generated from field: string escc = 3; + */ + escc: string; + + /** + * Vscc for the chaincode instance + * + * @generated from field: string vscc = 4; + */ + vscc: string; + + /** + * Policy endorsement policy for the chaincode instance + * + * @generated from field: common.SignaturePolicyEnvelope policy = 5; + */ + policy?: SignaturePolicyEnvelope; + + /** + * Data data specific to the package + * + * @generated from field: bytes data = 6; + */ + data: Uint8Array; + + /** + * Id of the chaincode that's the unique fingerprint for the CC This is not + * currently used anywhere but serves as a good eyecatcher + * + * @generated from field: bytes id = 7; + */ + id: Uint8Array; + + /** + * InstantiationPolicy for the chaincode + * + * @generated from field: common.SignaturePolicyEnvelope instantiation_policy = 8; + */ + instantiationPolicy?: SignaturePolicyEnvelope; +}; + +/** + * Describes the message protos.ChaincodeData. + * Use `create(ChaincodeDataSchema)` to create a new message. + */ +export const ChaincodeDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode, 7); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_connect.ts new file mode 100644 index 0000000000..70defa4185 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_connect.ts @@ -0,0 +1,54 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file peer/chaincode_shim.proto (package protos, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ChaincodeMessage } from "./chaincode_shim_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Interface that provides support to chaincode execution. ChaincodeContext + * provides the context necessary for the server to respond appropriately. + * + * @generated from service protos.ChaincodeSupport + */ +export const ChaincodeSupport = { + typeName: "protos.ChaincodeSupport", + methods: { + /** + * @generated from rpc protos.ChaincodeSupport.Register + */ + register: { + name: "Register", + I: ChaincodeMessage, + O: ChaincodeMessage, + kind: MethodKind.BiDiStreaming, + }, + } +} as const; + +/** + * Chaincode as a server - peer establishes a connection to the chaincode as a client + * Currently only supports a stream connection. + * + * @generated from service protos.Chaincode + */ +export const Chaincode = { + typeName: "protos.Chaincode", + methods: { + /** + * @generated from rpc protos.Chaincode.Connect + */ + connect: { + name: "Connect", + I: ChaincodeMessage, + O: ChaincodeMessage, + kind: MethodKind.BiDiStreaming, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_pb.ts new file mode 100644 index 0000000000..51ac18a666 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/chaincode_shim_pb.ts @@ -0,0 +1,638 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/chaincode_shim.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { ChaincodeEvent } from "./chaincode_event_pb"; +import { file_peer_chaincode_event } from "./chaincode_event_pb"; +import type { SignedProposal } from "./proposal_pb"; +import { file_peer_proposal } from "./proposal_pb"; +import type { Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/chaincode_shim.proto. + */ +export const file_peer_chaincode_shim: GenFile = /*@__PURE__*/ + fileDesc("ChlwZWVyL2NoYWluY29kZV9zaGltLnByb3RvEgZwcm90b3MikQUKEENoYWluY29kZU1lc3NhZ2USKwoEdHlwZRgBIAEoDjIdLnByb3Rvcy5DaGFpbmNvZGVNZXNzYWdlLlR5cGUSLQoJdGltZXN0YW1wGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIPCgdwYXlsb2FkGAMgASgMEgwKBHR4aWQYBCABKAkSKAoIcHJvcG9zYWwYBSABKAsyFi5wcm90b3MuU2lnbmVkUHJvcG9zYWwSLwoPY2hhaW5jb2RlX2V2ZW50GAYgASgLMhYucHJvdG9zLkNoYWluY29kZUV2ZW50EhIKCmNoYW5uZWxfaWQYByABKAkikgMKBFR5cGUSDQoJVU5ERUZJTkVEEAASDAoIUkVHSVNURVIQARIOCgpSRUdJU1RFUkVEEAISCAoESU5JVBADEgkKBVJFQURZEAQSDwoLVFJBTlNBQ1RJT04QBRINCglDT01QTEVURUQQBhIJCgVFUlJPUhAHEg0KCUdFVF9TVEFURRAIEg0KCVBVVF9TVEFURRAJEg0KCURFTF9TVEFURRAKEhQKEElOVk9LRV9DSEFJTkNPREUQCxIMCghSRVNQT05TRRANEhYKEkdFVF9TVEFURV9CWV9SQU5HRRAOEhQKEEdFVF9RVUVSWV9SRVNVTFQQDxIUChBRVUVSWV9TVEFURV9ORVhUEBASFQoRUVVFUllfU1RBVEVfQ0xPU0UQERINCglLRUVQQUxJVkUQEhIXChNHRVRfSElTVE9SWV9GT1JfS0VZEBMSFgoSR0VUX1NUQVRFX01FVEFEQVRBEBQSFgoSUFVUX1NUQVRFX01FVEFEQVRBEBUSGQoVR0VUX1BSSVZBVEVfREFUQV9IQVNIEBYiKwoIR2V0U3RhdGUSCwoDa2V5GAEgASgJEhIKCmNvbGxlY3Rpb24YAiABKAkiMwoQR2V0U3RhdGVNZXRhZGF0YRILCgNrZXkYASABKAkSEgoKY29sbGVjdGlvbhgCIAEoCSI6CghQdXRTdGF0ZRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAwSEgoKY29sbGVjdGlvbhgDIAEoCSJcChBQdXRTdGF0ZU1ldGFkYXRhEgsKA2tleRgBIAEoCRISCgpjb2xsZWN0aW9uGAMgASgJEicKCG1ldGFkYXRhGAQgASgLMhUucHJvdG9zLlN0YXRlTWV0YWRhdGEiKwoIRGVsU3RhdGUSCwoDa2V5GAEgASgJEhIKCmNvbGxlY3Rpb24YAiABKAkiWQoPR2V0U3RhdGVCeVJhbmdlEhAKCHN0YXJ0S2V5GAEgASgJEg4KBmVuZEtleRgCIAEoCRISCgpjb2xsZWN0aW9uGAMgASgJEhAKCG1ldGFkYXRhGAQgASgMIkUKDkdldFF1ZXJ5UmVzdWx0Eg0KBXF1ZXJ5GAEgASgJEhIKCmNvbGxlY3Rpb24YAiABKAkSEAoIbWV0YWRhdGEYAyABKAwiMwoNUXVlcnlNZXRhZGF0YRIQCghwYWdlU2l6ZRgBIAEoBRIQCghib29rbWFyaxgCIAEoCSIfChBHZXRIaXN0b3J5Rm9yS2V5EgsKA2tleRgBIAEoCSIcCg5RdWVyeVN0YXRlTmV4dBIKCgJpZBgBIAEoCSIdCg9RdWVyeVN0YXRlQ2xvc2USCgoCaWQYASABKAkiJwoQUXVlcnlSZXN1bHRCeXRlcxITCgtyZXN1bHRCeXRlcxgBIAEoDCJqCg1RdWVyeVJlc3BvbnNlEikKB3Jlc3VsdHMYASADKAsyGC5wcm90b3MuUXVlcnlSZXN1bHRCeXRlcxIQCghoYXNfbW9yZRgCIAEoCBIKCgJpZBgDIAEoCRIQCghtZXRhZGF0YRgEIAEoDCJIChVRdWVyeVJlc3BvbnNlTWV0YWRhdGESHQoVZmV0Y2hlZF9yZWNvcmRzX2NvdW50GAEgASgFEhAKCGJvb2ttYXJrGAIgASgJIi8KDVN0YXRlTWV0YWRhdGESDwoHbWV0YWtleRgBIAEoCRINCgV2YWx1ZRgCIAEoDCI9ChNTdGF0ZU1ldGFkYXRhUmVzdWx0EiYKB2VudHJpZXMYASADKAsyFS5wcm90b3MuU3RhdGVNZXRhZGF0YTJWChBDaGFpbmNvZGVTdXBwb3J0EkIKCFJlZ2lzdGVyEhgucHJvdG9zLkNoYWluY29kZU1lc3NhZ2UaGC5wcm90b3MuQ2hhaW5jb2RlTWVzc2FnZSgBMAEyTgoJQ2hhaW5jb2RlEkEKB0Nvbm5lY3QSGC5wcm90b3MuQ2hhaW5jb2RlTWVzc2FnZRoYLnByb3Rvcy5DaGFpbmNvZGVNZXNzYWdlKAEwAUJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_peer_chaincode_event, file_peer_proposal, file_google_protobuf_timestamp]); + +/** + * @generated from message protos.ChaincodeMessage + */ +export type ChaincodeMessage = Message<"protos.ChaincodeMessage"> & { + /** + * @generated from field: protos.ChaincodeMessage.Type type = 1; + */ + type: ChaincodeMessage_Type; + + /** + * @generated from field: google.protobuf.Timestamp timestamp = 2; + */ + timestamp?: Timestamp; + + /** + * @generated from field: bytes payload = 3; + */ + payload: Uint8Array; + + /** + * @generated from field: string txid = 4; + */ + txid: string; + + /** + * @generated from field: protos.SignedProposal proposal = 5; + */ + proposal?: SignedProposal; + + /** + * event emitted by chaincode. Used only with Init or Invoke. + * This event is then stored (currently) + * with Block.NonHashData.TransactionResult + * + * @generated from field: protos.ChaincodeEvent chaincode_event = 6; + */ + chaincodeEvent?: ChaincodeEvent; + + /** + * channel id + * + * @generated from field: string channel_id = 7; + */ + channelId: string; +}; + +/** + * Describes the message protos.ChaincodeMessage. + * Use `create(ChaincodeMessageSchema)` to create a new message. + */ +export const ChaincodeMessageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 0); + +/** + * @generated from enum protos.ChaincodeMessage.Type + */ +export enum ChaincodeMessage_Type { + /** + * @generated from enum value: UNDEFINED = 0; + */ + UNDEFINED = 0, + + /** + * @generated from enum value: REGISTER = 1; + */ + REGISTER = 1, + + /** + * @generated from enum value: REGISTERED = 2; + */ + REGISTERED = 2, + + /** + * @generated from enum value: INIT = 3; + */ + INIT = 3, + + /** + * @generated from enum value: READY = 4; + */ + READY = 4, + + /** + * @generated from enum value: TRANSACTION = 5; + */ + TRANSACTION = 5, + + /** + * @generated from enum value: COMPLETED = 6; + */ + COMPLETED = 6, + + /** + * @generated from enum value: ERROR = 7; + */ + ERROR = 7, + + /** + * @generated from enum value: GET_STATE = 8; + */ + GET_STATE = 8, + + /** + * @generated from enum value: PUT_STATE = 9; + */ + PUT_STATE = 9, + + /** + * @generated from enum value: DEL_STATE = 10; + */ + DEL_STATE = 10, + + /** + * @generated from enum value: INVOKE_CHAINCODE = 11; + */ + INVOKE_CHAINCODE = 11, + + /** + * @generated from enum value: RESPONSE = 13; + */ + RESPONSE = 13, + + /** + * @generated from enum value: GET_STATE_BY_RANGE = 14; + */ + GET_STATE_BY_RANGE = 14, + + /** + * @generated from enum value: GET_QUERY_RESULT = 15; + */ + GET_QUERY_RESULT = 15, + + /** + * @generated from enum value: QUERY_STATE_NEXT = 16; + */ + QUERY_STATE_NEXT = 16, + + /** + * @generated from enum value: QUERY_STATE_CLOSE = 17; + */ + QUERY_STATE_CLOSE = 17, + + /** + * @generated from enum value: KEEPALIVE = 18; + */ + KEEPALIVE = 18, + + /** + * @generated from enum value: GET_HISTORY_FOR_KEY = 19; + */ + GET_HISTORY_FOR_KEY = 19, + + /** + * @generated from enum value: GET_STATE_METADATA = 20; + */ + GET_STATE_METADATA = 20, + + /** + * @generated from enum value: PUT_STATE_METADATA = 21; + */ + PUT_STATE_METADATA = 21, + + /** + * @generated from enum value: GET_PRIVATE_DATA_HASH = 22; + */ + GET_PRIVATE_DATA_HASH = 22, +} + +/** + * Describes the enum protos.ChaincodeMessage.Type. + */ +export const ChaincodeMessage_TypeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_peer_chaincode_shim, 0, 0); + +/** + * GetState is the payload of a ChaincodeMessage. It contains a key which + * is to be fetched from the ledger. If the collection is specified, the key + * would be fetched from the collection (i.e., private state) + * + * @generated from message protos.GetState + */ +export type GetState = Message<"protos.GetState"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: string collection = 2; + */ + collection: string; +}; + +/** + * Describes the message protos.GetState. + * Use `create(GetStateSchema)` to create a new message. + */ +export const GetStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 1); + +/** + * @generated from message protos.GetStateMetadata + */ +export type GetStateMetadata = Message<"protos.GetStateMetadata"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: string collection = 2; + */ + collection: string; +}; + +/** + * Describes the message protos.GetStateMetadata. + * Use `create(GetStateMetadataSchema)` to create a new message. + */ +export const GetStateMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 2); + +/** + * PutState is the payload of a ChaincodeMessage. It contains a key and value + * which needs to be written to the transaction's write set. If the collection is + * specified, the key and value would be written to the transaction's private + * write set. + * + * @generated from message protos.PutState + */ +export type PutState = Message<"protos.PutState"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @generated from field: string collection = 3; + */ + collection: string; +}; + +/** + * Describes the message protos.PutState. + * Use `create(PutStateSchema)` to create a new message. + */ +export const PutStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 3); + +/** + * @generated from message protos.PutStateMetadata + */ +export type PutStateMetadata = Message<"protos.PutStateMetadata"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: string collection = 3; + */ + collection: string; + + /** + * @generated from field: protos.StateMetadata metadata = 4; + */ + metadata?: StateMetadata; +}; + +/** + * Describes the message protos.PutStateMetadata. + * Use `create(PutStateMetadataSchema)` to create a new message. + */ +export const PutStateMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 4); + +/** + * DelState is the payload of a ChaincodeMessage. It contains a key which + * needs to be recorded in the transaction's write set as a delete operation. + * If the collection is specified, the key needs to be recorded in the + * transaction's private write set as a delete operation. + * + * @generated from message protos.DelState + */ +export type DelState = Message<"protos.DelState"> & { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: string collection = 2; + */ + collection: string; +}; + +/** + * Describes the message protos.DelState. + * Use `create(DelStateSchema)` to create a new message. + */ +export const DelStateSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 5); + +/** + * GetStateByRange is the payload of a ChaincodeMessage. It contains a start key and + * a end key required to execute range query. If the collection is specified, + * the range query needs to be executed on the private data. The metadata hold + * the byte representation of QueryMetadata. + * + * @generated from message protos.GetStateByRange + */ +export type GetStateByRange = Message<"protos.GetStateByRange"> & { + /** + * @generated from field: string startKey = 1; + */ + startKey: string; + + /** + * @generated from field: string endKey = 2; + */ + endKey: string; + + /** + * @generated from field: string collection = 3; + */ + collection: string; + + /** + * @generated from field: bytes metadata = 4; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message protos.GetStateByRange. + * Use `create(GetStateByRangeSchema)` to create a new message. + */ +export const GetStateByRangeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 6); + +/** + * GetQueryResult is the payload of a ChaincodeMessage. It contains a query + * string in the form that is supported by the underlying state database. + * If the collection is specified, the query needs to be executed on the + * private data. The metadata hold the byte representation of QueryMetadata. + * + * @generated from message protos.GetQueryResult + */ +export type GetQueryResult = Message<"protos.GetQueryResult"> & { + /** + * @generated from field: string query = 1; + */ + query: string; + + /** + * @generated from field: string collection = 2; + */ + collection: string; + + /** + * @generated from field: bytes metadata = 3; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message protos.GetQueryResult. + * Use `create(GetQueryResultSchema)` to create a new message. + */ +export const GetQueryResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 7); + +/** + * QueryMetadata is the metadata of a GetStateByRange and GetQueryResult. + * It contains a pageSize which denotes the number of records to be fetched + * and a bookmark. + * + * @generated from message protos.QueryMetadata + */ +export type QueryMetadata = Message<"protos.QueryMetadata"> & { + /** + * @generated from field: int32 pageSize = 1; + */ + pageSize: number; + + /** + * @generated from field: string bookmark = 2; + */ + bookmark: string; +}; + +/** + * Describes the message protos.QueryMetadata. + * Use `create(QueryMetadataSchema)` to create a new message. + */ +export const QueryMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 8); + +/** + * GetHistoryForKey is the payload of a ChaincodeMessage. It contains a key + * for which the historical values need to be retrieved. + * + * @generated from message protos.GetHistoryForKey + */ +export type GetHistoryForKey = Message<"protos.GetHistoryForKey"> & { + /** + * @generated from field: string key = 1; + */ + key: string; +}; + +/** + * Describes the message protos.GetHistoryForKey. + * Use `create(GetHistoryForKeySchema)` to create a new message. + */ +export const GetHistoryForKeySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 9); + +/** + * @generated from message protos.QueryStateNext + */ +export type QueryStateNext = Message<"protos.QueryStateNext"> & { + /** + * @generated from field: string id = 1; + */ + id: string; +}; + +/** + * Describes the message protos.QueryStateNext. + * Use `create(QueryStateNextSchema)` to create a new message. + */ +export const QueryStateNextSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 10); + +/** + * @generated from message protos.QueryStateClose + */ +export type QueryStateClose = Message<"protos.QueryStateClose"> & { + /** + * @generated from field: string id = 1; + */ + id: string; +}; + +/** + * Describes the message protos.QueryStateClose. + * Use `create(QueryStateCloseSchema)` to create a new message. + */ +export const QueryStateCloseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 11); + +/** + * QueryResultBytes hold the byte representation of a record returned by the peer. + * + * @generated from message protos.QueryResultBytes + */ +export type QueryResultBytes = Message<"protos.QueryResultBytes"> & { + /** + * @generated from field: bytes resultBytes = 1; + */ + resultBytes: Uint8Array; +}; + +/** + * Describes the message protos.QueryResultBytes. + * Use `create(QueryResultBytesSchema)` to create a new message. + */ +export const QueryResultBytesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 12); + +/** + * QueryResponse is returned by the peer as a result of a GetStateByRange, + * GetQueryResult, and GetHistoryForKey. It holds a bunch of records in + * results field, a flag to denote whether more results need to be fetched from + * the peer in has_more field, transaction id in id field, and a QueryResponseMetadata + * in metadata field. + * + * @generated from message protos.QueryResponse + */ +export type QueryResponse = Message<"protos.QueryResponse"> & { + /** + * @generated from field: repeated protos.QueryResultBytes results = 1; + */ + results: QueryResultBytes[]; + + /** + * @generated from field: bool has_more = 2; + */ + hasMore: boolean; + + /** + * @generated from field: string id = 3; + */ + id: string; + + /** + * @generated from field: bytes metadata = 4; + */ + metadata: Uint8Array; +}; + +/** + * Describes the message protos.QueryResponse. + * Use `create(QueryResponseSchema)` to create a new message. + */ +export const QueryResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 13); + +/** + * QueryResponseMetadata is the metadata of a QueryResponse. It contains a count + * which denotes the number of records fetched from the ledger and a bookmark. + * + * @generated from message protos.QueryResponseMetadata + */ +export type QueryResponseMetadata = Message<"protos.QueryResponseMetadata"> & { + /** + * @generated from field: int32 fetched_records_count = 1; + */ + fetchedRecordsCount: number; + + /** + * @generated from field: string bookmark = 2; + */ + bookmark: string; +}; + +/** + * Describes the message protos.QueryResponseMetadata. + * Use `create(QueryResponseMetadataSchema)` to create a new message. + */ +export const QueryResponseMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 14); + +/** + * @generated from message protos.StateMetadata + */ +export type StateMetadata = Message<"protos.StateMetadata"> & { + /** + * @generated from field: string metakey = 1; + */ + metakey: string; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; +}; + +/** + * Describes the message protos.StateMetadata. + * Use `create(StateMetadataSchema)` to create a new message. + */ +export const StateMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 15); + +/** + * @generated from message protos.StateMetadataResult + */ +export type StateMetadataResult = Message<"protos.StateMetadataResult"> & { + /** + * @generated from field: repeated protos.StateMetadata entries = 1; + */ + entries: StateMetadata[]; +}; + +/** + * Describes the message protos.StateMetadataResult. + * Use `create(StateMetadataResultSchema)` to create a new message. + */ +export const StateMetadataResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_chaincode_shim, 16); + +/** + * Interface that provides support to chaincode execution. ChaincodeContext + * provides the context necessary for the server to respond appropriately. + * + * @generated from service protos.ChaincodeSupport + */ +export const ChaincodeSupport: GenService<{ + /** + * @generated from rpc protos.ChaincodeSupport.Register + */ + register: { + methodKind: "bidi_streaming"; + input: typeof ChaincodeMessageSchema; + output: typeof ChaincodeMessageSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_peer_chaincode_shim, 0); + +/** + * Chaincode as a server - peer establishes a connection to the chaincode as a client + * Currently only supports a stream connection. + * + * @generated from service protos.Chaincode + */ +export const Chaincode: GenService<{ + /** + * @generated from rpc protos.Chaincode.Connect + */ + connect: { + methodKind: "bidi_streaming"; + input: typeof ChaincodeMessageSchema; + output: typeof ChaincodeMessageSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_peer_chaincode_shim, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/collection_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/collection_pb.ts new file mode 100644 index 0000000000..20fbb0e533 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/collection_pb.ts @@ -0,0 +1,191 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/collection.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { SignaturePolicyEnvelope } from "../common/policies_pb"; +import { file_common_policies } from "../common/policies_pb"; +import type { ApplicationPolicy } from "./policy_pb"; +import { file_peer_policy } from "./policy_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/collection.proto. + */ +export const file_peer_collection: GenFile = /*@__PURE__*/ + fileDesc("ChVwZWVyL2NvbGxlY3Rpb24ucHJvdG8SBnByb3RvcyJDChdDb2xsZWN0aW9uQ29uZmlnUGFja2FnZRIoCgZjb25maWcYASADKAsyGC5wcm90b3MuQ29sbGVjdGlvbkNvbmZpZyJhChBDb2xsZWN0aW9uQ29uZmlnEkIKGHN0YXRpY19jb2xsZWN0aW9uX2NvbmZpZxgBIAEoCzIeLnByb3Rvcy5TdGF0aWNDb2xsZWN0aW9uQ29uZmlnSABCCQoHcGF5bG9hZCKeAgoWU3RhdGljQ29sbGVjdGlvbkNvbmZpZxIMCgRuYW1lGAEgASgJEjoKEm1lbWJlcl9vcmdzX3BvbGljeRgCIAEoCzIeLnByb3Rvcy5Db2xsZWN0aW9uUG9saWN5Q29uZmlnEhsKE3JlcXVpcmVkX3BlZXJfY291bnQYAyABKAUSGgoSbWF4aW11bV9wZWVyX2NvdW50GAQgASgFEhUKDWJsb2NrX3RvX2xpdmUYBSABKAQSGAoQbWVtYmVyX29ubHlfcmVhZBgGIAEoCBIZChFtZW1iZXJfb25seV93cml0ZRgHIAEoCBI1ChJlbmRvcnNlbWVudF9wb2xpY3kYCCABKAsyGS5wcm90b3MuQXBwbGljYXRpb25Qb2xpY3kiYAoWQ29sbGVjdGlvblBvbGljeUNvbmZpZxI7ChBzaWduYXR1cmVfcG9saWN5GAEgASgLMh8uY29tbW9uLlNpZ25hdHVyZVBvbGljeUVudmVsb3BlSABCCQoHcGF5bG9hZEJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_common_policies, file_peer_policy]); + +/** + * CollectionConfigPackage represents an array of CollectionConfig + * messages; the extra struct is required because repeated oneof is + * forbidden by the protobuf syntax + * + * @generated from message protos.CollectionConfigPackage + */ +export type CollectionConfigPackage = Message<"protos.CollectionConfigPackage"> & { + /** + * @generated from field: repeated protos.CollectionConfig config = 1; + */ + config: CollectionConfig[]; +}; + +/** + * Describes the message protos.CollectionConfigPackage. + * Use `create(CollectionConfigPackageSchema)` to create a new message. + */ +export const CollectionConfigPackageSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_collection, 0); + +/** + * CollectionConfig defines the configuration of a collection object; + * it currently contains a single, static type. + * Dynamic collections are deferred. + * + * @generated from message protos.CollectionConfig + */ +export type CollectionConfig = Message<"protos.CollectionConfig"> & { + /** + * @generated from oneof protos.CollectionConfig.payload + */ + payload: { + /** + * @generated from field: protos.StaticCollectionConfig static_collection_config = 1; + */ + value: StaticCollectionConfig; + case: "staticCollectionConfig"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message protos.CollectionConfig. + * Use `create(CollectionConfigSchema)` to create a new message. + */ +export const CollectionConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_collection, 1); + +/** + * StaticCollectionConfig constitutes the configuration parameters of a + * static collection object. Static collections are collections that are + * known at chaincode instantiation time, and that cannot be changed. + * Dynamic collections are deferred. + * + * @generated from message protos.StaticCollectionConfig + */ +export type StaticCollectionConfig = Message<"protos.StaticCollectionConfig"> & { + /** + * the name of the collection inside the denoted chaincode + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * a reference to a policy residing / managed in the config block + * to define which orgs have access to this collection’s private data + * + * @generated from field: protos.CollectionPolicyConfig member_orgs_policy = 2; + */ + memberOrgsPolicy?: CollectionPolicyConfig; + + /** + * The minimum number of peers private data will be sent to upon + * endorsement. The endorsement would fail if dissemination to at least + * this number of peers is not achieved. + * + * @generated from field: int32 required_peer_count = 3; + */ + requiredPeerCount: number; + + /** + * The maximum number of peers that private data will be sent to + * upon endorsement. This number has to be bigger than required_peer_count. + * + * @generated from field: int32 maximum_peer_count = 4; + */ + maximumPeerCount: number; + + /** + * The number of blocks after which the collection data expires. + * For instance if the value is set to 10, a key last modified by block number 100 + * will be purged at block number 111. A zero value is treated same as MaxUint64 + * + * @generated from field: uint64 block_to_live = 5; + */ + blockToLive: bigint; + + /** + * The member only read access denotes whether only collection member clients + * can read the private data (if set to true), or even non members can + * read the data (if set to false, for example if you want to implement more granular + * access logic in the chaincode) + * + * @generated from field: bool member_only_read = 6; + */ + memberOnlyRead: boolean; + + /** + * The member only write access denotes whether only collection member clients + * can write the private data (if set to true), or even non members can + * write the data (if set to false, for example if you want to implement more granular + * access logic in the chaincode) + * + * @generated from field: bool member_only_write = 7; + */ + memberOnlyWrite: boolean; + + /** + * a reference to a policy residing / managed in the config block + * to define the endorsement policy for this collection + * + * @generated from field: protos.ApplicationPolicy endorsement_policy = 8; + */ + endorsementPolicy?: ApplicationPolicy; +}; + +/** + * Describes the message protos.StaticCollectionConfig. + * Use `create(StaticCollectionConfigSchema)` to create a new message. + */ +export const StaticCollectionConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_collection, 2); + +/** + * Collection policy configuration. Initially, the configuration can only + * contain a SignaturePolicy. In the future, the SignaturePolicy may be a + * more general Policy. Instead of containing the actual policy, the + * configuration may in the future contain a string reference to a policy. + * + * @generated from message protos.CollectionPolicyConfig + */ +export type CollectionPolicyConfig = Message<"protos.CollectionPolicyConfig"> & { + /** + * @generated from oneof protos.CollectionPolicyConfig.payload + */ + payload: { + /** + * Initially, only a signature policy is supported. + * + * Later, the SignaturePolicy will be replaced by a Policy. + * Policy policy = 1; + * A reference to a Policy is planned to be added later. + * string reference = 2; + * + * @generated from field: common.SignaturePolicyEnvelope signature_policy = 1; + */ + value: SignaturePolicyEnvelope; + case: "signaturePolicy"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message protos.CollectionPolicyConfig. + * Use `create(CollectionPolicyConfigSchema)` to create a new message. + */ +export const CollectionPolicyConfigSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_collection, 3); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/configuration_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/configuration_pb.ts new file mode 100644 index 0000000000..be93e9a11a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/configuration_pb.ts @@ -0,0 +1,108 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/configuration.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/configuration.proto. + */ +export const file_peer_configuration: GenFile = /*@__PURE__*/ + fileDesc("ChhwZWVyL2NvbmZpZ3VyYXRpb24ucHJvdG8SBnByb3RvcyI3CgtBbmNob3JQZWVycxIoCgxhbmNob3JfcGVlcnMYASADKAsyEi5wcm90b3MuQW5jaG9yUGVlciIoCgpBbmNob3JQZWVyEgwKBGhvc3QYASABKAkSDAoEcG9ydBgCIAEoBSIhCgtBUElSZXNvdXJjZRISCgpwb2xpY3lfcmVmGAEgASgJIm4KBEFDTHMSJAoEYWNscxgBIAMoCzIWLnByb3Rvcy5BQ0xzLkFjbHNFbnRyeRpACglBY2xzRW50cnkSCwoDa2V5GAEgASgJEiIKBXZhbHVlGAIgASgLMhMucHJvdG9zLkFQSVJlc291cmNlOgI4AUJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z"); + +/** + * AnchorPeers simply represents list of anchor peers which is used in ConfigurationItem + * + * @generated from message protos.AnchorPeers + */ +export type AnchorPeers = Message<"protos.AnchorPeers"> & { + /** + * @generated from field: repeated protos.AnchorPeer anchor_peers = 1; + */ + anchorPeers: AnchorPeer[]; +}; + +/** + * Describes the message protos.AnchorPeers. + * Use `create(AnchorPeersSchema)` to create a new message. + */ +export const AnchorPeersSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_configuration, 0); + +/** + * AnchorPeer message structure which provides information about anchor peer, it includes host name, + * port number and peer certificate. + * + * @generated from message protos.AnchorPeer + */ +export type AnchorPeer = Message<"protos.AnchorPeer"> & { + /** + * DNS host name of the anchor peer + * + * @generated from field: string host = 1; + */ + host: string; + + /** + * The port number + * + * @generated from field: int32 port = 2; + */ + port: number; +}; + +/** + * Describes the message protos.AnchorPeer. + * Use `create(AnchorPeerSchema)` to create a new message. + */ +export const AnchorPeerSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_configuration, 1); + +/** + * APIResource represents an API resource in the peer whose ACL + * is determined by the policy_ref field + * + * @generated from message protos.APIResource + */ +export type APIResource = Message<"protos.APIResource"> & { + /** + * The policy name to use for this API + * + * @generated from field: string policy_ref = 1; + */ + policyRef: string; +}; + +/** + * Describes the message protos.APIResource. + * Use `create(APIResourceSchema)` to create a new message. + */ +export const APIResourceSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_configuration, 2); + +/** + * ACLs provides mappings for resources in a channel. APIResource encapsulates + * reference to a policy used to determine ACL for the resource + * + * @generated from message protos.ACLs + */ +export type ACLs = Message<"protos.ACLs"> & { + /** + * @generated from field: map acls = 1; + */ + acls: { [key: string]: APIResource }; +}; + +/** + * Describes the message protos.ACLs. + * Use `create(ACLsSchema)` to create a new message. + */ +export const ACLsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_configuration, 3); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_connect.ts new file mode 100644 index 0000000000..45a6208117 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_connect.ts @@ -0,0 +1,61 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file peer/events.proto (package protos, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Envelope } from "../common/common_pb.js"; +import { DeliverResponse } from "./events_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service protos.Deliver + */ +export const Deliver = { + typeName: "protos.Deliver", + methods: { + /** + * Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of block replies is received + * + * @generated from rpc protos.Deliver.Deliver + */ + deliver: { + name: "Deliver", + I: Envelope, + O: DeliverResponse, + kind: MethodKind.BiDiStreaming, + }, + /** + * DeliverFiltered first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of **filtered** block replies is received + * + * @generated from rpc protos.Deliver.DeliverFiltered + */ + deliverFiltered: { + name: "DeliverFiltered", + I: Envelope, + O: DeliverResponse, + kind: MethodKind.BiDiStreaming, + }, + /** + * DeliverWithPrivateData first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of block and private data replies is received + * + * @generated from rpc protos.Deliver.DeliverWithPrivateData + */ + deliverWithPrivateData: { + name: "DeliverWithPrivateData", + I: Envelope, + O: DeliverResponse, + kind: MethodKind.BiDiStreaming, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_pb.ts new file mode 100644 index 0000000000..99f4ec2cb0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/events_pb.ts @@ -0,0 +1,250 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/events.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Block, EnvelopeSchema, HeaderType, Status } from "../common/common_pb"; +import { file_common_common } from "../common/common_pb"; +import type { TxPvtReadWriteSet } from "../ledger/rwset/rwset_pb"; +import { file_ledger_rwset_rwset } from "../ledger/rwset/rwset_pb"; +import type { ChaincodeEvent } from "./chaincode_event_pb"; +import { file_peer_chaincode_event } from "./chaincode_event_pb"; +import type { TxValidationCode } from "./transaction_pb"; +import { file_peer_transaction } from "./transaction_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/events.proto. + */ +export const file_peer_events: GenFile = /*@__PURE__*/ + fileDesc("ChFwZWVyL2V2ZW50cy5wcm90bxIGcHJvdG9zIm8KDUZpbHRlcmVkQmxvY2sSEgoKY2hhbm5lbF9pZBgBIAEoCRIOCgZudW1iZXIYAiABKAQSOgoVZmlsdGVyZWRfdHJhbnNhY3Rpb25zGAQgAygLMhsucHJvdG9zLkZpbHRlcmVkVHJhbnNhY3Rpb24ixgEKE0ZpbHRlcmVkVHJhbnNhY3Rpb24SDAoEdHhpZBgBIAEoCRIgCgR0eXBlGAIgASgOMhIuY29tbW9uLkhlYWRlclR5cGUSNAoSdHhfdmFsaWRhdGlvbl9jb2RlGAMgASgOMhgucHJvdG9zLlR4VmFsaWRhdGlvbkNvZGUSQQoTdHJhbnNhY3Rpb25fYWN0aW9ucxgEIAEoCzIiLnByb3Rvcy5GaWx0ZXJlZFRyYW5zYWN0aW9uQWN0aW9uc0gAQgYKBERhdGEiWAoaRmlsdGVyZWRUcmFuc2FjdGlvbkFjdGlvbnMSOgoRY2hhaW5jb2RlX2FjdGlvbnMYASADKAsyHy5wcm90b3MuRmlsdGVyZWRDaGFpbmNvZGVBY3Rpb24iSgoXRmlsdGVyZWRDaGFpbmNvZGVBY3Rpb24SLwoPY2hhaW5jb2RlX2V2ZW50GAEgASgLMhYucHJvdG9zLkNoYWluY29kZUV2ZW50Is8BChNCbG9ja0FuZFByaXZhdGVEYXRhEhwKBWJsb2NrGAEgASgLMg0uY29tbW9uLkJsb2NrEkkKEHByaXZhdGVfZGF0YV9tYXAYAiADKAsyLy5wcm90b3MuQmxvY2tBbmRQcml2YXRlRGF0YS5Qcml2YXRlRGF0YU1hcEVudHJ5Gk8KE1ByaXZhdGVEYXRhTWFwRW50cnkSCwoDa2V5GAEgASgEEicKBXZhbHVlGAIgASgLMhgucndzZXQuVHhQdnRSZWFkV3JpdGVTZXQ6AjgBIssBCg9EZWxpdmVyUmVzcG9uc2USIAoGc3RhdHVzGAEgASgOMg4uY29tbW9uLlN0YXR1c0gAEh4KBWJsb2NrGAIgASgLMg0uY29tbW9uLkJsb2NrSAASLwoOZmlsdGVyZWRfYmxvY2sYAyABKAsyFS5wcm90b3MuRmlsdGVyZWRCbG9ja0gAEj0KFmJsb2NrX2FuZF9wcml2YXRlX2RhdGEYBCABKAsyGy5wcm90b3MuQmxvY2tBbmRQcml2YXRlRGF0YUgAQgYKBFR5cGUy1AEKB0RlbGl2ZXISOgoHRGVsaXZlchIQLmNvbW1vbi5FbnZlbG9wZRoXLnByb3Rvcy5EZWxpdmVyUmVzcG9uc2UiACgBMAESQgoPRGVsaXZlckZpbHRlcmVkEhAuY29tbW9uLkVudmVsb3BlGhcucHJvdG9zLkRlbGl2ZXJSZXNwb25zZSIAKAEwARJJChZEZWxpdmVyV2l0aFByaXZhdGVEYXRhEhAuY29tbW9uLkVudmVsb3BlGhcucHJvdG9zLkRlbGl2ZXJSZXNwb25zZSIAKAEwAUJhCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyQg1FdmVudHNQYWNrYWdlWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_common_common, file_ledger_rwset_rwset, file_peer_chaincode_event, file_peer_transaction]); + +/** + * FilteredBlock is a minimal set of information about a block + * + * @generated from message protos.FilteredBlock + */ +export type FilteredBlock = Message<"protos.FilteredBlock"> & { + /** + * @generated from field: string channel_id = 1; + */ + channelId: string; + + /** + * The position in the blockchain + * + * @generated from field: uint64 number = 2; + */ + number: bigint; + + /** + * @generated from field: repeated protos.FilteredTransaction filtered_transactions = 4; + */ + filteredTransactions: FilteredTransaction[]; +}; + +/** + * Describes the message protos.FilteredBlock. + * Use `create(FilteredBlockSchema)` to create a new message. + */ +export const FilteredBlockSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 0); + +/** + * FilteredTransaction is a minimal set of information about a transaction + * within a block + * + * @generated from message protos.FilteredTransaction + */ +export type FilteredTransaction = Message<"protos.FilteredTransaction"> & { + /** + * @generated from field: string txid = 1; + */ + txid: string; + + /** + * @generated from field: common.HeaderType type = 2; + */ + type: HeaderType; + + /** + * @generated from field: protos.TxValidationCode tx_validation_code = 3; + */ + txValidationCode: TxValidationCode; + + /** + * @generated from oneof protos.FilteredTransaction.Data + */ + Data: { + /** + * @generated from field: protos.FilteredTransactionActions transaction_actions = 4; + */ + value: FilteredTransactionActions; + case: "transactionActions"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message protos.FilteredTransaction. + * Use `create(FilteredTransactionSchema)` to create a new message. + */ +export const FilteredTransactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 1); + +/** + * FilteredTransactionActions is a wrapper for array of TransactionAction + * message from regular block + * + * @generated from message protos.FilteredTransactionActions + */ +export type FilteredTransactionActions = Message<"protos.FilteredTransactionActions"> & { + /** + * @generated from field: repeated protos.FilteredChaincodeAction chaincode_actions = 1; + */ + chaincodeActions: FilteredChaincodeAction[]; +}; + +/** + * Describes the message protos.FilteredTransactionActions. + * Use `create(FilteredTransactionActionsSchema)` to create a new message. + */ +export const FilteredTransactionActionsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 2); + +/** + * FilteredChaincodeAction is a minimal set of information about an action + * within a transaction + * + * @generated from message protos.FilteredChaincodeAction + */ +export type FilteredChaincodeAction = Message<"protos.FilteredChaincodeAction"> & { + /** + * @generated from field: protos.ChaincodeEvent chaincode_event = 1; + */ + chaincodeEvent?: ChaincodeEvent; +}; + +/** + * Describes the message protos.FilteredChaincodeAction. + * Use `create(FilteredChaincodeActionSchema)` to create a new message. + */ +export const FilteredChaincodeActionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 3); + +/** + * BlockAndPrivateData contains Block and a map from tx_seq_in_block to rwset.TxPvtReadWriteSet + * + * @generated from message protos.BlockAndPrivateData + */ +export type BlockAndPrivateData = Message<"protos.BlockAndPrivateData"> & { + /** + * @generated from field: common.Block block = 1; + */ + block?: Block; + + /** + * map from tx_seq_in_block to rwset.TxPvtReadWriteSet + * + * @generated from field: map private_data_map = 2; + */ + privateDataMap: { [key: string]: TxPvtReadWriteSet }; +}; + +/** + * Describes the message protos.BlockAndPrivateData. + * Use `create(BlockAndPrivateDataSchema)` to create a new message. + */ +export const BlockAndPrivateDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 4); + +/** + * DeliverResponse + * + * @generated from message protos.DeliverResponse + */ +export type DeliverResponse = Message<"protos.DeliverResponse"> & { + /** + * @generated from oneof protos.DeliverResponse.Type + */ + Type: { + /** + * @generated from field: common.Status status = 1; + */ + value: Status; + case: "status"; + } | { + /** + * @generated from field: common.Block block = 2; + */ + value: Block; + case: "block"; + } | { + /** + * @generated from field: protos.FilteredBlock filtered_block = 3; + */ + value: FilteredBlock; + case: "filteredBlock"; + } | { + /** + * @generated from field: protos.BlockAndPrivateData block_and_private_data = 4; + */ + value: BlockAndPrivateData; + case: "blockAndPrivateData"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message protos.DeliverResponse. + * Use `create(DeliverResponseSchema)` to create a new message. + */ +export const DeliverResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_events, 5); + +/** + * @generated from service protos.Deliver + */ +export const Deliver: GenService<{ + /** + * Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of block replies is received + * + * @generated from rpc protos.Deliver.Deliver + */ + deliver: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof DeliverResponseSchema; + }, + /** + * DeliverFiltered first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of **filtered** block replies is received + * + * @generated from rpc protos.Deliver.DeliverFiltered + */ + deliverFiltered: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof DeliverResponseSchema; + }, + /** + * DeliverWithPrivateData first requires an Envelope of type ab.DELIVER_SEEK_INFO with + * Payload data as a marshaled orderer.SeekInfo message, + * then a stream of block and private data replies is received + * + * @generated from rpc protos.Deliver.DeliverWithPrivateData + */ + deliverWithPrivateData: { + methodKind: "bidi_streaming"; + input: typeof EnvelopeSchema; + output: typeof DeliverResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_peer_events, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/chaincode_definition_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/chaincode_definition_pb.ts new file mode 100644 index 0000000000..8ea3d5fdf5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/chaincode_definition_pb.ts @@ -0,0 +1,73 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/lifecycle/chaincode_definition.proto (package lifecycle, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/lifecycle/chaincode_definition.proto. + */ +export const file_peer_lifecycle_chaincode_definition: GenFile = /*@__PURE__*/ + fileDesc("CilwZWVyL2xpZmVjeWNsZS9jaGFpbmNvZGVfZGVmaW5pdGlvbi5wcm90bxIJbGlmZWN5Y2xlIl4KGENoYWluY29kZUVuZG9yc2VtZW50SW5mbxIPCgd2ZXJzaW9uGAEgASgJEhUKDWluaXRfcmVxdWlyZWQYAiABKAgSGgoSZW5kb3JzZW1lbnRfcGx1Z2luGAMgASgJIlIKF0NoYWluY29kZVZhbGlkYXRpb25JbmZvEhkKEXZhbGlkYXRpb25fcGx1Z2luGAEgASgJEhwKFHZhbGlkYXRpb25fcGFyYW1ldGVyGAIgASgMQmYKLG9yZy5oeXBlcmxlZGdlci5mYWJyaWMucHJvdG9zLnBlZXIubGlmZWN5Y2xlWjZnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlci9saWZlY3ljbGViBnByb3RvMw"); + +/** + * ChaincodeEndorsementInfo is (most) everything the peer needs to know in order + * to execute a chaincode + * + * @generated from message lifecycle.ChaincodeEndorsementInfo + */ +export type ChaincodeEndorsementInfo = Message<"lifecycle.ChaincodeEndorsementInfo"> & { + /** + * @generated from field: string version = 1; + */ + version: string; + + /** + * @generated from field: bool init_required = 2; + */ + initRequired: boolean; + + /** + * @generated from field: string endorsement_plugin = 3; + */ + endorsementPlugin: string; +}; + +/** + * Describes the message lifecycle.ChaincodeEndorsementInfo. + * Use `create(ChaincodeEndorsementInfoSchema)` to create a new message. + */ +export const ChaincodeEndorsementInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_chaincode_definition, 0); + +/** + * ValidationInfo is (most) everything the peer needs to know in order + * to validate a transaction + * + * @generated from message lifecycle.ChaincodeValidationInfo + */ +export type ChaincodeValidationInfo = Message<"lifecycle.ChaincodeValidationInfo"> & { + /** + * @generated from field: string validation_plugin = 1; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 2; + */ + validationParameter: Uint8Array; +}; + +/** + * Describes the message lifecycle.ChaincodeValidationInfo. + * Use `create(ChaincodeValidationInfoSchema)` to create a new message. + */ +export const ChaincodeValidationInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_chaincode_definition, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/db_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/db_pb.ts new file mode 100644 index 0000000000..6969e70981 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/db_pb.ts @@ -0,0 +1,81 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/lifecycle/db.proto (package lifecycle, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/lifecycle/db.proto. + */ +export const file_peer_lifecycle_db: GenFile = /*@__PURE__*/ + fileDesc("ChdwZWVyL2xpZmVjeWNsZS9kYi5wcm90bxIJbGlmZWN5Y2xlIjEKDVN0YXRlTWV0YWRhdGESEAoIZGF0YXR5cGUYASABKAkSDgoGZmllbGRzGAIgAygJIkcKCVN0YXRlRGF0YRIPCgVJbnQ2NBgBIAEoA0gAEg8KBUJ5dGVzGAIgASgMSAASEAoGU3RyaW5nGAMgASgJSABCBgoEVHlwZUJmCixvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyLmxpZmVjeWNsZVo2Z2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL3BlZXIvbGlmZWN5Y2xlYgZwcm90bzM"); + +/** + * StateMetadata describes the keys in a namespace. It is necessary because + * in collections, range scans are not possible during transactions which + * write. Therefore we must track the keys in our namespace ourselves. + * + * @generated from message lifecycle.StateMetadata + */ +export type StateMetadata = Message<"lifecycle.StateMetadata"> & { + /** + * @generated from field: string datatype = 1; + */ + datatype: string; + + /** + * @generated from field: repeated string fields = 2; + */ + fields: string[]; +}; + +/** + * Describes the message lifecycle.StateMetadata. + * Use `create(StateMetadataSchema)` to create a new message. + */ +export const StateMetadataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_db, 0); + +/** + * StateData encodes a particular field of a datatype + * + * @generated from message lifecycle.StateData + */ +export type StateData = Message<"lifecycle.StateData"> & { + /** + * @generated from oneof lifecycle.StateData.Type + */ + Type: { + /** + * @generated from field: int64 Int64 = 1; + */ + value: bigint; + case: "Int64"; + } | { + /** + * @generated from field: bytes Bytes = 2; + */ + value: Uint8Array; + case: "Bytes"; + } | { + /** + * @generated from field: string String = 3; + */ + value: string; + case: "String"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message lifecycle.StateData. + * Use `create(StateDataSchema)` to create a new message. + */ +export const StateDataSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_db, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/lifecycle_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/lifecycle_pb.ts new file mode 100644 index 0000000000..bbb64286bc --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/lifecycle/lifecycle_pb.ts @@ -0,0 +1,749 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/lifecycle/lifecycle.proto (package lifecycle, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { CollectionConfigPackage } from "../collection_pb"; +import { file_peer_collection } from "../collection_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/lifecycle/lifecycle.proto. + */ +export const file_peer_lifecycle_lifecycle: GenFile = /*@__PURE__*/ + fileDesc("Ch5wZWVyL2xpZmVjeWNsZS9saWZlY3ljbGUucHJvdG8SCWxpZmVjeWNsZSI5ChRJbnN0YWxsQ2hhaW5jb2RlQXJncxIhChljaGFpbmNvZGVfaW5zdGFsbF9wYWNrYWdlGAEgASgMIjsKFkluc3RhbGxDaGFpbmNvZGVSZXN1bHQSEgoKcGFja2FnZV9pZBgBIAEoCRINCgVsYWJlbBgCIAEoCSIxChtRdWVyeUluc3RhbGxlZENoYWluY29kZUFyZ3MSEgoKcGFja2FnZV9pZBgBIAEoCSL6AgodUXVlcnlJbnN0YWxsZWRDaGFpbmNvZGVSZXN1bHQSEgoKcGFja2FnZV9pZBgBIAEoCRINCgVsYWJlbBgCIAEoCRJMCgpyZWZlcmVuY2VzGAMgAygLMjgubGlmZWN5Y2xlLlF1ZXJ5SW5zdGFsbGVkQ2hhaW5jb2RlUmVzdWx0LlJlZmVyZW5jZXNFbnRyeRpmCg9SZWZlcmVuY2VzRW50cnkSCwoDa2V5GAEgASgJEkIKBXZhbHVlGAIgASgLMjMubGlmZWN5Y2xlLlF1ZXJ5SW5zdGFsbGVkQ2hhaW5jb2RlUmVzdWx0LlJlZmVyZW5jZXM6AjgBGlQKClJlZmVyZW5jZXMSRgoKY2hhaW5jb2RlcxgBIAMoCzIyLmxpZmVjeWNsZS5RdWVyeUluc3RhbGxlZENoYWluY29kZVJlc3VsdC5DaGFpbmNvZGUaKgoJQ2hhaW5jb2RlEgwKBG5hbWUYASABKAkSDwoHdmVyc2lvbhgCIAEoCSI2CiBHZXRJbnN0YWxsZWRDaGFpbmNvZGVQYWNrYWdlQXJncxISCgpwYWNrYWdlX2lkGAEgASgJIkcKIkdldEluc3RhbGxlZENoYWluY29kZVBhY2thZ2VSZXN1bHQSIQoZY2hhaW5jb2RlX2luc3RhbGxfcGFja2FnZRgBIAEoDCIeChxRdWVyeUluc3RhbGxlZENoYWluY29kZXNBcmdzIoQECh5RdWVyeUluc3RhbGxlZENoYWluY29kZXNSZXN1bHQSWgoUaW5zdGFsbGVkX2NoYWluY29kZXMYASADKAsyPC5saWZlY3ljbGUuUXVlcnlJbnN0YWxsZWRDaGFpbmNvZGVzUmVzdWx0Lkluc3RhbGxlZENoYWluY29kZRqCAgoSSW5zdGFsbGVkQ2hhaW5jb2RlEhIKCnBhY2thZ2VfaWQYASABKAkSDQoFbGFiZWwYAiABKAkSYAoKcmVmZXJlbmNlcxgDIAMoCzJMLmxpZmVjeWNsZS5RdWVyeUluc3RhbGxlZENoYWluY29kZXNSZXN1bHQuSW5zdGFsbGVkQ2hhaW5jb2RlLlJlZmVyZW5jZXNFbnRyeRpnCg9SZWZlcmVuY2VzRW50cnkSCwoDa2V5GAEgASgJEkMKBXZhbHVlGAIgASgLMjQubGlmZWN5Y2xlLlF1ZXJ5SW5zdGFsbGVkQ2hhaW5jb2Rlc1Jlc3VsdC5SZWZlcmVuY2VzOgI4ARpVCgpSZWZlcmVuY2VzEkcKCmNoYWluY29kZXMYASADKAsyMy5saWZlY3ljbGUuUXVlcnlJbnN0YWxsZWRDaGFpbmNvZGVzUmVzdWx0LkNoYWluY29kZRoqCglDaGFpbmNvZGUSDAoEbmFtZRgBIAEoCRIPCgd2ZXJzaW9uGAIgASgJIqcCCiZBcHByb3ZlQ2hhaW5jb2RlRGVmaW5pdGlvbkZvck15T3JnQXJncxIQCghzZXF1ZW5jZRgBIAEoAxIMCgRuYW1lGAIgASgJEg8KB3ZlcnNpb24YAyABKAkSGgoSZW5kb3JzZW1lbnRfcGx1Z2luGAQgASgJEhkKEXZhbGlkYXRpb25fcGx1Z2luGAUgASgJEhwKFHZhbGlkYXRpb25fcGFyYW1ldGVyGAYgASgMEjQKC2NvbGxlY3Rpb25zGAcgASgLMh8ucHJvdG9zLkNvbGxlY3Rpb25Db25maWdQYWNrYWdlEhUKDWluaXRfcmVxdWlyZWQYCCABKAgSKgoGc291cmNlGAkgASgLMhoubGlmZWN5Y2xlLkNoYWluY29kZVNvdXJjZSK/AQoPQ2hhaW5jb2RlU291cmNlEj0KC3VuYXZhaWxhYmxlGAEgASgLMiYubGlmZWN5Y2xlLkNoYWluY29kZVNvdXJjZS5VbmF2YWlsYWJsZUgAEjkKDWxvY2FsX3BhY2thZ2UYAiABKAsyIC5saWZlY3ljbGUuQ2hhaW5jb2RlU291cmNlLkxvY2FsSAAaDQoLVW5hdmFpbGFibGUaGwoFTG9jYWwSEgoKcGFja2FnZV9pZBgBIAEoCUIGCgRUeXBlIioKKEFwcHJvdmVDaGFpbmNvZGVEZWZpbml0aW9uRm9yTXlPcmdSZXN1bHQi8gEKHUNvbW1pdENoYWluY29kZURlZmluaXRpb25BcmdzEhAKCHNlcXVlbmNlGAEgASgDEgwKBG5hbWUYAiABKAkSDwoHdmVyc2lvbhgDIAEoCRIaChJlbmRvcnNlbWVudF9wbHVnaW4YBCABKAkSGQoRdmFsaWRhdGlvbl9wbHVnaW4YBSABKAkSHAoUdmFsaWRhdGlvbl9wYXJhbWV0ZXIYBiABKAwSNAoLY29sbGVjdGlvbnMYByABKAsyHy5wcm90b3MuQ29sbGVjdGlvbkNvbmZpZ1BhY2thZ2USFQoNaW5pdF9yZXF1aXJlZBgIIAEoCCIhCh9Db21taXRDaGFpbmNvZGVEZWZpbml0aW9uUmVzdWx0Iu0BChhDaGVja0NvbW1pdFJlYWRpbmVzc0FyZ3MSEAoIc2VxdWVuY2UYASABKAMSDAoEbmFtZRgCIAEoCRIPCgd2ZXJzaW9uGAMgASgJEhoKEmVuZG9yc2VtZW50X3BsdWdpbhgEIAEoCRIZChF2YWxpZGF0aW9uX3BsdWdpbhgFIAEoCRIcChR2YWxpZGF0aW9uX3BhcmFtZXRlchgGIAEoDBI0Cgtjb2xsZWN0aW9ucxgHIAEoCzIfLnByb3Rvcy5Db2xsZWN0aW9uQ29uZmlnUGFja2FnZRIVCg1pbml0X3JlcXVpcmVkGAggASgIIpcBChpDaGVja0NvbW1pdFJlYWRpbmVzc1Jlc3VsdBJHCglhcHByb3ZhbHMYASADKAsyNC5saWZlY3ljbGUuQ2hlY2tDb21taXRSZWFkaW5lc3NSZXN1bHQuQXBwcm92YWxzRW50cnkaMAoOQXBwcm92YWxzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgIOgI4ASIsChxRdWVyeUNoYWluY29kZURlZmluaXRpb25BcmdzEgwKBG5hbWUYASABKAki5AIKHlF1ZXJ5Q2hhaW5jb2RlRGVmaW5pdGlvblJlc3VsdBIQCghzZXF1ZW5jZRgBIAEoAxIPCgd2ZXJzaW9uGAIgASgJEhoKEmVuZG9yc2VtZW50X3BsdWdpbhgDIAEoCRIZChF2YWxpZGF0aW9uX3BsdWdpbhgEIAEoCRIcChR2YWxpZGF0aW9uX3BhcmFtZXRlchgFIAEoDBI0Cgtjb2xsZWN0aW9ucxgGIAEoCzIfLnByb3Rvcy5Db2xsZWN0aW9uQ29uZmlnUGFja2FnZRIVCg1pbml0X3JlcXVpcmVkGAcgASgIEksKCWFwcHJvdmFscxgIIAMoCzI4LmxpZmVjeWNsZS5RdWVyeUNoYWluY29kZURlZmluaXRpb25SZXN1bHQuQXBwcm92YWxzRW50cnkaMAoOQXBwcm92YWxzRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgIOgI4ASIfCh1RdWVyeUNoYWluY29kZURlZmluaXRpb25zQXJncyLrAgofUXVlcnlDaGFpbmNvZGVEZWZpbml0aW9uc1Jlc3VsdBJdChVjaGFpbmNvZGVfZGVmaW5pdGlvbnMYASADKAsyPi5saWZlY3ljbGUuUXVlcnlDaGFpbmNvZGVEZWZpbml0aW9uc1Jlc3VsdC5DaGFpbmNvZGVEZWZpbml0aW9uGugBChNDaGFpbmNvZGVEZWZpbml0aW9uEgwKBG5hbWUYASABKAkSEAoIc2VxdWVuY2UYAiABKAMSDwoHdmVyc2lvbhgDIAEoCRIaChJlbmRvcnNlbWVudF9wbHVnaW4YBCABKAkSGQoRdmFsaWRhdGlvbl9wbHVnaW4YBSABKAkSHAoUdmFsaWRhdGlvbl9wYXJhbWV0ZXIYBiABKAwSNAoLY29sbGVjdGlvbnMYByABKAsyHy5wcm90b3MuQ29sbGVjdGlvbkNvbmZpZ1BhY2thZ2USFQoNaW5pdF9yZXF1aXJlZBgIIAEoCEJmCixvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyLmxpZmVjeWNsZVo2Z2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL3BlZXIvbGlmZWN5Y2xlYgZwcm90bzM", [file_peer_collection]); + +/** + * InstallChaincodeArgs is the message used as the argument to + * '_lifecycle.InstallChaincode'. + * + * @generated from message lifecycle.InstallChaincodeArgs + */ +export type InstallChaincodeArgs = Message<"lifecycle.InstallChaincodeArgs"> & { + /** + * This should be a marshaled lifecycle.ChaincodePackage + * + * @generated from field: bytes chaincode_install_package = 1; + */ + chaincodeInstallPackage: Uint8Array; +}; + +/** + * Describes the message lifecycle.InstallChaincodeArgs. + * Use `create(InstallChaincodeArgsSchema)` to create a new message. + */ +export const InstallChaincodeArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 0); + +/** + * InstallChaincodeArgs is the message returned by + * '_lifecycle.InstallChaincode'. + * + * @generated from message lifecycle.InstallChaincodeResult + */ +export type InstallChaincodeResult = Message<"lifecycle.InstallChaincodeResult"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; + + /** + * @generated from field: string label = 2; + */ + label: string; +}; + +/** + * Describes the message lifecycle.InstallChaincodeResult. + * Use `create(InstallChaincodeResultSchema)` to create a new message. + */ +export const InstallChaincodeResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 1); + +/** + * QueryInstalledChaincodeArgs is the message used as arguments + * '_lifecycle.QueryInstalledChaincode' + * + * @generated from message lifecycle.QueryInstalledChaincodeArgs + */ +export type QueryInstalledChaincodeArgs = Message<"lifecycle.QueryInstalledChaincodeArgs"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodeArgs. + * Use `create(QueryInstalledChaincodeArgsSchema)` to create a new message. + */ +export const QueryInstalledChaincodeArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 2); + +/** + * QueryInstalledChaincodeResult is the message returned by + * '_lifecycle.QueryInstalledChaincode' + * + * @generated from message lifecycle.QueryInstalledChaincodeResult + */ +export type QueryInstalledChaincodeResult = Message<"lifecycle.QueryInstalledChaincodeResult"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; + + /** + * @generated from field: string label = 2; + */ + label: string; + + /** + * @generated from field: map references = 3; + */ + references: { [key: string]: QueryInstalledChaincodeResult_References }; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodeResult. + * Use `create(QueryInstalledChaincodeResultSchema)` to create a new message. + */ +export const QueryInstalledChaincodeResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 3); + +/** + * @generated from message lifecycle.QueryInstalledChaincodeResult.References + */ +export type QueryInstalledChaincodeResult_References = Message<"lifecycle.QueryInstalledChaincodeResult.References"> & { + /** + * @generated from field: repeated lifecycle.QueryInstalledChaincodeResult.Chaincode chaincodes = 1; + */ + chaincodes: QueryInstalledChaincodeResult_Chaincode[]; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodeResult.References. + * Use `create(QueryInstalledChaincodeResult_ReferencesSchema)` to create a new message. + */ +export const QueryInstalledChaincodeResult_ReferencesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 3, 0); + +/** + * @generated from message lifecycle.QueryInstalledChaincodeResult.Chaincode + */ +export type QueryInstalledChaincodeResult_Chaincode = Message<"lifecycle.QueryInstalledChaincodeResult.Chaincode"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: string version = 2; + */ + version: string; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodeResult.Chaincode. + * Use `create(QueryInstalledChaincodeResult_ChaincodeSchema)` to create a new message. + */ +export const QueryInstalledChaincodeResult_ChaincodeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 3, 1); + +/** + * GetInstalledChaincodePackageArgs is the message used as the argument to + * '_lifecycle.GetInstalledChaincodePackage'. + * + * @generated from message lifecycle.GetInstalledChaincodePackageArgs + */ +export type GetInstalledChaincodePackageArgs = Message<"lifecycle.GetInstalledChaincodePackageArgs"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; +}; + +/** + * Describes the message lifecycle.GetInstalledChaincodePackageArgs. + * Use `create(GetInstalledChaincodePackageArgsSchema)` to create a new message. + */ +export const GetInstalledChaincodePackageArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 4); + +/** + * GetInstalledChaincodePackageResult is the message returned by + * '_lifecycle.GetInstalledChaincodePackage'. + * + * @generated from message lifecycle.GetInstalledChaincodePackageResult + */ +export type GetInstalledChaincodePackageResult = Message<"lifecycle.GetInstalledChaincodePackageResult"> & { + /** + * @generated from field: bytes chaincode_install_package = 1; + */ + chaincodeInstallPackage: Uint8Array; +}; + +/** + * Describes the message lifecycle.GetInstalledChaincodePackageResult. + * Use `create(GetInstalledChaincodePackageResultSchema)` to create a new message. + */ +export const GetInstalledChaincodePackageResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 5); + +/** + * QueryInstalledChaincodesArgs currently is an empty argument to + * '_lifecycle.QueryInstalledChaincodes'. In the future, it may be + * extended to have parameters. + * + * @generated from message lifecycle.QueryInstalledChaincodesArgs + */ +export type QueryInstalledChaincodesArgs = Message<"lifecycle.QueryInstalledChaincodesArgs"> & { +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodesArgs. + * Use `create(QueryInstalledChaincodesArgsSchema)` to create a new message. + */ +export const QueryInstalledChaincodesArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 6); + +/** + * QueryInstalledChaincodesResult is the message returned by + * '_lifecycle.QueryInstalledChaincodes'. It returns a list of installed + * chaincodes, including a map of channel name to chaincode name and version + * pairs of chaincode definitions that reference this chaincode package. + * + * @generated from message lifecycle.QueryInstalledChaincodesResult + */ +export type QueryInstalledChaincodesResult = Message<"lifecycle.QueryInstalledChaincodesResult"> & { + /** + * @generated from field: repeated lifecycle.QueryInstalledChaincodesResult.InstalledChaincode installed_chaincodes = 1; + */ + installedChaincodes: QueryInstalledChaincodesResult_InstalledChaincode[]; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodesResult. + * Use `create(QueryInstalledChaincodesResultSchema)` to create a new message. + */ +export const QueryInstalledChaincodesResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 7); + +/** + * @generated from message lifecycle.QueryInstalledChaincodesResult.InstalledChaincode + */ +export type QueryInstalledChaincodesResult_InstalledChaincode = Message<"lifecycle.QueryInstalledChaincodesResult.InstalledChaincode"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; + + /** + * @generated from field: string label = 2; + */ + label: string; + + /** + * @generated from field: map references = 3; + */ + references: { [key: string]: QueryInstalledChaincodesResult_References }; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodesResult.InstalledChaincode. + * Use `create(QueryInstalledChaincodesResult_InstalledChaincodeSchema)` to create a new message. + */ +export const QueryInstalledChaincodesResult_InstalledChaincodeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 7, 0); + +/** + * @generated from message lifecycle.QueryInstalledChaincodesResult.References + */ +export type QueryInstalledChaincodesResult_References = Message<"lifecycle.QueryInstalledChaincodesResult.References"> & { + /** + * @generated from field: repeated lifecycle.QueryInstalledChaincodesResult.Chaincode chaincodes = 1; + */ + chaincodes: QueryInstalledChaincodesResult_Chaincode[]; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodesResult.References. + * Use `create(QueryInstalledChaincodesResult_ReferencesSchema)` to create a new message. + */ +export const QueryInstalledChaincodesResult_ReferencesSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 7, 1); + +/** + * @generated from message lifecycle.QueryInstalledChaincodesResult.Chaincode + */ +export type QueryInstalledChaincodesResult_Chaincode = Message<"lifecycle.QueryInstalledChaincodesResult.Chaincode"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: string version = 2; + */ + version: string; +}; + +/** + * Describes the message lifecycle.QueryInstalledChaincodesResult.Chaincode. + * Use `create(QueryInstalledChaincodesResult_ChaincodeSchema)` to create a new message. + */ +export const QueryInstalledChaincodesResult_ChaincodeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 7, 2); + +/** + * ApproveChaincodeDefinitionForMyOrgArgs is the message used as arguments to + * `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. + * + * @generated from message lifecycle.ApproveChaincodeDefinitionForMyOrgArgs + */ +export type ApproveChaincodeDefinitionForMyOrgArgs = Message<"lifecycle.ApproveChaincodeDefinitionForMyOrgArgs"> & { + /** + * @generated from field: int64 sequence = 1; + */ + sequence: bigint; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string version = 3; + */ + version: string; + + /** + * @generated from field: string endorsement_plugin = 4; + */ + endorsementPlugin: string; + + /** + * @generated from field: string validation_plugin = 5; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 6; + */ + validationParameter: Uint8Array; + + /** + * @generated from field: protos.CollectionConfigPackage collections = 7; + */ + collections?: CollectionConfigPackage; + + /** + * @generated from field: bool init_required = 8; + */ + initRequired: boolean; + + /** + * @generated from field: lifecycle.ChaincodeSource source = 9; + */ + source?: ChaincodeSource; +}; + +/** + * Describes the message lifecycle.ApproveChaincodeDefinitionForMyOrgArgs. + * Use `create(ApproveChaincodeDefinitionForMyOrgArgsSchema)` to create a new message. + */ +export const ApproveChaincodeDefinitionForMyOrgArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 8); + +/** + * @generated from message lifecycle.ChaincodeSource + */ +export type ChaincodeSource = Message<"lifecycle.ChaincodeSource"> & { + /** + * @generated from oneof lifecycle.ChaincodeSource.Type + */ + Type: { + /** + * @generated from field: lifecycle.ChaincodeSource.Unavailable unavailable = 1; + */ + value: ChaincodeSource_Unavailable; + case: "unavailable"; + } | { + /** + * @generated from field: lifecycle.ChaincodeSource.Local local_package = 2; + */ + value: ChaincodeSource_Local; + case: "localPackage"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message lifecycle.ChaincodeSource. + * Use `create(ChaincodeSourceSchema)` to create a new message. + */ +export const ChaincodeSourceSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 9); + +/** + * @generated from message lifecycle.ChaincodeSource.Unavailable + */ +export type ChaincodeSource_Unavailable = Message<"lifecycle.ChaincodeSource.Unavailable"> & { +}; + +/** + * Describes the message lifecycle.ChaincodeSource.Unavailable. + * Use `create(ChaincodeSource_UnavailableSchema)` to create a new message. + */ +export const ChaincodeSource_UnavailableSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 9, 0); + +/** + * @generated from message lifecycle.ChaincodeSource.Local + */ +export type ChaincodeSource_Local = Message<"lifecycle.ChaincodeSource.Local"> & { + /** + * @generated from field: string package_id = 1; + */ + packageId: string; +}; + +/** + * Describes the message lifecycle.ChaincodeSource.Local. + * Use `create(ChaincodeSource_LocalSchema)` to create a new message. + */ +export const ChaincodeSource_LocalSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 9, 1); + +/** + * ApproveChaincodeDefinitionForMyOrgResult is the message returned by + * `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. Currently it returns + * nothing, but may be extended in the future. + * + * @generated from message lifecycle.ApproveChaincodeDefinitionForMyOrgResult + */ +export type ApproveChaincodeDefinitionForMyOrgResult = Message<"lifecycle.ApproveChaincodeDefinitionForMyOrgResult"> & { +}; + +/** + * Describes the message lifecycle.ApproveChaincodeDefinitionForMyOrgResult. + * Use `create(ApproveChaincodeDefinitionForMyOrgResultSchema)` to create a new message. + */ +export const ApproveChaincodeDefinitionForMyOrgResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 10); + +/** + * CommitChaincodeDefinitionArgs is the message used as arguments to + * `_lifecycle.CommitChaincodeDefinition`. + * + * @generated from message lifecycle.CommitChaincodeDefinitionArgs + */ +export type CommitChaincodeDefinitionArgs = Message<"lifecycle.CommitChaincodeDefinitionArgs"> & { + /** + * @generated from field: int64 sequence = 1; + */ + sequence: bigint; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string version = 3; + */ + version: string; + + /** + * @generated from field: string endorsement_plugin = 4; + */ + endorsementPlugin: string; + + /** + * @generated from field: string validation_plugin = 5; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 6; + */ + validationParameter: Uint8Array; + + /** + * @generated from field: protos.CollectionConfigPackage collections = 7; + */ + collections?: CollectionConfigPackage; + + /** + * @generated from field: bool init_required = 8; + */ + initRequired: boolean; +}; + +/** + * Describes the message lifecycle.CommitChaincodeDefinitionArgs. + * Use `create(CommitChaincodeDefinitionArgsSchema)` to create a new message. + */ +export const CommitChaincodeDefinitionArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 11); + +/** + * CommitChaincodeDefinitionResult is the message returned by + * `_lifecycle.CommitChaincodeDefinition`. Currently it returns + * nothing, but may be extended in the future. + * + * @generated from message lifecycle.CommitChaincodeDefinitionResult + */ +export type CommitChaincodeDefinitionResult = Message<"lifecycle.CommitChaincodeDefinitionResult"> & { +}; + +/** + * Describes the message lifecycle.CommitChaincodeDefinitionResult. + * Use `create(CommitChaincodeDefinitionResultSchema)` to create a new message. + */ +export const CommitChaincodeDefinitionResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 12); + +/** + * CheckCommitReadinessArgs is the message used as arguments to + * `_lifecycle.CheckCommitReadiness`. + * + * @generated from message lifecycle.CheckCommitReadinessArgs + */ +export type CheckCommitReadinessArgs = Message<"lifecycle.CheckCommitReadinessArgs"> & { + /** + * @generated from field: int64 sequence = 1; + */ + sequence: bigint; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string version = 3; + */ + version: string; + + /** + * @generated from field: string endorsement_plugin = 4; + */ + endorsementPlugin: string; + + /** + * @generated from field: string validation_plugin = 5; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 6; + */ + validationParameter: Uint8Array; + + /** + * @generated from field: protos.CollectionConfigPackage collections = 7; + */ + collections?: CollectionConfigPackage; + + /** + * @generated from field: bool init_required = 8; + */ + initRequired: boolean; +}; + +/** + * Describes the message lifecycle.CheckCommitReadinessArgs. + * Use `create(CheckCommitReadinessArgsSchema)` to create a new message. + */ +export const CheckCommitReadinessArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 13); + +/** + * CheckCommitReadinessResult is the message returned by + * `_lifecycle.CheckCommitReadiness`. It returns a map of + * orgs to their approval (true/false) for the definition + * supplied as args. + * + * @generated from message lifecycle.CheckCommitReadinessResult + */ +export type CheckCommitReadinessResult = Message<"lifecycle.CheckCommitReadinessResult"> & { + /** + * @generated from field: map approvals = 1; + */ + approvals: { [key: string]: boolean }; +}; + +/** + * Describes the message lifecycle.CheckCommitReadinessResult. + * Use `create(CheckCommitReadinessResultSchema)` to create a new message. + */ +export const CheckCommitReadinessResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 14); + +/** + * QueryChaincodeDefinitionArgs is the message used as arguments to + * `_lifecycle.QueryChaincodeDefinition`. + * + * @generated from message lifecycle.QueryChaincodeDefinitionArgs + */ +export type QueryChaincodeDefinitionArgs = Message<"lifecycle.QueryChaincodeDefinitionArgs"> & { + /** + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message lifecycle.QueryChaincodeDefinitionArgs. + * Use `create(QueryChaincodeDefinitionArgsSchema)` to create a new message. + */ +export const QueryChaincodeDefinitionArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 15); + +/** + * QueryChaincodeDefinitionResult is the message returned by + * `_lifecycle.QueryChaincodeDefinition`. + * + * @generated from message lifecycle.QueryChaincodeDefinitionResult + */ +export type QueryChaincodeDefinitionResult = Message<"lifecycle.QueryChaincodeDefinitionResult"> & { + /** + * @generated from field: int64 sequence = 1; + */ + sequence: bigint; + + /** + * @generated from field: string version = 2; + */ + version: string; + + /** + * @generated from field: string endorsement_plugin = 3; + */ + endorsementPlugin: string; + + /** + * @generated from field: string validation_plugin = 4; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 5; + */ + validationParameter: Uint8Array; + + /** + * @generated from field: protos.CollectionConfigPackage collections = 6; + */ + collections?: CollectionConfigPackage; + + /** + * @generated from field: bool init_required = 7; + */ + initRequired: boolean; + + /** + * @generated from field: map approvals = 8; + */ + approvals: { [key: string]: boolean }; +}; + +/** + * Describes the message lifecycle.QueryChaincodeDefinitionResult. + * Use `create(QueryChaincodeDefinitionResultSchema)` to create a new message. + */ +export const QueryChaincodeDefinitionResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 16); + +/** + * QueryChaincodeDefinitionsArgs is the message used as arguments to + * `_lifecycle.QueryChaincodeDefinitions`. + * + * @generated from message lifecycle.QueryChaincodeDefinitionsArgs + */ +export type QueryChaincodeDefinitionsArgs = Message<"lifecycle.QueryChaincodeDefinitionsArgs"> & { +}; + +/** + * Describes the message lifecycle.QueryChaincodeDefinitionsArgs. + * Use `create(QueryChaincodeDefinitionsArgsSchema)` to create a new message. + */ +export const QueryChaincodeDefinitionsArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 17); + +/** + * QueryChaincodeDefinitionsResult is the message returned by + * `_lifecycle.QueryChaincodeDefinitions`. + * + * @generated from message lifecycle.QueryChaincodeDefinitionsResult + */ +export type QueryChaincodeDefinitionsResult = Message<"lifecycle.QueryChaincodeDefinitionsResult"> & { + /** + * @generated from field: repeated lifecycle.QueryChaincodeDefinitionsResult.ChaincodeDefinition chaincode_definitions = 1; + */ + chaincodeDefinitions: QueryChaincodeDefinitionsResult_ChaincodeDefinition[]; +}; + +/** + * Describes the message lifecycle.QueryChaincodeDefinitionsResult. + * Use `create(QueryChaincodeDefinitionsResultSchema)` to create a new message. + */ +export const QueryChaincodeDefinitionsResultSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 18); + +/** + * @generated from message lifecycle.QueryChaincodeDefinitionsResult.ChaincodeDefinition + */ +export type QueryChaincodeDefinitionsResult_ChaincodeDefinition = Message<"lifecycle.QueryChaincodeDefinitionsResult.ChaincodeDefinition"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: int64 sequence = 2; + */ + sequence: bigint; + + /** + * @generated from field: string version = 3; + */ + version: string; + + /** + * @generated from field: string endorsement_plugin = 4; + */ + endorsementPlugin: string; + + /** + * @generated from field: string validation_plugin = 5; + */ + validationPlugin: string; + + /** + * @generated from field: bytes validation_parameter = 6; + */ + validationParameter: Uint8Array; + + /** + * @generated from field: protos.CollectionConfigPackage collections = 7; + */ + collections?: CollectionConfigPackage; + + /** + * @generated from field: bool init_required = 8; + */ + initRequired: boolean; +}; + +/** + * Describes the message lifecycle.QueryChaincodeDefinitionsResult.ChaincodeDefinition. + * Use `create(QueryChaincodeDefinitionsResult_ChaincodeDefinitionSchema)` to create a new message. + */ +export const QueryChaincodeDefinitionsResult_ChaincodeDefinitionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_lifecycle_lifecycle, 18, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_connect.ts new file mode 100644 index 0000000000..897980c039 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_connect.ts @@ -0,0 +1,31 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file peer/peer.proto (package protos, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { SignedProposal } from "./proposal_pb.js"; +import { ProposalResponse } from "./proposal_response_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * @generated from service protos.Endorser + */ +export const Endorser = { + typeName: "protos.Endorser", + methods: { + /** + * @generated from rpc protos.Endorser.ProcessProposal + */ + processProposal: { + name: "ProcessProposal", + I: SignedProposal, + O: ProposalResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_pb.ts new file mode 100644 index 0000000000..cce918e1fd --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/peer_pb.ts @@ -0,0 +1,36 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/peer.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { SignedProposalSchema } from "./proposal_pb"; +import { file_peer_proposal } from "./proposal_pb"; +import type { ProposalResponseSchema } from "./proposal_response_pb"; +import { file_peer_proposal_response } from "./proposal_response_pb"; + +/** + * Describes the file peer/peer.proto. + */ +export const file_peer_peer: GenFile = /*@__PURE__*/ + fileDesc("Cg9wZWVyL3BlZXIucHJvdG8SBnByb3RvczJPCghFbmRvcnNlchJDCg9Qcm9jZXNzUHJvcG9zYWwSFi5wcm90b3MuU2lnbmVkUHJvcG9zYWwaGC5wcm90b3MuUHJvcG9zYWxSZXNwb25zZUJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_peer_proposal, file_peer_proposal_response]); + +/** + * @generated from service protos.Endorser + */ +export const Endorser: GenService<{ + /** + * @generated from rpc protos.Endorser.ProcessProposal + */ + processProposal: { + methodKind: "unary"; + input: typeof SignedProposalSchema; + output: typeof ProposalResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_peer_peer, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/policy_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/policy_pb.ts new file mode 100644 index 0000000000..306b995b1b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/policy_pb.ts @@ -0,0 +1,60 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/policy.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { SignaturePolicyEnvelope } from "../common/policies_pb"; +import { file_common_policies } from "../common/policies_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/policy.proto. + */ +export const file_peer_policy: GenFile = /*@__PURE__*/ + fileDesc("ChFwZWVyL3BvbGljeS5wcm90bxIGcHJvdG9zIoMBChFBcHBsaWNhdGlvblBvbGljeRI7ChBzaWduYXR1cmVfcG9saWN5GAEgASgLMh8uY29tbW9uLlNpZ25hdHVyZVBvbGljeUVudmVsb3BlSAASKQofY2hhbm5lbF9jb25maWdfcG9saWN5X3JlZmVyZW5jZRgCIAEoCUgAQgYKBFR5cGVCUgoib3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MucGVlclosZ2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL3BlZXJiBnByb3RvMw", [file_common_policies]); + +/** + * ApplicationPolicy captures the diffenrent policy types that + * are set and evaluted at the application level. + * + * @generated from message protos.ApplicationPolicy + */ +export type ApplicationPolicy = Message<"protos.ApplicationPolicy"> & { + /** + * @generated from oneof protos.ApplicationPolicy.Type + */ + Type: { + /** + * SignaturePolicy type is used if the policy is specified as + * a combination (using threshold gates) of signatures from MSP + * principals + * + * @generated from field: common.SignaturePolicyEnvelope signature_policy = 1; + */ + value: SignaturePolicyEnvelope; + case: "signaturePolicy"; + } | { + /** + * ChannelConfigPolicyReference is used when the policy is + * specified as a string that references a policy defined in + * the configuration of the channel + * + * @generated from field: string channel_config_policy_reference = 2; + */ + value: string; + case: "channelConfigPolicyReference"; + } | { case: undefined; value?: undefined }; +}; + +/** + * Describes the message protos.ApplicationPolicy. + * Use `create(ApplicationPolicySchema)` to create a new message. + */ +export const ApplicationPolicySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_policy, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_pb.ts new file mode 100644 index 0000000000..0bf895fe33 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_pb.ts @@ -0,0 +1,238 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/proposal.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { ChaincodeID } from "./chaincode_pb"; +import { file_peer_chaincode } from "./chaincode_pb"; +import type { Response } from "./proposal_response_pb"; +import { file_peer_proposal_response } from "./proposal_response_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/proposal.proto. + */ +export const file_peer_proposal: GenFile = /*@__PURE__*/ + fileDesc("ChNwZWVyL3Byb3Bvc2FsLnByb3RvEgZwcm90b3MiOwoOU2lnbmVkUHJvcG9zYWwSFgoOcHJvcG9zYWxfYnl0ZXMYASABKAwSEQoJc2lnbmF0dXJlGAIgASgMIj4KCFByb3Bvc2FsEg4KBmhlYWRlchgBIAEoDBIPCgdwYXlsb2FkGAIgASgMEhEKCWV4dGVuc2lvbhgDIAEoDCJeChhDaGFpbmNvZGVIZWFkZXJFeHRlbnNpb24SKQoMY2hhaW5jb2RlX2lkGAIgASgLMhMucHJvdG9zLkNoYWluY29kZUlESgQIARACUhFwYXlsb2FkX3Zpc2JpbGl0eSKoAQoYQ2hhaW5jb2RlUHJvcG9zYWxQYXlsb2FkEg0KBWlucHV0GAEgASgMEkgKDFRyYW5zaWVudE1hcBgCIAMoCzIyLnByb3Rvcy5DaGFpbmNvZGVQcm9wb3NhbFBheWxvYWQuVHJhbnNpZW50TWFwRW50cnkaMwoRVHJhbnNpZW50TWFwRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgMOgI4ASKZAQoPQ2hhaW5jb2RlQWN0aW9uEg8KB3Jlc3VsdHMYASABKAwSDgoGZXZlbnRzGAIgASgMEiIKCHJlc3BvbnNlGAMgASgLMhAucHJvdG9zLlJlc3BvbnNlEikKDGNoYWluY29kZV9pZBgEIAEoCzITLnByb3Rvcy5DaGFpbmNvZGVJREoECAUQBlIQdG9rZW5fb3BlcmF0aW9uc0JjCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyQg9Qcm9wb3NhbFBhY2thZ2VaLGdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9wZWVyYgZwcm90bzM", [file_peer_chaincode, file_peer_proposal_response]); + +/** + * This structure is necessary to sign the proposal which contains the header + * and the payload. Without this structure, we would have to concatenate the + * header and the payload to verify the signature, which could be expensive + * with large payload + * + * When an endorser receives a SignedProposal message, it should verify the + * signature over the proposal bytes. This verification requires the following + * steps: + * 1. Verification of the validity of the certificate that was used to produce + * the signature. The certificate will be available once proposalBytes has + * been unmarshalled to a Proposal message, and Proposal.header has been + * unmarshalled to a Header message. While this unmarshalling-before-verifying + * might not be ideal, it is unavoidable because i) the signature needs to also + * protect the signing certificate; ii) it is desirable that Header is created + * once by the client and never changed (for the sake of accountability and + * non-repudiation). Note also that it is actually impossible to conclusively + * verify the validity of the certificate included in a Proposal, because the + * proposal needs to first be endorsed and ordered with respect to certificate + * expiration transactions. Still, it is useful to pre-filter expired + * certificates at this stage. + * 2. Verification that the certificate is trusted (signed by a trusted CA) and + * that it is allowed to transact with us (with respect to some ACLs); + * 3. Verification that the signature on proposalBytes is valid; + * 4. Detect replay attacks; + * + * @generated from message protos.SignedProposal + */ +export type SignedProposal = Message<"protos.SignedProposal"> & { + /** + * The bytes of Proposal + * + * @generated from field: bytes proposal_bytes = 1; + */ + proposalBytes: Uint8Array; + + /** + * Signaure over proposalBytes; this signature is to be verified against + * the creator identity contained in the header of the Proposal message + * marshaled as proposalBytes + * + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message protos.SignedProposal. + * Use `create(SignedProposalSchema)` to create a new message. + */ +export const SignedProposalSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal, 0); + +/** + * A Proposal is sent to an endorser for endorsement. The proposal contains: + * 1. A header which should be unmarshaled to a Header message. Note that + * Header is both the header of a Proposal and of a Transaction, in that i) + * both headers should be unmarshaled to this message; and ii) it is used to + * compute cryptographic hashes and signatures. The header has fields common + * to all proposals/transactions. In addition it has a type field for + * additional customization. An example of this is the ChaincodeHeaderExtension + * message used to extend the Header for type CHAINCODE. + * 2. A payload whose type depends on the header's type field. + * 3. An extension whose type depends on the header's type field. + * + * Let us see an example. For type CHAINCODE (see the Header message), + * we have the following: + * 1. The header is a Header message whose extensions field is a + * ChaincodeHeaderExtension message. + * 2. The payload is a ChaincodeProposalPayload message. + * 3. The extension is a ChaincodeAction that might be used to ask the + * endorsers to endorse a specific ChaincodeAction, thus emulating the + * submitting peer model. + * + * @generated from message protos.Proposal + */ +export type Proposal = Message<"protos.Proposal"> & { + /** + * The header of the proposal. It is the bytes of the Header + * + * @generated from field: bytes header = 1; + */ + header: Uint8Array; + + /** + * The payload of the proposal as defined by the type in the proposal + * header. + * + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; + + /** + * Optional extensions to the proposal. Its content depends on the Header's + * type field. For the type CHAINCODE, it might be the bytes of a + * ChaincodeAction message. + * + * @generated from field: bytes extension = 3; + */ + extension: Uint8Array; +}; + +/** + * Describes the message protos.Proposal. + * Use `create(ProposalSchema)` to create a new message. + */ +export const ProposalSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal, 1); + +/** + * ChaincodeHeaderExtension is the Header's extentions message to be used when + * the Header's type is CHAINCODE. This extensions is used to specify which + * chaincode to invoke and what should appear on the ledger. + * + * @generated from message protos.ChaincodeHeaderExtension + */ +export type ChaincodeHeaderExtension = Message<"protos.ChaincodeHeaderExtension"> & { + /** + * The ID of the chaincode to target. + * + * @generated from field: protos.ChaincodeID chaincode_id = 2; + */ + chaincodeId?: ChaincodeID; +}; + +/** + * Describes the message protos.ChaincodeHeaderExtension. + * Use `create(ChaincodeHeaderExtensionSchema)` to create a new message. + */ +export const ChaincodeHeaderExtensionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal, 2); + +/** + * ChaincodeProposalPayload is the Proposal's payload message to be used when + * the Header's type is CHAINCODE. It contains the arguments for this + * invocation. + * + * @generated from message protos.ChaincodeProposalPayload + */ +export type ChaincodeProposalPayload = Message<"protos.ChaincodeProposalPayload"> & { + /** + * Input contains the arguments for this invocation. If this invocation + * deploys a new chaincode, ESCC/VSCC are part of this field. + * This is usually a marshaled ChaincodeInvocationSpec + * + * @generated from field: bytes input = 1; + */ + input: Uint8Array; + + /** + * TransientMap contains data (e.g. cryptographic material) that might be used + * to implement some form of application-level confidentiality. The contents + * of this field are supposed to always be omitted from the transaction and + * excluded from the ledger. + * + * @generated from field: map TransientMap = 2; + */ + TransientMap: { [key: string]: Uint8Array }; +}; + +/** + * Describes the message protos.ChaincodeProposalPayload. + * Use `create(ChaincodeProposalPayloadSchema)` to create a new message. + */ +export const ChaincodeProposalPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal, 3); + +/** + * ChaincodeAction contains the actions the events generated by the execution + * of the chaincode. + * + * @generated from message protos.ChaincodeAction + */ +export type ChaincodeAction = Message<"protos.ChaincodeAction"> & { + /** + * This field contains the read set and the write set produced by the + * chaincode executing this invocation. + * + * @generated from field: bytes results = 1; + */ + results: Uint8Array; + + /** + * This field contains the events generated by the chaincode executing this + * invocation. + * + * @generated from field: bytes events = 2; + */ + events: Uint8Array; + + /** + * This field contains the result of executing this invocation. + * + * @generated from field: protos.Response response = 3; + */ + response?: Response; + + /** + * This field contains the ChaincodeID of executing this invocation. Endorser + * will set it with the ChaincodeID called by endorser while simulating proposal. + * Committer will validate the version matching with latest chaincode version. + * Adding ChaincodeID to keep version opens up the possibility of multiple + * ChaincodeAction per transaction. + * + * @generated from field: protos.ChaincodeID chaincode_id = 4; + */ + chaincodeId?: ChaincodeID; +}; + +/** + * Describes the message protos.ChaincodeAction. + * Use `create(ChaincodeActionSchema)` to create a new message. + */ +export const ChaincodeActionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_response_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_response_pb.ts new file mode 100644 index 0000000000..84c54278b8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/proposal_response_pb.ts @@ -0,0 +1,192 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/proposal_response.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Timestamp } from "@bufbuild/protobuf/wkt"; +import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/proposal_response.proto. + */ +export const file_peer_proposal_response: GenFile = /*@__PURE__*/ + fileDesc("ChxwZWVyL3Byb3Bvc2FsX3Jlc3BvbnNlLnByb3RvEgZwcm90b3MisQEKEFByb3Bvc2FsUmVzcG9uc2USDwoHdmVyc2lvbhgBIAEoBRItCgl0aW1lc3RhbXAYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEiIKCHJlc3BvbnNlGAQgASgLMhAucHJvdG9zLlJlc3BvbnNlEg8KB3BheWxvYWQYBSABKAwSKAoLZW5kb3JzZW1lbnQYBiABKAsyEy5wcm90b3MuRW5kb3JzZW1lbnQiPAoIUmVzcG9uc2USDgoGc3RhdHVzGAEgASgFEg8KB21lc3NhZ2UYAiABKAkSDwoHcGF5bG9hZBgDIAEoDCJDChdQcm9wb3NhbFJlc3BvbnNlUGF5bG9hZBIVCg1wcm9wb3NhbF9oYXNoGAEgASgMEhEKCWV4dGVuc2lvbhgCIAEoDCIyCgtFbmRvcnNlbWVudBIQCghlbmRvcnNlchgBIAEoDBIRCglzaWduYXR1cmUYAiABKAxCawoib3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MucGVlckIXUHJvcG9zYWxSZXNwb25zZVBhY2thZ2VaLGdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9wZWVyYgZwcm90bzM", [file_google_protobuf_timestamp]); + +/** + * A ProposalResponse is returned from an endorser to the proposal submitter. + * The idea is that this message contains the endorser's response to the + * request of a client to perform an action over a chaincode (or more + * generically on the ledger); the response might be success/error (conveyed in + * the Response field) together with a description of the action and a + * signature over it by that endorser. If a sufficient number of distinct + * endorsers agree on the same action and produce signature to that effect, a + * transaction can be generated and sent for ordering. + * + * @generated from message protos.ProposalResponse + */ +export type ProposalResponse = Message<"protos.ProposalResponse"> & { + /** + * Version indicates message protocol version + * + * @generated from field: int32 version = 1; + */ + version: number; + + /** + * Timestamp is the time that the message + * was created as defined by the sender + * + * @generated from field: google.protobuf.Timestamp timestamp = 2; + */ + timestamp?: Timestamp; + + /** + * A response message indicating whether the + * endorsement of the action was successful + * + * @generated from field: protos.Response response = 4; + */ + response?: Response; + + /** + * The payload of response. It is the bytes of ProposalResponsePayload + * + * @generated from field: bytes payload = 5; + */ + payload: Uint8Array; + + /** + * The endorsement of the proposal, basically + * the endorser's signature over the payload + * + * @generated from field: protos.Endorsement endorsement = 6; + */ + endorsement?: Endorsement; +}; + +/** + * Describes the message protos.ProposalResponse. + * Use `create(ProposalResponseSchema)` to create a new message. + */ +export const ProposalResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal_response, 0); + +/** + * A response with a representation similar to an HTTP response that can + * be used within another message. + * + * @generated from message protos.Response + */ +export type Response = Message<"protos.Response"> & { + /** + * A status code that should follow the HTTP status codes. + * + * @generated from field: int32 status = 1; + */ + status: number; + + /** + * A message associated with the response code. + * + * @generated from field: string message = 2; + */ + message: string; + + /** + * A payload that can be used to include metadata with this response. + * + * @generated from field: bytes payload = 3; + */ + payload: Uint8Array; +}; + +/** + * Describes the message protos.Response. + * Use `create(ResponseSchema)` to create a new message. + */ +export const ResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal_response, 1); + +/** + * ProposalResponsePayload is the payload of a proposal response. This message + * is the "bridge" between the client's request and the endorser's action in + * response to that request. Concretely, for chaincodes, it contains a hashed + * representation of the proposal (proposalHash) and a representation of the + * chaincode state changes and events inside the extension field. + * + * @generated from message protos.ProposalResponsePayload + */ +export type ProposalResponsePayload = Message<"protos.ProposalResponsePayload"> & { + /** + * Hash of the proposal that triggered this response. The hash is used to + * link a response with its proposal, both for bookeeping purposes on an + * asynchronous system and for security reasons (accountability, + * non-repudiation). The hash usually covers the entire Proposal message + * (byte-by-byte). + * + * @generated from field: bytes proposal_hash = 1; + */ + proposalHash: Uint8Array; + + /** + * Extension should be unmarshaled to a type-specific message. The type of + * the extension in any proposal response depends on the type of the proposal + * that the client selected when the proposal was initially sent out. In + * particular, this information is stored in the type field of a Header. For + * chaincode, it's a ChaincodeAction message + * + * @generated from field: bytes extension = 2; + */ + extension: Uint8Array; +}; + +/** + * Describes the message protos.ProposalResponsePayload. + * Use `create(ProposalResponsePayloadSchema)` to create a new message. + */ +export const ProposalResponsePayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal_response, 2); + +/** + * An endorsement is a signature of an endorser over a proposal response. By + * producing an endorsement message, an endorser implicitly "approves" that + * proposal response and the actions contained therein. When enough + * endorsements have been collected, a transaction can be generated out of a + * set of proposal responses. Note that this message only contains an identity + * and a signature but no signed payload. This is intentional because + * endorsements are supposed to be collected in a transaction, and they are all + * expected to endorse a single proposal response/action (many endorsements + * over a single proposal response) + * + * @generated from message protos.Endorsement + */ +export type Endorsement = Message<"protos.Endorsement"> & { + /** + * Identity of the endorser (e.g. its certificate) + * + * @generated from field: bytes endorser = 1; + */ + endorser: Uint8Array; + + /** + * Signature of the payload included in ProposalResponse concatenated with + * the endorser's certificate; ie, sign(ProposalResponse.payload + endorser) + * + * @generated from field: bytes signature = 2; + */ + signature: Uint8Array; +}; + +/** + * Describes the message protos.Endorsement. + * Use `create(EndorsementSchema)` to create a new message. + */ +export const EndorsementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_proposal_response, 3); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/query_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/query_pb.ts new file mode 100644 index 0000000000..337448a684 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/query_pb.ts @@ -0,0 +1,147 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/query.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/query.proto. + */ +export const file_peer_query: GenFile = /*@__PURE__*/ + fileDesc("ChBwZWVyL3F1ZXJ5LnByb3RvEgZwcm90b3MiQwoWQ2hhaW5jb2RlUXVlcnlSZXNwb25zZRIpCgpjaGFpbmNvZGVzGAEgAygLMhUucHJvdG9zLkNoYWluY29kZUluZm8icwoNQ2hhaW5jb2RlSW5mbxIMCgRuYW1lGAEgASgJEg8KB3ZlcnNpb24YAiABKAkSDAoEcGF0aBgDIAEoCRINCgVpbnB1dBgEIAEoCRIMCgRlc2NjGAUgASgJEgwKBHZzY2MYBiABKAkSCgoCaWQYByABKAwiPQoUQ2hhbm5lbFF1ZXJ5UmVzcG9uc2USJQoIY2hhbm5lbHMYASADKAsyEy5wcm90b3MuQ2hhbm5lbEluZm8iIQoLQ2hhbm5lbEluZm8SEgoKY2hhbm5lbF9pZBgBIAEoCUJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z"); + +/** + * ChaincodeQueryResponse returns information about each chaincode that pertains + * to a query in lscc.go, such as GetChaincodes (returns all chaincodes + * instantiated on a channel), and GetInstalledChaincodes (returns all chaincodes + * installed on a peer) + * + * @generated from message protos.ChaincodeQueryResponse + */ +export type ChaincodeQueryResponse = Message<"protos.ChaincodeQueryResponse"> & { + /** + * @generated from field: repeated protos.ChaincodeInfo chaincodes = 1; + */ + chaincodes: ChaincodeInfo[]; +}; + +/** + * Describes the message protos.ChaincodeQueryResponse. + * Use `create(ChaincodeQueryResponseSchema)` to create a new message. + */ +export const ChaincodeQueryResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_query, 0); + +/** + * ChaincodeInfo contains general information about an installed/instantiated + * chaincode + * + * @generated from message protos.ChaincodeInfo + */ +export type ChaincodeInfo = Message<"protos.ChaincodeInfo"> & { + /** + * @generated from field: string name = 1; + */ + name: string; + + /** + * @generated from field: string version = 2; + */ + version: string; + + /** + * the path as specified by the install/instantiate transaction + * + * @generated from field: string path = 3; + */ + path: string; + + /** + * the chaincode function upon instantiation and its arguments. This will be + * blank if the query is returning information about installed chaincodes. + * + * @generated from field: string input = 4; + */ + input: string; + + /** + * the name of the ESCC for this chaincode. This will be + * blank if the query is returning information about installed chaincodes. + * + * @generated from field: string escc = 5; + */ + escc: string; + + /** + * the name of the VSCC for this chaincode. This will be + * blank if the query is returning information about installed chaincodes. + * + * @generated from field: string vscc = 6; + */ + vscc: string; + + /** + * the chaincode unique id. + * computed as: H( + * H(name || version) || + * H(CodePackage) + * ) + * + * @generated from field: bytes id = 7; + */ + id: Uint8Array; +}; + +/** + * Describes the message protos.ChaincodeInfo. + * Use `create(ChaincodeInfoSchema)` to create a new message. + */ +export const ChaincodeInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_query, 1); + +/** + * ChannelQueryResponse returns information about each channel that pertains + * to a query in lscc.go, such as GetChannels (returns all channels for a + * given peer) + * + * @generated from message protos.ChannelQueryResponse + */ +export type ChannelQueryResponse = Message<"protos.ChannelQueryResponse"> & { + /** + * @generated from field: repeated protos.ChannelInfo channels = 1; + */ + channels: ChannelInfo[]; +}; + +/** + * Describes the message protos.ChannelQueryResponse. + * Use `create(ChannelQueryResponseSchema)` to create a new message. + */ +export const ChannelQueryResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_query, 2); + +/** + * ChannelInfo contains general information about channels + * + * @generated from message protos.ChannelInfo + */ +export type ChannelInfo = Message<"protos.ChannelInfo"> & { + /** + * @generated from field: string channel_id = 1; + */ + channelId: string; +}; + +/** + * Describes the message protos.ChannelInfo. + * Use `create(ChannelInfoSchema)` to create a new message. + */ +export const ChannelInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_query, 3); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/resources_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/resources_pb.ts new file mode 100644 index 0000000000..e51428f104 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/resources_pb.ts @@ -0,0 +1,153 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/resources.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Config } from "../common/configtx_pb"; +import { file_common_configtx } from "../common/configtx_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/resources.proto. + */ +export const file_peer_resources: GenFile = /*@__PURE__*/ + fileDesc("ChRwZWVyL3Jlc291cmNlcy5wcm90bxIGcHJvdG9zIjQKE0NoYWluY29kZUlkZW50aWZpZXISDAoEaGFzaBgBIAEoDBIPCgd2ZXJzaW9uGAIgASgJIjUKE0NoYWluY29kZVZhbGlkYXRpb24SDAoEbmFtZRgBIAEoCRIQCghhcmd1bWVudBgCIAEoDCIqCghWU0NDQXJncxIeChZlbmRvcnNlbWVudF9wb2xpY3lfcmVmGAEgASgJIiQKFENoYWluY29kZUVuZG9yc2VtZW50EgwKBG5hbWUYASABKAkiXgoKQ29uZmlnVHJlZRImCg5jaGFubmVsX2NvbmZpZxgBIAEoCzIOLmNvbW1vbi5Db25maWcSKAoQcmVzb3VyY2VzX2NvbmZpZxgCIAEoCzIOLmNvbW1vbi5Db25maWdCUgoib3JnLmh5cGVybGVkZ2VyLmZhYnJpYy5wcm90b3MucGVlclosZ2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL3BlZXJiBnByb3RvMw", [file_common_configtx]); + +/** + * ChaincodeIdentifier identifies a piece of chaincode. For a peer to accept invocations of + * this chaincode, the hash of the installed code must match, as must the version string + * included with the install command. + * + * @generated from message protos.ChaincodeIdentifier + */ +export type ChaincodeIdentifier = Message<"protos.ChaincodeIdentifier"> & { + /** + * The hash of the chaincode bytes + * + * @generated from field: bytes hash = 1; + */ + hash: Uint8Array; + + /** + * A user friendly human readable name corresponding to the ID + * + * @generated from field: string version = 2; + */ + version: string; +}; + +/** + * Describes the message protos.ChaincodeIdentifier. + * Use `create(ChaincodeIdentifierSchema)` to create a new message. + */ +export const ChaincodeIdentifierSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_resources, 0); + +/** + * ChaincodeValidation instructs the peer how transactions for this chaincode should be + * validated. The only validation mechanism which ships with fabric today is the standard + * 'vscc' validation mechanism. This built in validation method utilizes an endorsement policy + * which checks that a sufficient number of signatures have been included. The 'arguement' + * field encodes any parameters required by the validation implementation. + * + * @generated from message protos.ChaincodeValidation + */ +export type ChaincodeValidation = Message<"protos.ChaincodeValidation"> & { + /** + * Specifies which code to run to validate transactions, defaults to 'vscc' + * + * @generated from field: string name = 1; + */ + name: string; + + /** + * When 'vscc' a marshaled VSCCArgs + * + * @generated from field: bytes argument = 2; + */ + argument: Uint8Array; +}; + +/** + * Describes the message protos.ChaincodeValidation. + * Use `create(ChaincodeValidationSchema)` to create a new message. + */ +export const ChaincodeValidationSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_resources, 1); + +/** + * VSCCArgs is passed (marshaled) as a parameter to the VSCC imlementation via the + * argument field of the ChaincodeValidation message. + * + * @generated from message protos.VSCCArgs + */ +export type VSCCArgs = Message<"protos.VSCCArgs"> & { + /** + * A named reference to an endorsement policy, + * + * @generated from field: string endorsement_policy_ref = 1; + */ + endorsementPolicyRef: string; +}; + +/** + * Describes the message protos.VSCCArgs. + * Use `create(VSCCArgsSchema)` to create a new message. + */ +export const VSCCArgsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_resources, 2); + +/** + * ChaincodeEndorsement instructs the peer how transactions should be endorsed. The only + * endorsement mechanism which ships with the fabric today is the standard 'escc' mechanism. + * This code simply simulates the proposal to generate a RW set, then signs the result + * using the peer's local signing identity. + * + * @generated from message protos.ChaincodeEndorsement + */ +export type ChaincodeEndorsement = Message<"protos.ChaincodeEndorsement"> & { + /** + * Specifies what code to run for endorsements, defaults 'escc' + * + * @generated from field: string name = 1; + */ + name: string; +}; + +/** + * Describes the message protos.ChaincodeEndorsement. + * Use `create(ChaincodeEndorsementSchema)` to create a new message. + */ +export const ChaincodeEndorsementSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_resources, 3); + +/** + * ConfigTree encapsulates channel and resources configuration of a channel. + * Both configurations are represented as common.Config + * + * @generated from message protos.ConfigTree + */ +export type ConfigTree = Message<"protos.ConfigTree"> & { + /** + * @generated from field: common.Config channel_config = 1; + */ + channelConfig?: Config; + + /** + * @generated from field: common.Config resources_config = 2; + */ + resourcesConfig?: Config; +}; + +/** + * Describes the message protos.ConfigTree. + * Use `create(ConfigTreeSchema)` to create a new message. + */ +export const ConfigTreeSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_resources, 4); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/signed_cc_dep_spec_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/signed_cc_dep_spec_pb.ts new file mode 100644 index 0000000000..ec0bf79d86 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/signed_cc_dep_spec_pb.ts @@ -0,0 +1,60 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/signed_cc_dep_spec.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Endorsement } from "./proposal_response_pb"; +import { file_peer_proposal_response } from "./proposal_response_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/signed_cc_dep_spec.proto. + */ +export const file_peer_signed_cc_dep_spec: GenFile = /*@__PURE__*/ + fileDesc("Ch1wZWVyL3NpZ25lZF9jY19kZXBfc3BlYy5wcm90bxIGcHJvdG9zIpEBCh1TaWduZWRDaGFpbmNvZGVEZXBsb3ltZW50U3BlYxIhChljaGFpbmNvZGVfZGVwbG95bWVudF9zcGVjGAEgASgMEhwKFGluc3RhbnRpYXRpb25fcG9saWN5GAIgASgMEi8KEm93bmVyX2VuZG9yc2VtZW50cxgDIAMoCzITLnByb3Rvcy5FbmRvcnNlbWVudEJSCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyWixnaXRodWIuY29tL2h5cGVybGVkZ2VyL2ZhYnJpYy1wcm90b3MtZ28vcGVlcmIGcHJvdG8z", [file_peer_proposal_response]); + +/** + * SignedChaincodeDeploymentSpec carries the CDS along with endorsements + * + * @generated from message protos.SignedChaincodeDeploymentSpec + */ +export type SignedChaincodeDeploymentSpec = Message<"protos.SignedChaincodeDeploymentSpec"> & { + /** + * This is the bytes of the ChaincodeDeploymentSpec + * + * @generated from field: bytes chaincode_deployment_spec = 1; + */ + chaincodeDeploymentSpec: Uint8Array; + + /** + * This is the instantiation policy which is identical in structure + * to endorsement policy. This policy is checked by the VSCC at commit + * time on the instantiation (all peers will get the same policy as it + * will be part of the LSCC instantation record and will be part of the + * hash as well) + * + * @generated from field: bytes instantiation_policy = 2; + */ + instantiationPolicy: Uint8Array; + + /** + * The endorsements of the above deployment spec, the owner's signature over + * chaincode_deployment_spec and Endorsement.endorser. + * + * @generated from field: repeated protos.Endorsement owner_endorsements = 3; + */ + ownerEndorsements: Endorsement[]; +}; + +/** + * Describes the message protos.SignedChaincodeDeploymentSpec. + * Use `create(SignedChaincodeDeploymentSpecSchema)` to create a new message. + */ +export const SignedChaincodeDeploymentSpecSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_signed_cc_dep_spec, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/transaction_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/transaction_pb.ts new file mode 100644 index 0000000000..1fb53834ed --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/peer/transaction_pb.ts @@ -0,0 +1,362 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file peer/transaction.proto (package protos, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { enumDesc, fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { Endorsement } from "./proposal_response_pb"; +import { file_peer_proposal_response } from "./proposal_response_pb"; +import type { Envelope } from "../common/common_pb"; +import { file_common_common } from "../common/common_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file peer/transaction.proto. + */ +export const file_peer_transaction: GenFile = /*@__PURE__*/ + fileDesc("ChZwZWVyL3RyYW5zYWN0aW9uLnByb3RvEgZwcm90b3MiXQoUUHJvY2Vzc2VkVHJhbnNhY3Rpb24SLQoTdHJhbnNhY3Rpb25FbnZlbG9wZRgBIAEoCzIQLmNvbW1vbi5FbnZlbG9wZRIWCg52YWxpZGF0aW9uQ29kZRgCIAEoBSI5CgtUcmFuc2FjdGlvbhIqCgdhY3Rpb25zGAEgAygLMhkucHJvdG9zLlRyYW5zYWN0aW9uQWN0aW9uIjQKEVRyYW5zYWN0aW9uQWN0aW9uEg4KBmhlYWRlchgBIAEoDBIPCgdwYXlsb2FkGAIgASgMIm0KFkNoYWluY29kZUFjdGlvblBheWxvYWQSIgoaY2hhaW5jb2RlX3Byb3Bvc2FsX3BheWxvYWQYASABKAwSLwoGYWN0aW9uGAIgASgLMh8ucHJvdG9zLkNoYWluY29kZUVuZG9yc2VkQWN0aW9uImcKF0NoYWluY29kZUVuZG9yc2VkQWN0aW9uEiEKGXByb3Bvc2FsX3Jlc3BvbnNlX3BheWxvYWQYASABKAwSKQoMZW5kb3JzZW1lbnRzGAIgAygLMhMucHJvdG9zLkVuZG9yc2VtZW50KqsFChBUeFZhbGlkYXRpb25Db2RlEgkKBVZBTElEEAASEAoMTklMX0VOVkVMT1BFEAESDwoLQkFEX1BBWUxPQUQQAhIVChFCQURfQ09NTU9OX0hFQURFUhADEhkKFUJBRF9DUkVBVE9SX1NJR05BVFVSRRAEEiAKHElOVkFMSURfRU5ET1JTRVJfVFJBTlNBQ1RJT04QBRIeChpJTlZBTElEX0NPTkZJR19UUkFOU0FDVElPThAGEhoKFlVOU1VQUE9SVEVEX1RYX1BBWUxPQUQQBxIVChFCQURfUFJPUE9TQUxfVFhJRBAIEhIKDkRVUExJQ0FURV9UWElEEAkSHgoaRU5ET1JTRU1FTlRfUE9MSUNZX0ZBSUxVUkUQChIWChJNVkNDX1JFQURfQ09ORkxJQ1QQCxIZChVQSEFOVE9NX1JFQURfQ09ORkxJQ1QQDBITCg9VTktOT1dOX1RYX1RZUEUQDRIaChZUQVJHRVRfQ0hBSU5fTk9UX0ZPVU5EEA4SFAoQTUFSU0hBTF9UWF9FUlJPUhAPEhAKDE5JTF9UWEFDVElPThAQEhUKEUVYUElSRURfQ0hBSU5DT0RFEBESHgoaQ0hBSU5DT0RFX1ZFUlNJT05fQ09ORkxJQ1QQEhIYChRCQURfSEVBREVSX0VYVEVOU0lPThATEhYKEkJBRF9DSEFOTkVMX0hFQURFUhAUEhgKFEJBRF9SRVNQT05TRV9QQVlMT0FEEBUSDQoJQkFEX1JXU0VUEBYSFAoQSUxMRUdBTF9XUklURVNFVBAXEhQKEElOVkFMSURfV1JJVEVTRVQQGBIVChFJTlZBTElEX0NIQUlOQ09ERRAZEhIKDU5PVF9WQUxJREFURUQQ/gESGQoUSU5WQUxJRF9PVEhFUl9SRUFTT04Q/wEqRQoMTWV0YURhdGFLZXlzEhgKFFZBTElEQVRJT05fUEFSQU1FVEVSEAASGwoXVkFMSURBVElPTl9QQVJBTUVURVJfVjIQAUJmCiJvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy5wZWVyQhJUcmFuc2FjdGlvblBhY2thZ2VaLGdpdGh1Yi5jb20vaHlwZXJsZWRnZXIvZmFicmljLXByb3Rvcy1nby9wZWVyYgZwcm90bzM", [file_peer_proposal_response, file_common_common]); + +/** + * ProcessedTransaction wraps an Envelope that includes a transaction along with an indication + * of whether the transaction was validated or invalidated by committing peer. + * The use case is that GetTransactionByID API needs to retrieve the transaction Envelope + * from block storage, and return it to a client, and indicate whether the transaction + * was validated or invalidated by committing peer. So that the originally submitted + * transaction Envelope is not modified, the ProcessedTransaction wrapper is returned. + * + * @generated from message protos.ProcessedTransaction + */ +export type ProcessedTransaction = Message<"protos.ProcessedTransaction"> & { + /** + * An Envelope which includes a processed transaction + * + * @generated from field: common.Envelope transactionEnvelope = 1; + */ + transactionEnvelope?: Envelope; + + /** + * An indication of whether the transaction was validated or invalidated by committing peer + * + * @generated from field: int32 validationCode = 2; + */ + validationCode: number; +}; + +/** + * Describes the message protos.ProcessedTransaction. + * Use `create(ProcessedTransactionSchema)` to create a new message. + */ +export const ProcessedTransactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_transaction, 0); + +/** + * The transaction to be sent to the ordering service. A transaction contains + * one or more TransactionAction. Each TransactionAction binds a proposal to + * potentially multiple actions. The transaction is atomic meaning that either + * all actions in the transaction will be committed or none will. Note that + * while a Transaction might include more than one Header, the Header.creator + * field must be the same in each. + * A single client is free to issue a number of independent Proposal, each with + * their header (Header) and request payload (ChaincodeProposalPayload). Each + * proposal is independently endorsed generating an action + * (ProposalResponsePayload) with one signature per Endorser. Any number of + * independent proposals (and their action) might be included in a transaction + * to ensure that they are treated atomically. + * + * @generated from message protos.Transaction + */ +export type Transaction = Message<"protos.Transaction"> & { + /** + * The payload is an array of TransactionAction. An array is necessary to + * accommodate multiple actions per transaction + * + * @generated from field: repeated protos.TransactionAction actions = 1; + */ + actions: TransactionAction[]; +}; + +/** + * Describes the message protos.Transaction. + * Use `create(TransactionSchema)` to create a new message. + */ +export const TransactionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_transaction, 1); + +/** + * TransactionAction binds a proposal to its action. The type field in the + * header dictates the type of action to be applied to the ledger. + * + * @generated from message protos.TransactionAction + */ +export type TransactionAction = Message<"protos.TransactionAction"> & { + /** + * The header of the proposal action, which is the proposal header + * + * @generated from field: bytes header = 1; + */ + header: Uint8Array; + + /** + * The payload of the action as defined by the type in the header For + * chaincode, it's the bytes of ChaincodeActionPayload + * + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; +}; + +/** + * Describes the message protos.TransactionAction. + * Use `create(TransactionActionSchema)` to create a new message. + */ +export const TransactionActionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_transaction, 2); + +/** + * ChaincodeActionPayload is the message to be used for the TransactionAction's + * payload when the Header's type is set to CHAINCODE. It carries the + * chaincodeProposalPayload and an endorsed action to apply to the ledger. + * + * @generated from message protos.ChaincodeActionPayload + */ +export type ChaincodeActionPayload = Message<"protos.ChaincodeActionPayload"> & { + /** + * This field contains the bytes of the ChaincodeProposalPayload message from + * the original invocation (essentially the arguments) after the application + * of the visibility function. The main visibility modes are "full" (the + * entire ChaincodeProposalPayload message is included here), "hash" (only + * the hash of the ChaincodeProposalPayload message is included) or + * "nothing". This field will be used to check the consistency of + * ProposalResponsePayload.proposalHash. For the CHAINCODE type, + * ProposalResponsePayload.proposalHash is supposed to be H(ProposalHeader || + * f(ChaincodeProposalPayload)) where f is the visibility function. + * + * @generated from field: bytes chaincode_proposal_payload = 1; + */ + chaincodeProposalPayload: Uint8Array; + + /** + * The list of actions to apply to the ledger + * + * @generated from field: protos.ChaincodeEndorsedAction action = 2; + */ + action?: ChaincodeEndorsedAction; +}; + +/** + * Describes the message protos.ChaincodeActionPayload. + * Use `create(ChaincodeActionPayloadSchema)` to create a new message. + */ +export const ChaincodeActionPayloadSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_transaction, 3); + +/** + * ChaincodeEndorsedAction carries information about the endorsement of a + * specific proposal + * + * @generated from message protos.ChaincodeEndorsedAction + */ +export type ChaincodeEndorsedAction = Message<"protos.ChaincodeEndorsedAction"> & { + /** + * This is the bytes of the ProposalResponsePayload message signed by the + * endorsers. Recall that for the CHAINCODE type, the + * ProposalResponsePayload's extenstion field carries a ChaincodeAction + * + * @generated from field: bytes proposal_response_payload = 1; + */ + proposalResponsePayload: Uint8Array; + + /** + * The endorsement of the proposal, basically the endorser's signature over + * proposalResponsePayload + * + * @generated from field: repeated protos.Endorsement endorsements = 2; + */ + endorsements: Endorsement[]; +}; + +/** + * Describes the message protos.ChaincodeEndorsedAction. + * Use `create(ChaincodeEndorsedActionSchema)` to create a new message. + */ +export const ChaincodeEndorsedActionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_peer_transaction, 4); + +/** + * @generated from enum protos.TxValidationCode + */ +export enum TxValidationCode { + /** + * @generated from enum value: VALID = 0; + */ + VALID = 0, + + /** + * @generated from enum value: NIL_ENVELOPE = 1; + */ + NIL_ENVELOPE = 1, + + /** + * @generated from enum value: BAD_PAYLOAD = 2; + */ + BAD_PAYLOAD = 2, + + /** + * @generated from enum value: BAD_COMMON_HEADER = 3; + */ + BAD_COMMON_HEADER = 3, + + /** + * @generated from enum value: BAD_CREATOR_SIGNATURE = 4; + */ + BAD_CREATOR_SIGNATURE = 4, + + /** + * @generated from enum value: INVALID_ENDORSER_TRANSACTION = 5; + */ + INVALID_ENDORSER_TRANSACTION = 5, + + /** + * @generated from enum value: INVALID_CONFIG_TRANSACTION = 6; + */ + INVALID_CONFIG_TRANSACTION = 6, + + /** + * @generated from enum value: UNSUPPORTED_TX_PAYLOAD = 7; + */ + UNSUPPORTED_TX_PAYLOAD = 7, + + /** + * @generated from enum value: BAD_PROPOSAL_TXID = 8; + */ + BAD_PROPOSAL_TXID = 8, + + /** + * @generated from enum value: DUPLICATE_TXID = 9; + */ + DUPLICATE_TXID = 9, + + /** + * @generated from enum value: ENDORSEMENT_POLICY_FAILURE = 10; + */ + ENDORSEMENT_POLICY_FAILURE = 10, + + /** + * @generated from enum value: MVCC_READ_CONFLICT = 11; + */ + MVCC_READ_CONFLICT = 11, + + /** + * @generated from enum value: PHANTOM_READ_CONFLICT = 12; + */ + PHANTOM_READ_CONFLICT = 12, + + /** + * @generated from enum value: UNKNOWN_TX_TYPE = 13; + */ + UNKNOWN_TX_TYPE = 13, + + /** + * @generated from enum value: TARGET_CHAIN_NOT_FOUND = 14; + */ + TARGET_CHAIN_NOT_FOUND = 14, + + /** + * @generated from enum value: MARSHAL_TX_ERROR = 15; + */ + MARSHAL_TX_ERROR = 15, + + /** + * @generated from enum value: NIL_TXACTION = 16; + */ + NIL_TXACTION = 16, + + /** + * @generated from enum value: EXPIRED_CHAINCODE = 17; + */ + EXPIRED_CHAINCODE = 17, + + /** + * @generated from enum value: CHAINCODE_VERSION_CONFLICT = 18; + */ + CHAINCODE_VERSION_CONFLICT = 18, + + /** + * @generated from enum value: BAD_HEADER_EXTENSION = 19; + */ + BAD_HEADER_EXTENSION = 19, + + /** + * @generated from enum value: BAD_CHANNEL_HEADER = 20; + */ + BAD_CHANNEL_HEADER = 20, + + /** + * @generated from enum value: BAD_RESPONSE_PAYLOAD = 21; + */ + BAD_RESPONSE_PAYLOAD = 21, + + /** + * @generated from enum value: BAD_RWSET = 22; + */ + BAD_RWSET = 22, + + /** + * @generated from enum value: ILLEGAL_WRITESET = 23; + */ + ILLEGAL_WRITESET = 23, + + /** + * @generated from enum value: INVALID_WRITESET = 24; + */ + INVALID_WRITESET = 24, + + /** + * @generated from enum value: INVALID_CHAINCODE = 25; + */ + INVALID_CHAINCODE = 25, + + /** + * @generated from enum value: NOT_VALIDATED = 254; + */ + NOT_VALIDATED = 254, + + /** + * @generated from enum value: INVALID_OTHER_REASON = 255; + */ + INVALID_OTHER_REASON = 255, +} + +/** + * Describes the enum protos.TxValidationCode. + */ +export const TxValidationCodeSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_peer_transaction, 0); + +/** + * Reserved entries in the key-level metadata map + * + * @generated from enum protos.MetaDataKeys + */ +export enum MetaDataKeys { + /** + * @generated from enum value: VALIDATION_PARAMETER = 0; + */ + VALIDATION_PARAMETER = 0, + + /** + * @generated from enum value: VALIDATION_PARAMETER_V2 = 1; + */ + VALIDATION_PARAMETER_V2 = 1, +} + +/** + * Describes the enum protos.MetaDataKeys. + */ +export const MetaDataKeysSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_peer_transaction, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_connect.ts new file mode 100644 index 0000000000..fedf516ba4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_connect.ts @@ -0,0 +1,60 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file relay/datatransfer.proto (package relay.datatransfer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Query } from "../common/query_pb.js"; +import { Ack } from "../common/ack_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; +import { ViewPayload } from "../common/state_pb.js"; + +/** + * definitions of all messages used in the datatransfer protocol + * + * @generated from service relay.datatransfer.DataTransfer + */ +export const DataTransfer = { + typeName: "relay.datatransfer.DataTransfer", + methods: { + /** + * the requesting relay sends a RequestState request to the remote relay with a + * query defining the data it wants to receive + * + * @generated from rpc relay.datatransfer.DataTransfer.RequestState + */ + requestState: { + name: "RequestState", + I: Query, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * the remote relay asynchronously sends back the requested data with + * SendState + * + * @generated from rpc relay.datatransfer.DataTransfer.SendState + */ + sendState: { + name: "SendState", + I: ViewPayload, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * Handling state sent from the driver. + * + * @generated from rpc relay.datatransfer.DataTransfer.SendDriverState + */ + sendDriverState: { + name: "SendDriverState", + I: ViewPayload, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_pb.ts new file mode 100644 index 0000000000..f582af5b0d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/datatransfer_pb.ts @@ -0,0 +1,64 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file relay/datatransfer.proto (package relay.datatransfer, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { AckSchema } from "../common/ack_pb"; +import { file_common_ack } from "../common/ack_pb"; +import type { ViewPayloadSchema } from "../common/state_pb"; +import { file_common_state } from "../common/state_pb"; +import type { QuerySchema } from "../common/query_pb"; +import { file_common_query } from "../common/query_pb"; + +/** + * Describes the file relay/datatransfer.proto. + */ +export const file_relay_datatransfer: GenFile = /*@__PURE__*/ + fileDesc("ChhyZWxheS9kYXRhdHJhbnNmZXIucHJvdG8SEnJlbGF5LmRhdGF0cmFuc2ZlcjLCAQoMRGF0YVRyYW5zZmVyEjYKDFJlcXVlc3RTdGF0ZRITLmNvbW1vbi5xdWVyeS5RdWVyeRoPLmNvbW1vbi5hY2suQWNrIgASOQoJU2VuZFN0YXRlEhkuY29tbW9uLnN0YXRlLlZpZXdQYXlsb2FkGg8uY29tbW9uLmFjay5BY2siABI/Cg9TZW5kRHJpdmVyU3RhdGUSGS5jb21tb24uc3RhdGUuVmlld1BheWxvYWQaDy5jb21tb24uYWNrLkFjayIAQn0KNm9yZy5oeXBlcmxlZGdlci5jYWN0aS53ZWF2ZXIucHJvdG9zLnJlbGF5LmRhdGF0cmFuc2ZlclpDZ2l0aHViLmNvbS9oeXBlcmxlZGdlci1jYWN0aS9jYWN0aS93ZWF2ZXIvY29tbW9uL3Byb3Rvcy1nby92Mi9yZWxheWIGcHJvdG8z", [file_common_ack, file_common_state, file_common_query]); + +/** + * definitions of all messages used in the datatransfer protocol + * + * @generated from service relay.datatransfer.DataTransfer + */ +export const DataTransfer: GenService<{ + /** + * the requesting relay sends a RequestState request to the remote relay with a + * query defining the data it wants to receive + * + * @generated from rpc relay.datatransfer.DataTransfer.RequestState + */ + requestState: { + methodKind: "unary"; + input: typeof QuerySchema; + output: typeof AckSchema; + }, + /** + * the remote relay asynchronously sends back the requested data with + * SendState + * + * @generated from rpc relay.datatransfer.DataTransfer.SendState + */ + sendState: { + methodKind: "unary"; + input: typeof ViewPayloadSchema; + output: typeof AckSchema; + }, + /** + * Handling state sent from the driver. + * + * @generated from rpc relay.datatransfer.DataTransfer.SendDriverState + */ + sendDriverState: { + methodKind: "unary"; + input: typeof ViewPayloadSchema; + output: typeof AckSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_relay_datatransfer, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_connect.ts new file mode 100644 index 0000000000..9efe00b6a8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_connect.ts @@ -0,0 +1,89 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file relay/events.proto (package relay.events, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { EventSubscription } from "../common/events_pb.js"; +import { Ack } from "../common/ack_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; +import { ViewPayload } from "../common/state_pb.js"; + +/** + * @generated from service relay.events.EventSubscribe + */ +export const EventSubscribe = { + typeName: "relay.events.EventSubscribe", + methods: { + /** + * the dest-relay forwards the request from client as EventSubscription to the src-relay + * + * @generated from rpc relay.events.EventSubscribe.SubscribeEvent + */ + subscribeEvent: { + name: "SubscribeEvent", + I: EventSubscription, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * Src-relay based upon query (EventSubscription) forwards the same response (Ack) + * from driver to the dest-relay by calling a new endpoint in dest-relay + * + * @generated from rpc relay.events.EventSubscribe.SendSubscriptionStatus + */ + sendSubscriptionStatus: { + name: "SendSubscriptionStatus", + I: Ack, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * Src-driver status of event subscription (Ack) + * to the src-relay by calling a new endpoint in src-relay + * + * @generated from rpc relay.events.EventSubscribe.SendDriverSubscriptionStatus + */ + sendDriverSubscriptionStatus: { + name: "SendDriverSubscriptionStatus", + I: Ack, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + +/** + * @generated from service relay.events.EventPublish + */ +export const EventPublish = { + typeName: "relay.events.EventPublish", + methods: { + /** + * src-driver forwards the state as part of event subscription to src-relay + * + * @generated from rpc relay.events.EventPublish.SendDriverState + */ + sendDriverState: { + name: "SendDriverState", + I: ViewPayload, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * src-relay will forward the state as part of event subscription to dest-relay + * + * @generated from rpc relay.events.EventPublish.SendState + */ + sendState: { + name: "SendState", + I: ViewPayload, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_pb.ts new file mode 100644 index 0000000000..91bf1836c6 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/events_pb.ts @@ -0,0 +1,89 @@ +// Copyright IBM Corp. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file relay/events.proto (package relay.events, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { AckSchema } from "../common/ack_pb"; +import { file_common_ack } from "../common/ack_pb"; +import type { EventSubscriptionSchema } from "../common/events_pb"; +import { file_common_events } from "../common/events_pb"; +import type { ViewPayloadSchema } from "../common/state_pb"; +import { file_common_state } from "../common/state_pb"; + +/** + * Describes the file relay/events.proto. + */ +export const file_relay_events: GenFile = /*@__PURE__*/ + fileDesc("ChJyZWxheS9ldmVudHMucHJvdG8SDHJlbGF5LmV2ZW50czLZAQoORXZlbnRTdWJzY3JpYmUSRQoOU3Vic2NyaWJlRXZlbnQSIC5jb21tb24uZXZlbnRzLkV2ZW50U3Vic2NyaXB0aW9uGg8uY29tbW9uLmFjay5BY2siABI8ChZTZW5kU3Vic2NyaXB0aW9uU3RhdHVzEg8uY29tbW9uLmFjay5BY2saDy5jb21tb24uYWNrLkFjayIAEkIKHFNlbmREcml2ZXJTdWJzY3JpcHRpb25TdGF0dXMSDy5jb21tb24uYWNrLkFjaxoPLmNvbW1vbi5hY2suQWNrIgAyigEKDEV2ZW50UHVibGlzaBI/Cg9TZW5kRHJpdmVyU3RhdGUSGS5jb21tb24uc3RhdGUuVmlld1BheWxvYWQaDy5jb21tb24uYWNrLkFjayIAEjkKCVNlbmRTdGF0ZRIZLmNvbW1vbi5zdGF0ZS5WaWV3UGF5bG9hZBoPLmNvbW1vbi5hY2suQWNrIgBCdwowb3JnLmh5cGVybGVkZ2VyLmNhY3RpLndlYXZlci5wcm90b3MucmVsYXkuZXZlbnRzWkNnaXRodWIuY29tL2h5cGVybGVkZ2VyLWNhY3RpL2NhY3RpL3dlYXZlci9jb21tb24vcHJvdG9zLWdvL3YyL3JlbGF5YgZwcm90bzM", [file_common_ack, file_common_events, file_common_state]); + +/** + * @generated from service relay.events.EventSubscribe + */ +export const EventSubscribe: GenService<{ + /** + * the dest-relay forwards the request from client as EventSubscription to the src-relay + * + * @generated from rpc relay.events.EventSubscribe.SubscribeEvent + */ + subscribeEvent: { + methodKind: "unary"; + input: typeof EventSubscriptionSchema; + output: typeof AckSchema; + }, + /** + * Src-relay based upon query (EventSubscription) forwards the same response (Ack) + * from driver to the dest-relay by calling a new endpoint in dest-relay + * + * @generated from rpc relay.events.EventSubscribe.SendSubscriptionStatus + */ + sendSubscriptionStatus: { + methodKind: "unary"; + input: typeof AckSchema; + output: typeof AckSchema; + }, + /** + * Src-driver status of event subscription (Ack) + * to the src-relay by calling a new endpoint in src-relay + * + * @generated from rpc relay.events.EventSubscribe.SendDriverSubscriptionStatus + */ + sendDriverSubscriptionStatus: { + methodKind: "unary"; + input: typeof AckSchema; + output: typeof AckSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_relay_events, 0); + +/** + * @generated from service relay.events.EventPublish + */ +export const EventPublish: GenService<{ + /** + * src-driver forwards the state as part of event subscription to src-relay + * + * @generated from rpc relay.events.EventPublish.SendDriverState + */ + sendDriverState: { + methodKind: "unary"; + input: typeof ViewPayloadSchema; + output: typeof AckSchema; + }, + /** + * src-relay will forward the state as part of event subscription to dest-relay + * + * @generated from rpc relay.events.EventPublish.SendState + */ + sendState: { + methodKind: "unary"; + input: typeof ViewPayloadSchema; + output: typeof AckSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_relay_events, 1); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_connect.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_connect.ts new file mode 100644 index 0000000000..bfcbe669ba --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_connect.ts @@ -0,0 +1,147 @@ +// @generated by protoc-gen-connect-es v1.6.1 with parameter "target=ts,js_import_style=module" +// @generated from file relay/satp.proto (package relay.satp, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { AckCommenceRequest, AckFinalReceiptRequest, CommitFinalAssertionRequest, CommitPrepareRequest, CommitReadyRequest, LockAssertionReceiptRequest, LockAssertionRequest, SendAssetStatusRequest, TransferCommenceRequest, TransferCompletedRequest, TransferProposalClaimsRequest, TransferProposalReceiptRequest } from "./satp_pb.js"; +import { Ack } from "../common/ack_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Stage 1 endpoints + * + * @generated from service relay.satp.SATP + */ +export const SATP = { + typeName: "relay.satp.SATP", + methods: { + /** + * The sender gateway sends a TransferProposalClaims request to initiate an asset transfer. + * Depending on the proposal, multiple rounds of communication between the two gateways may happen. + * + * @generated from rpc relay.satp.SATP.TransferProposalClaims + */ + transferProposalClaims: { + name: "TransferProposalClaims", + I: TransferProposalClaimsRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * The sender gateway sends a TransferProposalClaims request to signal to the receiver gateway + * that the it is ready to start the transfer of the digital asset + * + * @generated from rpc relay.satp.SATP.TransferProposalReceipt + */ + transferProposalReceipt: { + name: "TransferProposalReceipt", + I: TransferProposalReceiptRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * The sender gateway sends a TransferCommence request to signal to the receiver gateway + * that the it is ready to start the transfer of the digital asset + * + * @generated from rpc relay.satp.SATP.TransferCommence + */ + transferCommence: { + name: "TransferCommence", + I: TransferCommenceRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * The receiver gateway sends a AckCommence request to the sender gateway to indicate agreement + * to proceed with the asset transfe + * + * @generated from rpc relay.satp.SATP.AckCommence + */ + ackCommence: { + name: "AckCommence", + I: AckCommenceRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.SendAssetStatus + */ + sendAssetStatus: { + name: "SendAssetStatus", + I: SendAssetStatusRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * The sender gateway sends a LockAssertion request to convey a signed claim to the receiver gateway + * declaring that the asset in question has been locked or escrowed by the sender gateway in + * the origin network (e.g. to prevent double spending) + * + * @generated from rpc relay.satp.SATP.LockAssertion + */ + lockAssertion: { + name: "LockAssertion", + I: LockAssertionRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * The receiver gateway sends a LockAssertionReceipt request to the sender gateway to indicate acceptance + * of the claim(s) delivered by the sender gateway in the previous message + * + * @generated from rpc relay.satp.SATP.LockAssertionReceipt + */ + lockAssertionReceipt: { + name: "LockAssertionReceipt", + I: LockAssertionReceiptRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.CommitPrepare + */ + commitPrepare: { + name: "CommitPrepare", + I: CommitPrepareRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.CommitReady + */ + commitReady: { + name: "CommitReady", + I: CommitReadyRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.CommitFinalAssertion + */ + commitFinalAssertion: { + name: "CommitFinalAssertion", + I: CommitFinalAssertionRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.AckFinalReceipt + */ + ackFinalReceipt: { + name: "AckFinalReceipt", + I: AckFinalReceiptRequest, + O: Ack, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc relay.satp.SATP.TransferCompleted + */ + transferCompleted: { + name: "TransferCompleted", + I: TransferCompletedRequest, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_pb.ts new file mode 100644 index 0000000000..fe88a0b28b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/relay/satp_pb.ts @@ -0,0 +1,714 @@ +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file relay/satp.proto (package relay.satp, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import type { AckSchema } from "../common/ack_pb"; +import { file_common_ack } from "../common/ack_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file relay/satp.proto. + */ +export const file_relay_satp: GenFile = /*@__PURE__*/ + fileDesc("ChByZWxheS9zYXRwLnByb3RvEgpyZWxheS5zYXRwIroDCh1UcmFuc2ZlclByb3Bvc2FsQ2xhaW1zUmVxdWVzdBIUCgxtZXNzYWdlX3R5cGUYASABKAkSFgoOYXNzZXRfYXNzZXRfaWQYAiABKAkSGAoQYXNzZXRfcHJvZmlsZV9pZBgDIAEoCRIlCh12ZXJpZmllZF9vcmlnaW5hdG9yX2VudGl0eV9pZBgEIAEoCRImCh52ZXJpZmllZF9iZW5lZmljaWFyeV9lbnRpdHlfaWQYBSABKAkSGQoRb3JpZ2luYXRvcl9wdWJrZXkYBiABKAkSGgoSYmVuZWZpY2lhcnlfcHVia2V5GAcgASgJEiEKGXNlbmRlcl9nYXRld2F5X25ldHdvcmtfaWQYCCABKAkSJAoccmVjaXBpZW50X2dhdGV3YXlfbmV0d29ya19pZBgJIAEoCRIeChZjbGllbnRfaWRlbnRpdHlfcHVia2V5GAogASgJEh4KFnNlcnZlcl9pZGVudGl0eV9wdWJrZXkYCyABKAkSHwoXc2VuZGVyX2dhdGV3YXlfb3duZXJfaWQYDCABKAkSIQoZcmVjZWl2ZXJfZ2F0ZXdheV9vd25lcl9pZBgNIAEoCSK7AwoeVHJhbnNmZXJQcm9wb3NhbFJlY2VpcHRSZXF1ZXN0EhQKDG1lc3NhZ2VfdHlwZRgBIAEoCRIWCg5hc3NldF9hc3NldF9pZBgCIAEoCRIYChBhc3NldF9wcm9maWxlX2lkGAMgASgJEiUKHXZlcmlmaWVkX29yaWdpbmF0b3JfZW50aXR5X2lkGAQgASgJEiYKHnZlcmlmaWVkX2JlbmVmaWNpYXJ5X2VudGl0eV9pZBgFIAEoCRIZChFvcmlnaW5hdG9yX3B1YmtleRgGIAEoCRIaChJiZW5lZmljaWFyeV9wdWJrZXkYByABKAkSIQoZc2VuZGVyX2dhdGV3YXlfbmV0d29ya19pZBgIIAEoCRIkChxyZWNpcGllbnRfZ2F0ZXdheV9uZXR3b3JrX2lkGAkgASgJEh4KFmNsaWVudF9pZGVudGl0eV9wdWJrZXkYCiABKAkSHgoWc2VydmVyX2lkZW50aXR5X3B1YmtleRgLIAEoCRIfChdzZW5kZXJfZ2F0ZXdheV9vd25lcl9pZBgMIAEoCRIhChlyZWNlaXZlcl9nYXRld2F5X293bmVyX2lkGA0gASgJIpgCChdUcmFuc2ZlckNvbW1lbmNlUmVxdWVzdBIUCgxtZXNzYWdlX3R5cGUYASABKAkSEgoKc2Vzc2lvbl9pZBgCIAEoCRIbChN0cmFuc2Zlcl9jb250ZXh0X2lkGAMgASgJEh4KFmNsaWVudF9pZGVudGl0eV9wdWJrZXkYBCABKAkSHgoWc2VydmVyX2lkZW50aXR5X3B1YmtleRgFIAEoCRIhChloYXNoX3RyYW5zZmVyX2luaXRfY2xhaW1zGAYgASgJEhkKEWhhc2hfcHJldl9tZXNzYWdlGAcgASgJEh4KFmNsaWVudF90cmFuc2Zlcl9udW1iZXIYCCABKAkSGAoQY2xpZW50X3NpZ25hdHVyZRgJIAEoCSLwAQoSQWNrQ29tbWVuY2VSZXF1ZXN0EhQKDG1lc3NhZ2VfdHlwZRgBIAEoCRISCgpzZXNzaW9uX2lkGAIgASgJEhsKE3RyYW5zZmVyX2NvbnRleHRfaWQYAyABKAkSHgoWY2xpZW50X2lkZW50aXR5X3B1YmtleRgEIAEoCRIeChZzZXJ2ZXJfaWRlbnRpdHlfcHVia2V5GAUgASgJEhkKEWhhc2hfcHJldl9tZXNzYWdlGAYgASgJEh4KFnNlcnZlcl90cmFuc2Zlcl9udW1iZXIYByABKAkSGAoQc2VydmVyX3NpZ25hdHVyZRgIIAEoCSKEAgoWU2VuZEFzc2V0U3RhdHVzUmVxdWVzdBIUCgxtZXNzYWdlX3R5cGUYASABKAkSEgoKc2Vzc2lvbl9pZBgCIAEoCRIbChN0cmFuc2Zlcl9jb250ZXh0X2lkGAMgASgJEh4KFmNsaWVudF9pZGVudGl0eV9wdWJrZXkYBCABKAkSHgoWc2VydmVyX2lkZW50aXR5X3B1YmtleRgFIAEoCRIZChFoYXNoX3ByZXZfbWVzc2FnZRgGIAEoCRIeChZzZXJ2ZXJfdHJhbnNmZXJfbnVtYmVyGAcgASgJEhgKEHNlcnZlcl9zaWduYXR1cmUYCCABKAkSDgoGc3RhdHVzGAkgASgJItgCChRMb2NrQXNzZXJ0aW9uUmVxdWVzdBIUCgxtZXNzYWdlX3R5cGUYASABKAkSEgoKc2Vzc2lvbl9pZBgCIAEoCRIbChN0cmFuc2Zlcl9jb250ZXh0X2lkGAMgASgJEh4KFmNsaWVudF9pZGVudGl0eV9wdWJrZXkYBCABKAkSHgoWc2VydmVyX2lkZW50aXR5X3B1YmtleRgFIAEoCRIcChRsb2NrX2Fzc2VydGlvbl9jbGFpbRgGIAEoCRIjChtsb2NrX2Fzc2VydGlvbl9jbGFpbV9mb3JtYXQYByABKAkSIQoZbG9ja19hc3NlcnRpb25fZXhwaXJhdGlvbhgIIAEoCRIZChFoYXNoX3ByZXZfbWVzc2FnZRgJIAEoCRIeChZjbGllbnRfdHJhbnNmZXJfbnVtYmVyGAogASgJEhgKEGNsaWVudF9zaWduYXR1cmUYCyABKAki+QEKG0xvY2tBc3NlcnRpb25SZWNlaXB0UmVxdWVzdBIUCgxtZXNzYWdlX3R5cGUYASABKAkSEgoKc2Vzc2lvbl9pZBgCIAEoCRIbChN0cmFuc2Zlcl9jb250ZXh0X2lkGAMgASgJEh4KFmNsaWVudF9pZGVudGl0eV9wdWJrZXkYBCABKAkSHgoWc2VydmVyX2lkZW50aXR5X3B1YmtleRgFIAEoCRIZChFoYXNoX3ByZXZfbWVzc2FnZRgGIAEoCRIeChZzZXJ2ZXJfdHJhbnNmZXJfbnVtYmVyGAcgASgJEhgKEHNlcnZlcl9zaWduYXR1cmUYCCABKAkiXQoUQ29tbWl0UHJlcGFyZVJlcXVlc3QSFAoMbWVzc2FnZV90eXBlGAEgASgJEhIKCnNlc3Npb25faWQYAiABKAkSGwoTdHJhbnNmZXJfY29udGV4dF9pZBgDIAEoCSJbChJDb21taXRSZWFkeVJlcXVlc3QSFAoMbWVzc2FnZV90eXBlGAEgASgJEhIKCnNlc3Npb25faWQYAiABKAkSGwoTdHJhbnNmZXJfY29udGV4dF9pZBgDIAEoCSJkChtDb21taXRGaW5hbEFzc2VydGlvblJlcXVlc3QSFAoMbWVzc2FnZV90eXBlGAEgASgJEhIKCnNlc3Npb25faWQYAiABKAkSGwoTdHJhbnNmZXJfY29udGV4dF9pZBgDIAEoCSJfChZBY2tGaW5hbFJlY2VpcHRSZXF1ZXN0EhQKDG1lc3NhZ2VfdHlwZRgBIAEoCRISCgpzZXNzaW9uX2lkGAIgASgJEhsKE3RyYW5zZmVyX2NvbnRleHRfaWQYAyABKAkiYQoYVHJhbnNmZXJDb21wbGV0ZWRSZXF1ZXN0EhQKDG1lc3NhZ2VfdHlwZRgBIAEoCRISCgpzZXNzaW9uX2lkGAIgASgJEhsKE3RyYW5zZmVyX2NvbnRleHRfaWQYAyABKAkyngcKBFNBVFASVgoWVHJhbnNmZXJQcm9wb3NhbENsYWltcxIpLnJlbGF5LnNhdHAuVHJhbnNmZXJQcm9wb3NhbENsYWltc1JlcXVlc3QaDy5jb21tb24uYWNrLkFjayIAElgKF1RyYW5zZmVyUHJvcG9zYWxSZWNlaXB0EioucmVsYXkuc2F0cC5UcmFuc2ZlclByb3Bvc2FsUmVjZWlwdFJlcXVlc3QaDy5jb21tb24uYWNrLkFjayIAEkoKEFRyYW5zZmVyQ29tbWVuY2USIy5yZWxheS5zYXRwLlRyYW5zZmVyQ29tbWVuY2VSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJACgtBY2tDb21tZW5jZRIeLnJlbGF5LnNhdHAuQWNrQ29tbWVuY2VSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJICg9TZW5kQXNzZXRTdGF0dXMSIi5yZWxheS5zYXRwLlNlbmRBc3NldFN0YXR1c1JlcXVlc3QaDy5jb21tb24uYWNrLkFjayIAEkQKDUxvY2tBc3NlcnRpb24SIC5yZWxheS5zYXRwLkxvY2tBc3NlcnRpb25SZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJSChRMb2NrQXNzZXJ0aW9uUmVjZWlwdBInLnJlbGF5LnNhdHAuTG9ja0Fzc2VydGlvblJlY2VpcHRSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJECg1Db21taXRQcmVwYXJlEiAucmVsYXkuc2F0cC5Db21taXRQcmVwYXJlUmVxdWVzdBoPLmNvbW1vbi5hY2suQWNrIgASQAoLQ29tbWl0UmVhZHkSHi5yZWxheS5zYXRwLkNvbW1pdFJlYWR5UmVxdWVzdBoPLmNvbW1vbi5hY2suQWNrIgASUgoUQ29tbWl0RmluYWxBc3NlcnRpb24SJy5yZWxheS5zYXRwLkNvbW1pdEZpbmFsQXNzZXJ0aW9uUmVxdWVzdBoPLmNvbW1vbi5hY2suQWNrIgASSAoPQWNrRmluYWxSZWNlaXB0EiIucmVsYXkuc2F0cC5BY2tGaW5hbFJlY2VpcHRSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siABJMChFUcmFuc2ZlckNvbXBsZXRlZBIkLnJlbGF5LnNhdHAuVHJhbnNmZXJDb21wbGV0ZWRSZXF1ZXN0Gg8uY29tbW9uLmFjay5BY2siAEJ9CjZvcmcuaHlwZXJsZWRnZXIuY2FjdGkud2VhdmVyLnByb3Rvcy5yZWxheS5kYXRhdHJhbnNmZXJaQ2dpdGh1Yi5jb20vaHlwZXJsZWRnZXItY2FjdGkvY2FjdGkvd2VhdmVyL2NvbW1vbi9wcm90b3MtZ28vdjIvcmVsYXliBnByb3RvMw", [file_common_ack]); + +/** + * @generated from message relay.satp.TransferProposalClaimsRequest + */ +export type TransferProposalClaimsRequest = Message<"relay.satp.TransferProposalClaimsRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string asset_asset_id = 2; + */ + assetAssetId: string; + + /** + * @generated from field: string asset_profile_id = 3; + */ + assetProfileId: string; + + /** + * @generated from field: string verified_originator_entity_id = 4; + */ + verifiedOriginatorEntityId: string; + + /** + * @generated from field: string verified_beneficiary_entity_id = 5; + */ + verifiedBeneficiaryEntityId: string; + + /** + * @generated from field: string originator_pubkey = 6; + */ + originatorPubkey: string; + + /** + * @generated from field: string beneficiary_pubkey = 7; + */ + beneficiaryPubkey: string; + + /** + * @generated from field: string sender_gateway_network_id = 8; + */ + senderGatewayNetworkId: string; + + /** + * @generated from field: string recipient_gateway_network_id = 9; + */ + recipientGatewayNetworkId: string; + + /** + * @generated from field: string client_identity_pubkey = 10; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 11; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string sender_gateway_owner_id = 12; + */ + senderGatewayOwnerId: string; + + /** + * @generated from field: string receiver_gateway_owner_id = 13; + */ + receiverGatewayOwnerId: string; +}; + +/** + * Describes the message relay.satp.TransferProposalClaimsRequest. + * Use `create(TransferProposalClaimsRequestSchema)` to create a new message. + */ +export const TransferProposalClaimsRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 0); + +/** + * @generated from message relay.satp.TransferProposalReceiptRequest + */ +export type TransferProposalReceiptRequest = Message<"relay.satp.TransferProposalReceiptRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string asset_asset_id = 2; + */ + assetAssetId: string; + + /** + * @generated from field: string asset_profile_id = 3; + */ + assetProfileId: string; + + /** + * @generated from field: string verified_originator_entity_id = 4; + */ + verifiedOriginatorEntityId: string; + + /** + * @generated from field: string verified_beneficiary_entity_id = 5; + */ + verifiedBeneficiaryEntityId: string; + + /** + * @generated from field: string originator_pubkey = 6; + */ + originatorPubkey: string; + + /** + * @generated from field: string beneficiary_pubkey = 7; + */ + beneficiaryPubkey: string; + + /** + * @generated from field: string sender_gateway_network_id = 8; + */ + senderGatewayNetworkId: string; + + /** + * @generated from field: string recipient_gateway_network_id = 9; + */ + recipientGatewayNetworkId: string; + + /** + * @generated from field: string client_identity_pubkey = 10; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 11; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string sender_gateway_owner_id = 12; + */ + senderGatewayOwnerId: string; + + /** + * @generated from field: string receiver_gateway_owner_id = 13; + */ + receiverGatewayOwnerId: string; +}; + +/** + * Describes the message relay.satp.TransferProposalReceiptRequest. + * Use `create(TransferProposalReceiptRequestSchema)` to create a new message. + */ +export const TransferProposalReceiptRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 1); + +/** + * @generated from message relay.satp.TransferCommenceRequest + */ +export type TransferCommenceRequest = Message<"relay.satp.TransferCommenceRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; + + /** + * @generated from field: string client_identity_pubkey = 4; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 5; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string hash_transfer_init_claims = 6; + */ + hashTransferInitClaims: string; + + /** + * @generated from field: string hash_prev_message = 7; + */ + hashPrevMessage: string; + + /** + * @generated from field: string client_transfer_number = 8; + */ + clientTransferNumber: string; + + /** + * @generated from field: string client_signature = 9; + */ + clientSignature: string; +}; + +/** + * Describes the message relay.satp.TransferCommenceRequest. + * Use `create(TransferCommenceRequestSchema)` to create a new message. + */ +export const TransferCommenceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 2); + +/** + * @generated from message relay.satp.AckCommenceRequest + */ +export type AckCommenceRequest = Message<"relay.satp.AckCommenceRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; + + /** + * @generated from field: string client_identity_pubkey = 4; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 5; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string hash_prev_message = 6; + */ + hashPrevMessage: string; + + /** + * @generated from field: string server_transfer_number = 7; + */ + serverTransferNumber: string; + + /** + * @generated from field: string server_signature = 8; + */ + serverSignature: string; +}; + +/** + * Describes the message relay.satp.AckCommenceRequest. + * Use `create(AckCommenceRequestSchema)` to create a new message. + */ +export const AckCommenceRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 3); + +/** + * @generated from message relay.satp.SendAssetStatusRequest + */ +export type SendAssetStatusRequest = Message<"relay.satp.SendAssetStatusRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; + + /** + * @generated from field: string client_identity_pubkey = 4; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 5; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string hash_prev_message = 6; + */ + hashPrevMessage: string; + + /** + * @generated from field: string server_transfer_number = 7; + */ + serverTransferNumber: string; + + /** + * @generated from field: string server_signature = 8; + */ + serverSignature: string; + + /** + * @generated from field: string status = 9; + */ + status: string; +}; + +/** + * Describes the message relay.satp.SendAssetStatusRequest. + * Use `create(SendAssetStatusRequestSchema)` to create a new message. + */ +export const SendAssetStatusRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 4); + +/** + * @generated from message relay.satp.LockAssertionRequest + */ +export type LockAssertionRequest = Message<"relay.satp.LockAssertionRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; + + /** + * @generated from field: string client_identity_pubkey = 4; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 5; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string lock_assertion_claim = 6; + */ + lockAssertionClaim: string; + + /** + * @generated from field: string lock_assertion_claim_format = 7; + */ + lockAssertionClaimFormat: string; + + /** + * @generated from field: string lock_assertion_expiration = 8; + */ + lockAssertionExpiration: string; + + /** + * @generated from field: string hash_prev_message = 9; + */ + hashPrevMessage: string; + + /** + * @generated from field: string client_transfer_number = 10; + */ + clientTransferNumber: string; + + /** + * @generated from field: string client_signature = 11; + */ + clientSignature: string; +}; + +/** + * Describes the message relay.satp.LockAssertionRequest. + * Use `create(LockAssertionRequestSchema)` to create a new message. + */ +export const LockAssertionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 5); + +/** + * @generated from message relay.satp.LockAssertionReceiptRequest + */ +export type LockAssertionReceiptRequest = Message<"relay.satp.LockAssertionReceiptRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; + + /** + * @generated from field: string client_identity_pubkey = 4; + */ + clientIdentityPubkey: string; + + /** + * @generated from field: string server_identity_pubkey = 5; + */ + serverIdentityPubkey: string; + + /** + * @generated from field: string hash_prev_message = 6; + */ + hashPrevMessage: string; + + /** + * @generated from field: string server_transfer_number = 7; + */ + serverTransferNumber: string; + + /** + * @generated from field: string server_signature = 8; + */ + serverSignature: string; +}; + +/** + * Describes the message relay.satp.LockAssertionReceiptRequest. + * Use `create(LockAssertionReceiptRequestSchema)` to create a new message. + */ +export const LockAssertionReceiptRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 6); + +/** + * @generated from message relay.satp.CommitPrepareRequest + */ +export type CommitPrepareRequest = Message<"relay.satp.CommitPrepareRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; +}; + +/** + * Describes the message relay.satp.CommitPrepareRequest. + * Use `create(CommitPrepareRequestSchema)` to create a new message. + */ +export const CommitPrepareRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 7); + +/** + * @generated from message relay.satp.CommitReadyRequest + */ +export type CommitReadyRequest = Message<"relay.satp.CommitReadyRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; +}; + +/** + * Describes the message relay.satp.CommitReadyRequest. + * Use `create(CommitReadyRequestSchema)` to create a new message. + */ +export const CommitReadyRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 8); + +/** + * @generated from message relay.satp.CommitFinalAssertionRequest + */ +export type CommitFinalAssertionRequest = Message<"relay.satp.CommitFinalAssertionRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; +}; + +/** + * Describes the message relay.satp.CommitFinalAssertionRequest. + * Use `create(CommitFinalAssertionRequestSchema)` to create a new message. + */ +export const CommitFinalAssertionRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 9); + +/** + * @generated from message relay.satp.AckFinalReceiptRequest + */ +export type AckFinalReceiptRequest = Message<"relay.satp.AckFinalReceiptRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; +}; + +/** + * Describes the message relay.satp.AckFinalReceiptRequest. + * Use `create(AckFinalReceiptRequestSchema)` to create a new message. + */ +export const AckFinalReceiptRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 10); + +/** + * @generated from message relay.satp.TransferCompletedRequest + */ +export type TransferCompletedRequest = Message<"relay.satp.TransferCompletedRequest"> & { + /** + * @generated from field: string message_type = 1; + */ + messageType: string; + + /** + * @generated from field: string session_id = 2; + */ + sessionId: string; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId: string; +}; + +/** + * Describes the message relay.satp.TransferCompletedRequest. + * Use `create(TransferCompletedRequestSchema)` to create a new message. + */ +export const TransferCompletedRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_relay_satp, 11); + +/** + * Stage 1 endpoints + * + * @generated from service relay.satp.SATP + */ +export const SATP: GenService<{ + /** + * The sender gateway sends a TransferProposalClaims request to initiate an asset transfer. + * Depending on the proposal, multiple rounds of communication between the two gateways may happen. + * + * @generated from rpc relay.satp.SATP.TransferProposalClaims + */ + transferProposalClaims: { + methodKind: "unary"; + input: typeof TransferProposalClaimsRequestSchema; + output: typeof AckSchema; + }, + /** + * The sender gateway sends a TransferProposalClaims request to signal to the receiver gateway + * that the it is ready to start the transfer of the digital asset + * + * @generated from rpc relay.satp.SATP.TransferProposalReceipt + */ + transferProposalReceipt: { + methodKind: "unary"; + input: typeof TransferProposalReceiptRequestSchema; + output: typeof AckSchema; + }, + /** + * The sender gateway sends a TransferCommence request to signal to the receiver gateway + * that the it is ready to start the transfer of the digital asset + * + * @generated from rpc relay.satp.SATP.TransferCommence + */ + transferCommence: { + methodKind: "unary"; + input: typeof TransferCommenceRequestSchema; + output: typeof AckSchema; + }, + /** + * The receiver gateway sends a AckCommence request to the sender gateway to indicate agreement + * to proceed with the asset transfe + * + * @generated from rpc relay.satp.SATP.AckCommence + */ + ackCommence: { + methodKind: "unary"; + input: typeof AckCommenceRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.SendAssetStatus + */ + sendAssetStatus: { + methodKind: "unary"; + input: typeof SendAssetStatusRequestSchema; + output: typeof AckSchema; + }, + /** + * The sender gateway sends a LockAssertion request to convey a signed claim to the receiver gateway + * declaring that the asset in question has been locked or escrowed by the sender gateway in + * the origin network (e.g. to prevent double spending) + * + * @generated from rpc relay.satp.SATP.LockAssertion + */ + lockAssertion: { + methodKind: "unary"; + input: typeof LockAssertionRequestSchema; + output: typeof AckSchema; + }, + /** + * The receiver gateway sends a LockAssertionReceipt request to the sender gateway to indicate acceptance + * of the claim(s) delivered by the sender gateway in the previous message + * + * @generated from rpc relay.satp.SATP.LockAssertionReceipt + */ + lockAssertionReceipt: { + methodKind: "unary"; + input: typeof LockAssertionReceiptRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.CommitPrepare + */ + commitPrepare: { + methodKind: "unary"; + input: typeof CommitPrepareRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.CommitReady + */ + commitReady: { + methodKind: "unary"; + input: typeof CommitReadyRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.CommitFinalAssertion + */ + commitFinalAssertion: { + methodKind: "unary"; + input: typeof CommitFinalAssertionRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.AckFinalReceipt + */ + ackFinalReceipt: { + methodKind: "unary"; + input: typeof AckFinalReceiptRequestSchema; + output: typeof AckSchema; + }, + /** + * @generated from rpc relay.satp.SATP.TransferCompleted + */ + transferCompleted: { + methodKind: "unary"; + input: typeof TransferCompletedRequestSchema; + output: typeof AckSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_relay_satp, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/transientstore/transientstore_pb.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/transientstore/transientstore_pb.ts new file mode 100644 index 0000000000..41477fb9a1 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/generated/protos/transientstore/transientstore_pb.ts @@ -0,0 +1,53 @@ +// Copyright the Hyperledger Fabric contributors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + +// @generated by protoc-gen-es v2.2.2 with parameter "target=ts" +// @generated from file transientstore/transientstore.proto (package transientstore, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; +import type { TxPvtReadWriteSet } from "../ledger/rwset/rwset_pb"; +import { file_ledger_rwset_rwset } from "../ledger/rwset/rwset_pb"; +import type { CollectionConfigPackage } from "../peer/collection_pb"; +import { file_peer_collection } from "../peer/collection_pb"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file transientstore/transientstore.proto. + */ +export const file_transientstore_transientstore: GenFile = /*@__PURE__*/ + fileDesc("CiN0cmFuc2llbnRzdG9yZS90cmFuc2llbnRzdG9yZS5wcm90bxIOdHJhbnNpZW50c3RvcmUiogIKH1R4UHZ0UmVhZFdyaXRlU2V0V2l0aENvbmZpZ0luZm8SEwoLZW5kb3JzZWRfYXQYASABKAQSKwoJcHZ0X3J3c2V0GAIgASgLMhgucndzZXQuVHhQdnRSZWFkV3JpdGVTZXQSYgoSY29sbGVjdGlvbl9jb25maWdzGAMgAygLMkYudHJhbnNpZW50c3RvcmUuVHhQdnRSZWFkV3JpdGVTZXRXaXRoQ29uZmlnSW5mby5Db2xsZWN0aW9uQ29uZmlnc0VudHJ5GlkKFkNvbGxlY3Rpb25Db25maWdzRW50cnkSCwoDa2V5GAEgASgJEi4KBXZhbHVlGAIgASgLMh8ucHJvdG9zLkNvbGxlY3Rpb25Db25maWdQYWNrYWdlOgI4AUJmCixvcmcuaHlwZXJsZWRnZXIuZmFicmljLnByb3Rvcy50cmFuc2llbnRzdG9yZVo2Z2l0aHViLmNvbS9oeXBlcmxlZGdlci9mYWJyaWMtcHJvdG9zLWdvL3RyYW5zaWVudHN0b3JlYgZwcm90bzM", [file_ledger_rwset_rwset, file_peer_collection]); + +/** + * TxPvtReadWriteSetWithConfigInfo encapsulates the transaction's private + * read-write set and additional information about the configurations such as + * the latest collection config when the transaction is simulated + * + * @generated from message transientstore.TxPvtReadWriteSetWithConfigInfo + */ +export type TxPvtReadWriteSetWithConfigInfo = Message<"transientstore.TxPvtReadWriteSetWithConfigInfo"> & { + /** + * @generated from field: uint64 endorsed_at = 1; + */ + endorsedAt: bigint; + + /** + * @generated from field: rwset.TxPvtReadWriteSet pvt_rwset = 2; + */ + pvtRwset?: TxPvtReadWriteSet; + + /** + * @generated from field: map collection_configs = 3; + */ + collectionConfigs: { [key: string]: CollectionConfigPackage }; +}; + +/** + * Describes the message transientstore.TxPvtReadWriteSetWithConfigInfo. + * Use `create(TxPvtReadWriteSetWithConfigInfoSchema)` to create a new message. + */ +export const TxPvtReadWriteSetWithConfigInfoSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_transientstore_transientstore, 0); + diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-block-number/get-block-number-endpoint-v1.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-block-number/get-block-number-endpoint-v1.ts new file mode 100644 index 0000000000..16c4c7e54a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/get-block-number/get-block-number-endpoint-v1.ts @@ -0,0 +1,112 @@ +import { Express, Request, Response } from "express"; + +import { + Logger, + LoggerProvider, + LogLevelDesc, + Checks, + IAsyncProvider, +} from "@hyperledger/cactus-common"; + +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + handleRestEndpointException, + registerWebServiceEndpoint, +} from "@hyperledger/cactus-core"; + +import { PluginLedgerConnectorFabric } from "../plugin-ledger-connector-fabric"; +import OAS from "../../json/openapi.json"; + +export interface IGetLatestBlockEndpointV1Options { + logLevel?: LogLevelDesc; + connector: PluginLedgerConnectorFabric; +} + +export class GetLatestBlockNumberEndpointV1 implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "GetLatestBlockNumberEndpointV1"; + + private readonly log: Logger; + + public get className(): string { + return GetLatestBlockNumberEndpointV1.CLASS_NAME; + } + + constructor(public readonly opts: IGetLatestBlockEndpointV1Options) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(opts, `${fnTag} options`); + Checks.truthy(opts.connector, `${fnTag} options.connector`); + + this.log = LoggerProvider.getOrCreate({ + label: "get-block-endpoint-v1", + level: opts.logLevel || "INFO", + }); + } + + 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); + } + + public getOasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-latest-block-number" + ]; + } + + 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; + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = `${this.className}#handleRequest()`; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + const reqTag = `${verbUpper} ${this.getPath()}`; + this.log.debug(reqTag); + + try { + res + .status(200) + .send(await this.opts.connector.getLatestBlockNumber(req.body)); + } catch (ex) { + const errorMsg = `${fnTag} request handler fn crashed for: ${reqTag}`; + await handleRestEndpointException({ + errorMsg, + log: this.log, + error: ex, + res, + }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric-cli.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric-cli.ts new file mode 100644 index 0000000000..4d591c1e66 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric-cli.ts @@ -0,0 +1,221 @@ +import { LoggerProvider } from "@hyperledger/cactus-common"; +import { + DriverConfig, + FabricDriverServerOptions, +} from "./weaver/fabric-driver-server"; +import fs from "fs"; +import { + ConnectionProfile, + DefaultEventHandlerStrategy, + PluginLedgerConnectorFabric, +} from "./public-api"; +import { v4 as uuidv4 } from "uuid"; +import { PluginRegistry } from "@hyperledger/cactus-core"; +import "dotenv/config"; + +import http2 from "http2"; +import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +import { getDriverKeyCert, walletSetup } from "./weaver/walletSetup"; +import { Wallet } from "fabric-network"; +import path from "path"; + +export async function startFabricWeaverDriver(): Promise { + const logger = LoggerProvider.getOrCreate({ + level: "DEBUG", + label: "Fabric-Weaver-Driver", + }); + const envVars = [ + "CONNECTION_PROFILE", + "RELAY_ENDPOINT", + "RELAY_TLS", + "RELAY_TLSCA_CERT_PATH", + "DRIVER_ENDPOINT", + "DRIVER_TLS", + "DRIVER_TLS_CERT_PATH", + "DRIVER_TLS_KEY_PATH", + "NETWORK_NAME", + "DRIVER_CONFIG", + "INTEROP_CHAINCODE", + "MOCK", + "DB_PATH", + "WALLET_PATH", + "DEBUG", + "LEVELDB_LOCKED_MAX_RETRIES", + "LEVELDB_LOCKED_RETRY_BACKOFF_MSEC", + "ENABLE_MONITOR", + "MONITOR_SYNC_PERIOD", + ]; + const config: Record = {}; + + envVars.forEach((key) => { + config[key] = process.env[key]; + }); + + logger.info("Fabric Weaver Driver Environment Variables:", config); + + if (config.CONNECTION_PROFILE === undefined) { + throw new Error("ENV variable CONNECTION_PROFILE must be set"); + } + if (!fs.existsSync(config.CONNECTION_PROFILE)) { + throw new Error( + `File not found: CONNECTION_PROFILE=${config.CONNECTION_PROFILE}`, + ); + } + + if (config.DRIVER_TLS === "true") { + if (!config.DRIVER_TLS_CERT_PATH) { + throw new Error( + "ENV variable DRIVER_TLS_CERT_PATH must be set when DRIVER_TLS is true", + ); + } + if (!config.DRIVER_TLS_KEY_PATH) { + throw new Error( + "ENV variable DRIVER_TLS_KEY_PATH must be set when DRIVER_TLS is true", + ); + } + + if (!fs.existsSync(config.DRIVER_TLS_CERT_PATH)) { + throw new Error( + `File not found: DRIVER_TLS_CERT_PATH=${config.DRIVER_TLS_CERT_PATH}`, + ); + } + if (!fs.existsSync(config.DRIVER_TLS_KEY_PATH)) { + throw new Error( + `File not found: DRIVER_TLS_KEY_PATH=${config.DRIVER_TLS_KEY_PATH}`, + ); + } + } + + if (config.RELAY_ENDPOINT === undefined) { + throw new Error("ENV variable RELAY_ENDPOINT must be set"); + } + + if (config.CONNECTION_PROFILE === undefined) { + throw new Error("ENV variable CONNECTION_PROFILE must be set"); + } + if (!fs.existsSync(config.CONNECTION_PROFILE)) { + throw new Error( + `File not found: CONNECTION_PROFILE=${config.CONNECTION_PROFILE}`, + ); + } + + const driverConfig: DriverConfig = JSON.parse( + fs.readFileSync(config.DRIVER_CONFIG || "./config.json", "utf8"), + ); + + logger.debug("Driver Config:", driverConfig); + + const connectionProfile: ConnectionProfile = JSON.parse( + fs.readFileSync(path.resolve(__dirname, config.CONNECTION_PROFILE), "utf8"), + ); + + const logLevel = config.DEBUG === "true" ? "DEBUG" : "INFO"; + + const wallet: Wallet = await walletSetup( + config.WALLET_PATH || `./wallet-${config.NETWORK_NAME || "network1"}`, + connectionProfile, + driverConfig, + logLevel, + ); + + const keychainPlugin = new PluginKeychainMemory({ + instanceId: uuidv4(), + keychainId: uuidv4(), + logLevel, + backend: new Map([ + [ + driverConfig.relay?.name || "", + JSON.stringify(await wallet.get(driverConfig.relay?.name || "")), + ], + [ + driverConfig.admin?.name || "", + JSON.stringify(await wallet.get(driverConfig.admin?.name || "")), + ], + ]), + }); + + const connector = new PluginLedgerConnectorFabric({ + instanceId: uuidv4(), + connectionProfile, + logLevel, + pluginRegistry: new PluginRegistry({ plugins: [keychainPlugin] }), + discoveryOptions: { + enabled: true, + asLocalhost: true, + }, + eventHandlerOptions: { + strategy: DefaultEventHandlerStrategy.NetworkScopeAllfortx, + commitTimeout: 300, + }, + }); + + const gatewayOptions = { + identity: driverConfig.relay?.name || "", + wallet: { + keychain: { + keychainId: keychainPlugin.getKeychainId(), + keychainRef: driverConfig.relay?.name || "", + }, + }, + }; + + const options: Partial = { + mock: config.MOCK === "true", + logLevel: logLevel, + networkName: config.NETWORK_NAME, + monitorSyncPeriod: config.MONITOR_SYNC_PERIOD, + monitorEnabled: config.ENABLE_MONITOR === "true", + driverConfig: driverConfig, + relayEndpoint: config.RELAY_ENDPOINT, + walletPath: config.WALLET_PATH, + tls: config.DRIVER_TLS === "true", + discoveryOptions: { enabled: true, asLocalhost: true }, + gatewayOptions: gatewayOptions, + certificate: await getDriverKeyCert(wallet, driverConfig), + interopChainCode: config.INTEROP_CHAINCODE || "interop", + }; + + const handler = await connector.createWeaverDriveService({ + weaverOptions: options, + }); + + let server: http2.Http2Server; + if (config.DRIVER_TLS === "true") { + logger.info("Starting Fabric Weaver Driver with TLS"); + const httpsOptions = { + cert: fs.readFileSync(config.DRIVER_TLS_CERT_PATH!), + key: fs.readFileSync(config.DRIVER_TLS_KEY_PATH!), + }; + server = http2.createSecureServer(httpsOptions, handler); + } else { + logger.info("Starting Fabric Weaver Driver without TLS"); + server = http2.createServer(handler); + } + + if (config.DRIVER_ENDPOINT === undefined) { + throw new Error("ENV variable DRIVER_ENDPOINT must be set"); + } + + const address: string[] = config.DRIVER_ENDPOINT.split(":"); + + const host = address[0]; + const port = parseInt(address[1]); + + try { + server.listen(port, host, () => { + logger.info( + `Fabric Weaver Driver server listening on https://${host}:${port}`, + ); + }); + server.on("error", (error) => { + logger.error(`Fabric Weaver Driver failed to start: ${error}`); + }); + } catch (error) { + logger.error(`Error starting Fabric Weaver Driver: ${error}`); + throw error; + } +} + +if (require.main === module) { + startFabricWeaverDriver(); +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts index 0103d2cc79..d780a2b477 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts @@ -22,6 +22,10 @@ import { Wallet, ContractEvent, ContractListener, + BlockEvent, + CommitEvent, + BlockListener, + CommitListener, } from "fabric-network"; import { BuildProposalRequest, @@ -104,6 +108,12 @@ import { GetChainInfoResponseV1, GetDiscoveryResultsRequestV1, GetDiscoveryResultsResponseV1, + RunInvokeRequest, + EndorsedProposalResponse, + RunInvokeResponse, + EventType, + GetLatestBlockNumberRequestV1, + GetLatestBlockNumberResponseV1, } from "./generated/openapi/typescript-axios/index"; import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; @@ -146,7 +156,6 @@ import { GetDiscoveryResultsEndpointV1 } from "./get-discovery-results/get-disco import { querySystemChainCode } from "./common/query-system-chain-code"; import { isSshExecOk } from "./common/is-ssh-exec-ok"; import { - asBuffer, assertFabricFunctionIsAvailable, CreateListenerRequest, FabricLong, @@ -156,7 +165,15 @@ import { findAndReplaceFabricLoggingSpecArray } from "./common/find-and-replace- import { Observable, ReplaySubject } from "rxjs"; import { CompilerTools } from "./compiler-tools/compiler-tools"; import tar from "tar-fs"; +import fabproto6 from "fabric-protos"; +import { GetLatestBlockNumberEndpointV1 } from "./get-block-number/get-block-number-endpoint-v1"; +import { + FabricDriverServer, + FabricDriverServerOptions, +} from "./weaver/fabric-driver-server"; import { stringify } from "json5"; +import { connectNodeAdapter } from "@connectrpc/connect-node"; +import { NodeHandlerFn } from "@connectrpc/connect-node/dist/cjs/node-universal-handler"; const { loadFromConfig } = require("fabric-network/lib/impl/ccp/networkconfig"); assertFabricFunctionIsAvailable(loadFromConfig, "loadFromConfig"); @@ -198,6 +215,8 @@ export interface IPluginLedgerConnectorFabricOptions eventProvider?: string; } +export type FabricEvent = ContractEvent | BlockEvent | CommitEvent; + export class PluginLedgerConnectorFabric implements IPluginLedgerConnector< @@ -220,6 +239,8 @@ export class PluginLedgerConnectorFabric private runningWatchBlocksMonitors = new Set(); private txSubject: ReplaySubject = new ReplaySubject(); + private driver: FabricDriverServer | undefined; + private dockerNetworkName: string = "bridge"; public get className(): string { @@ -280,10 +301,18 @@ export class PluginLedgerConnectorFabric this.signCallback = opts.signCallback; } + public getConnectionProfile(): ConnectionProfile { + return this.connectionProfile; + } + public getOpenApiSpec(): unknown { return OAS; } + public getCertStore(): CertDatastore { + return this.certStore; + } + public async shutdown(): Promise { this.runningWatchBlocksMonitors.forEach((m) => m.close()); this.runningWatchBlocksMonitors.clear(); @@ -1002,6 +1031,14 @@ export class PluginLedgerConnectorFabric endpoints.push(endpoint); } + { + const endpoint = new GetLatestBlockNumberEndpointV1({ + connector: this, + logLevel: this.opts.logLevel, + }); + endpoints.push(endpoint); + } + const pkg = this.getPackageName(); log.info(`Installed web services for plugin ${pkg} OK`, { endpoints }); @@ -1022,7 +1059,7 @@ export class PluginLedgerConnectorFabric * @param req must contain either gatewayOptions or signingCredential. * @returns Fabric SDK Gateway */ - protected async createGateway(req: { + public async createGateway(req: { gatewayOptions?: GatewayOptions; signingCredential?: FabricSigningCredential; }): Promise { @@ -1282,6 +1319,129 @@ export class PluginLedgerConnectorFabric return transientMap; } + // Main invoke function with logic to handle policy and turn response from chaincode into a view. + // 1. Prepare credentials/gateway for communicating with fabric network + // 2. Set the endorser list for the transaction, this enforces that the list provided will endorse the proposed transaction + // 3. Prepare the view and return. + public async invoke(req: RunInvokeRequest): Promise { + this.log.info("Running query on fabric network"); + try { + const { + channelName, + contractName, + methodName: ccFunc, + params, + //transientData, + policies, + } = req; + const identities = policies || []; + + // 1. Prepare credentials/gateway for communicating with fabric network + const gateway = await this.createGateway(req); + + this.log.debug(`Channel: ${channelName}`); + const network = await gateway.getNetwork(channelName); + const currentChannel = network.getChannel(); + const endorsers = currentChannel.getEndorsers(); + + if (!gateway.identityContext) { + throw new Error(`Gateway is missing identity context`); + } + + const idx = gateway.identityContext?.calculateTransactionId(); + this.log.debug(`Using transaction ID: ${idx}`); + const queryProposal = currentChannel.newQuery(contractName); + const request = { + fcn: ccFunc, + args: params, + generateTransactionId: false, + }; + queryProposal.build(idx, request); + await queryProposal.sign(idx); + // 2. Set the endorser list for the transaction, this enforces that the list provided will endorse the proposed transaction + let proposalRequest; + if (identities.length > 0) { + const endorserList = endorsers.filter((endorser: Endorser) => { + //@ts-expect-error: should expect string + const cert = Certificate.fromPEM(endorser.options.pem); + const orgName = cert.issuer.organizationName; + return ( + identities.includes(endorser.mspid) || identities.includes(orgName) + ); + }); + this.log.debug(`Set endorserList: ${endorserList}`); + proposalRequest = { + targets: endorserList, + requestTimeout: 30000, + }; + } else { + // When no identities provided it will default to all peers + this.log.debug(`Set endorsers: ${endorsers}`); + proposalRequest = { + targets: endorsers, + requestTimeout: 30000, + }; + } + + // submit query transaction and get result from chaincode + const proposalResponseResult = await queryProposal.send(proposalRequest); + this.log.debug( + `proposal result: ${JSON.stringify(proposalResponseResult, null, 2)}`, + ); + + // 4. Prepare the view and return. + + const endorsedProposalResponses: EndorsedProposalResponse[] = []; + + let endorsementCounter = 0; + for (const response of proposalResponseResult.responses) { + const deserializedPayload = this.deserializeProposalResponsePayload( + response.payload, + ); + const endorsedProposalResponse: EndorsedProposalResponse = { + payload: { + proposalHash: Buffer.from( + deserializedPayload.proposal_hash, + ).toString("base64"), + extension: Buffer.from(deserializedPayload.extension).toString( + "base64", + ), + }, + endorsement: { + endorser: response.endorsement?.endorser.toString("base64"), + signature: response.endorsement?.signature.toString("base64"), + }, + }; + + // Add to list of endorsedProposalResponses + endorsedProposalResponses.push(endorsedProposalResponse); + + this.log.info( + `InteropPayload: ${endorsementCounter}, ${JSON.stringify(endorsedProposalResponse.payload)}`, + ); + this.log.info( + `Endorsement: ${endorsementCounter}, ${JSON.stringify(endorsedProposalResponse.endorsement)}`, + ); + endorsementCounter++; + } + + this.log.info( + `Got ${endorsedProposalResponses.length} endorsed proposal responses`, + ); + + // Disconnect from the gateway. + gateway.disconnect(); + return { + view: { + endorsedProposalResponses: endorsedProposalResponses, + }, + }; + } catch (error) { + this.log.error(`Failed to submit transaction: ${error}`); + throw error; + } + } + public async transact( req: RunTransactionRequest, ): Promise { @@ -1753,6 +1913,43 @@ export class PluginLedgerConnectorFabric } } + /* + * Get latest block number using query to QSCC + */ + async getLatestBlockNumber( + req: GetLatestBlockNumberRequestV1, + ): Promise { + const fnTag = `${this.className}:getBlockNumber(req: GetBlockRequestV1)`; + this.log.debug( + "getCurrBlockNumber() called, channelName:", + req.channelName, + ); + + this.log.debug("%s Creating Fabric Gateway instance...", fnTag); + const gateway = await this.createGateway(req); + this.log.debug("%s Obtaining Fabric gateway network instance...", fnTag); + const network = await gateway.getNetwork(req.channelName); + this.log.debug("%s Obtaining Fabric contract instance...", fnTag); + const contract = network.getContract("qscc"); + + const result = await contract.evaluateTransaction( + "GetChainInfo", + req.channelName, + ); + + if (!result) { + throw new Error("No result returned from GetChainInfo transaction."); + } + const blockHeight = fabproto6.common.BlockchainInfo.decode( + new Uint8Array(Buffer.isBuffer(result) ? result : Buffer.from(result)), + ).height as number; + const blockNumber = blockHeight - 1; + this.log.debug( + `getCurrBlockNumber: Get current block number: ${blockNumber}`, + ); + return { blockNumber }; + } + /** * Get fabric chain info from the system chaincode (qscc.GetChainInfo()) * @@ -1778,8 +1975,9 @@ export class PluginLedgerConnectorFabric channelName, ); - const decodedResponse = - fabricProtos.common.BlockchainInfo.decode(responseData); + const decodedResponse = fabricProtos.common.BlockchainInfo.decode( + new Uint8Array(responseData), + ); if (!decodedResponse) { throw new RuntimeError("Could not decode BlockchainInfo"); } @@ -1922,7 +2120,7 @@ export class PluginLedgerConnectorFabric if (res.response.status === 200 && res.endorsement) { return { functionOutput: this.convertToTransactionResponseType( - asBuffer(res.response.payload), + res.response.payload, ), transactionId: "", }; @@ -1995,7 +2193,7 @@ export class PluginLedgerConnectorFabric this.log.warn(`Endorsement from peer ERROR: ${endorsementStatus}`); } else { this.log.debug(`Endorsement from peer OK: ${endorsementStatus}`); - endorsedMethodResponse = asBuffer(response.payload); + endorsedMethodResponse = response.payload; } } @@ -2103,37 +2301,105 @@ export class PluginLedgerConnectorFabric */ public async createFabricListener( req: CreateListenerRequest, - callback: (event: ContractEvent) => Promise, + callback: (event: FabricEvent) => Promise, ): Promise<{ removeListener: () => void; - listener: Promise; + listener: Promise; }> { const fnTag = `${this.className}#createFabricListener()`; - const listener = async (contractEvent: ContractEvent) => - callback(contractEvent); + if (!callback) { + throw new Error(`${fnTag} No callback provided for the listener`); + } try { const gateway = await this.createGateway(req); const network = await gateway.getNetwork(req.channelName); - const contract = network.getContract(req.contractName); - this.log.debug( - `Subscribing to events emitted in contract ${req.contractName} in channel ${req.channelName}...`, - ); + if (req.eventType === EventType.Contract) { + const contract = network.getContract(req.contractName); + const listener = async (contractEvent: ContractEvent) => + callback(contractEvent as ContractEvent); - return { - listener: contract.addContractListener(listener), - removeListener: () => { - contract.removeContractListener(listener); - gateway.disconnect(); - }, - }; + this.log.debug( + `Subscribing to contract events for ${req.contractName} on channel ${req.channelName}...`, + ); + + return { + listener: contract.addContractListener(listener), + removeListener: () => { + contract.removeContractListener(listener); + gateway.disconnect(); + }, + }; + } else if (req.eventType === EventType.Block) { + const listener = async (blockEvent: BlockEvent) => callback(blockEvent); + + this.log.debug( + `Subscribing to block events on channel ${req.channelName}...`, + ); + + return { + listener: network.addBlockListener(listener), + removeListener: () => { + network.removeBlockListener(listener); + gateway.disconnect(); + }, + }; + } else if (req.eventType === EventType.Commit) { + // TODO implement commit listener + throw new Error(`${fnTag} Commit event type is not supported yet.`); + } else { + throw new Error(`${fnTag} Unknown eventType: ${req.eventType}`); + } } catch (error) { throw new Error( - `${fnTag} Failed to create fabric listener. ` + - `Error: ${error.message}`, + `${fnTag} Failed to create fabric listener. Error: ${error.message}`, ); } } + + public async createWeaverDriveService(options: { + weaverOptions: Partial; + }): Promise { + const fnTag = `${this.className}#createWeaverDriveService()`; + if ( + options.weaverOptions.driverConfig === undefined || + options.weaverOptions.relayEndpoint === undefined || + options.weaverOptions.gatewayOptions === undefined || + options.weaverOptions.certificate === undefined + ) { + throw new Error(`${fnTag} Missing required weaverOptions parameters`); + } + + this.driver = new FabricDriverServer({ + ...(options.weaverOptions as FabricDriverServerOptions), + connector: this, + logLevel: this.opts.logLevel, + }); + + const adapter = connectNodeAdapter({ + routes: this.driver.setupRouter.bind(this.driver), + }); + + try { + await this.driver.configSetup(); + this.log.info("Starting Weaver server"); + this.driver.monitorService(); + return adapter; + } catch (error) { + this.log.error( + `${fnTag} Failed to bind weaver drive service. Error: ${error.message}`, + ); + throw error; + } + } + + private deserializeProposalResponsePayload( + payloadBytes: Buffer, + ): fabricProtos.protos.ProposalResponsePayload { + return fabproto6.protos.ProposalResponsePayload.decode( + new Uint8Array(payloadBytes), + ); + } } diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/constants/driver-error-constants.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/constants/driver-error-constants.ts new file mode 100644 index 0000000000..e7007e0530 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/constants/driver-error-constants.ts @@ -0,0 +1,2 @@ +export const SUB_EXISTS = + "Event subscription already exists for requestId: {0}"; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/dbConnector.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/dbConnector.ts new file mode 100644 index 0000000000..20ea4f6e29 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/dbConnector.ts @@ -0,0 +1,286 @@ +/* + * Copyright IBM Corp. All Rights Reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Level } from "level"; +import * as path from "path"; +import { + ILoggerOptions, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import { delay } from "./utils"; + +/* + * Interfaces for all database connectors to be used for event subscriptions + */ +interface DBConnector { + // type of the DB (LevelDB, MongoDB, etc.) + DB_TYPE: string; + // name of the map + DB_NAME: string; + // connection to the DB + dbHandle: any; + + // open the database connection + open(): Promise; + // interface to add a pair to the database + insert(key: any, value: any): Promise; + // interface to read a key from the database + read(key: any): Promise; + // interface to update a key's value in the database + update(key: any, value: any): Promise; + // interface to delete a key from the database + delete(key: any): Promise; + // get iterator + filteredRead( + keyFilterCallback: (key: any, targetKey: any) => boolean, + targetKey: any, + ): Promise>; + // get All keys + getAllKeys(): Promise>; + // close the database connection + close(): Promise; +} + +// Implementation of DBConnector for LevelDB +class LevelDBConnector implements DBConnector { + private static readonly className = "LevelDBConnector"; + DB_TYPE: string = "Level"; + DB_NAME: string; + dbHandle: any; + dbOpenMaxRetries: number; + dbRetryBackoffTime: number; + + private readonly logger: Logger; + + constructor( + dbName: string, + retryTimeout: number = 0, + logLevel: LogLevelDesc = "INFO", + ) { + const loggerOptions: ILoggerOptions = { + level: logLevel, + label: LevelDBConnector.className, + }; + this.logger = LoggerProvider.getOrCreate(loggerOptions); + + if (!dbName || dbName.length == 0) { + dbName = "driverdb"; + } + this.DB_NAME = dbName; + this.dbHandle = new Level( + path.join( + process.env.DB_PATH ? process.env.DB_PATH : "./driverdbs", + dbName, + ), + { + valueEncoding: "json", + }, + ); + // Retry max attempts, default 250, making it 5 seconds for retries + this.dbOpenMaxRetries = process.env.LEVELDB_LOCKED_MAX_RETRIES + ? parseInt(process.env.LEVELDB_LOCKED_MAX_RETRIES) + : 250; + // Retry back off time in ms, default 20ms + this.dbRetryBackoffTime = process.env.LEVELDB_LOCKED_RETRY_BACKOFF_MSEC + ? parseInt(process.env.LEVELDB_LOCKED_RETRY_BACKOFF_MSEC) + : 20; + if (retryTimeout > 0) { + this.dbOpenMaxRetries = Math.floor( + retryTimeout / this.dbRetryBackoffTime, + ); + } + } + + async open(i: number = 0): Promise { + this.logger.debug(`attempt #${i} to open database ${this.DB_NAME}`); + try { + await this.dbHandle.open(); + } catch (error: any) { + if (i >= this.dbOpenMaxRetries) { + this.logger.error( + `failed to open database connection with error: ${error.toString()}`, + ); + if ( + error.code == "LEVEL_DATABASE_NOT_OPEN" && + error.cause && + error.cause.code == "LEVEL_LOCKED" + ) { + throw new DBLockedError(error.toString()); + } else { + throw new DBNotOpenError(error.toString()); + } + } else { + this.logger.debug( + `failed to open database connection with error: ${error.toString()}`, + ); + await delay(this.dbRetryBackoffTime); + await this.open(i + 1); + } + } + + return true; + } + + async insert(key: any, value: any): Promise { + try { + await this.dbHandle.put(key, value); + } catch (error: any) { + this.logger.error( + `failed to insert key ${JSON.stringify(key)} with error: ${error.toString()}`, + ); + if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + + return true; + } + + async read(key: any): Promise { + let value: any; + try { + value = await this.dbHandle.get(key); + this.logger.debug(`read() got value: ${JSON.stringify(value)}`); + } catch (error: any) { + this.logger.error( + `failed to read key ${JSON.stringify(key)} with error: ${error.toString()}`, + ); + if (error.code == "LEVEL_NOT_FOUND") { + throw new DBKeyNotFoundError(error.toString()); + } else if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + + return value; + } + + async update(key: any, value: any): Promise { + try { + await this.dbHandle.put(key, value); + } catch (error: any) { + this.logger.error( + `failed to update key ${JSON.stringify(key)} with error: ${error.toString()}`, + ); + if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + + return true; + } + + async delete(key: any): Promise { + let value: any; + try { + value = this.read(key); + await this.dbHandle.del(key); + } catch (error: any) { + this.logger.error( + `failed to delete key ${JSON.stringify(key)} with error: ${error.toString()}`, + ); + if (error.code == "LEVEL_NOT_FOUND") { + throw new DBKeyNotFoundError(error.toString()); + } else if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + + return value; + } + + async filteredRead( + keyFilterCallback: (key: any, targetKey: any) => boolean, + targetKey: any, + ): Promise> { + try { + const retVal = new Array(); + for await (const [key1, value1] of this.dbHandle.iterator()) { + if (keyFilterCallback(key1, targetKey)) { + retVal.push(value1); + } + } + + return retVal; + } catch (error: any) { + this.logger.error(`filteredRead error: ${error.toString()}`); + if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + } + + async close(): Promise { + try { + await this.dbHandle.close(); + } catch (error: any) { + this.logger.error( + `failed to close database connection with error: ${error.toString()}`, + ); + if (error.code == "LEVEL_DATABASE_NOT_OPEN") { + throw new DBNotOpenError(error.toString()); + } else { + throw new DBError(error.toString()); + } + } + + return true; + } + + async getAllKeys(): Promise> { + const keys = await this.dbHandle.keys().all(); + return keys; + } +} + +class DBKeyNotFoundError extends Error { + constructor(msg: string) { + super(`key not found in database: ${msg}`); + Object.setPrototypeOf(this, DBKeyNotFoundError.prototype); + } +} + +class DBNotOpenError extends Error { + constructor(msg: string) { + super(`database is not open: ${msg}`); + Object.setPrototypeOf(this, DBNotOpenError.prototype); + } +} + +class DBLockedError extends Error { + constructor(msg: string) { + super(`database already in use: ${msg}`); + Object.setPrototypeOf(this, DBLockedError.prototype); + } +} + +class DBError extends Error { + constructor(msg: string) { + super(`database error: ${msg}`); + Object.setPrototypeOf(this, DBError.prototype); + } +} + +export { + DBConnector, + LevelDBConnector, + DBLockedError, + DBKeyNotFoundError, + DBNotOpenError, + DBError, +}; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/eciesCrypto.js b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/eciesCrypto.js new file mode 100644 index 0000000000..7b418f165b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/eciesCrypto.js @@ -0,0 +1,374 @@ +/* + * Copyright IBM Corp. All Rights Reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* eslint-disable */ + +/* + * This file provides a function to encrypt and decrypt messages using the ECIES public key algorithm. + * It implements the specification in https://www.secg.org/sec1-v2.pdf + * It is designed to be compatible with the Golang implementation in the following repo: + * - https://godoc.org/github.com/ethereum/go-ethereum/crypto/ecies + * Any ciphertext generated by the encryption function in the Golang package can be decrypted + * using the function implemented here as long as the private key is available. Likewise, any message + * encrypted using the encryption function implemented here can be decrypted by the decryption + * function in the Golang package. + * + */ + +// requires +const crypto = require("crypto"); +const elliptic = require("elliptic"); +const sha3 = require("js-sha3"); +const sjcl = require("sjcl"); +const jsrsa = require("jsrsasign"); + +// constants +const SHA2 = "SHA2"; +const SHA3 = "SHA3"; +const AESKeyLength = 16; +const HMACKeyLength = 32; + +const ECIESKDFOutput = 512; // bits +const IVLength = 16; // bytes + +const CURVE_P_256_Size = 256; +const CURVE_P_384_Size = 384; + +/** Decrypt a message. + * + * @param {object} recipientPrivateKey the private key object. Format + * { + * ecparams: { keylen: {int} security level }, + * prvKeyHex: private key in HEX {string}, + * } + * - Using the 'jsrsasign' npm package + * - this private key can be a KJUR.crypto.ECDSA object, parsed from a PEM file + * - using 'jsrsasign.KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(pkcs8PEM)' + * + * @param {string} cipherText message to decrypt + * @param {object} options In the following format: + * { + * hashAlgorithm: hash algorithm, + * securityLevel: key size, + * } + * - 'hashAlgorithm': either 'SHA2' or 'SHA3' (NOTE: only the former is tested) + * + * @returns decrypted message as a Buffer. + * + * Comments below indicate a mapping between variables defined here and in the + * 'Decrypt(...)' function implemented in 'ecies.go' in the Golang package + */ +function eciesDecryptMessage( + recipientPrivateKey, + cipherText, + options, + aesKeyLength = AESKeyLength, +) { + const level = recipientPrivateKey.ecparams.keylen; + options.securityLevel = level; + processOption(options); + + const Rb_len = Math.floor((level + 7) / 8) * 2 + 1; // 'rLen' + const D_len = level >> 3; // 'hLen' + const ct_len = cipherText.length; // 'len(ct)' + + if (ct_len <= Rb_len + D_len) { + throw new Error( + `Illegal cipherText length: ${ct_len} must be > ${Rb_len + D_len}`, + ); + } + + const Rb = cipherText.slice(0, Rb_len); // ephemeral public key bytes + const EM = cipherText.slice(Rb_len, ct_len - D_len); // encrypted content bytes + const D = cipherText.slice(ct_len - D_len); + + const ecdsa = new elliptic.ec(`p${level}`); + + // convert bytes to usable key object + const ephPubKey = ecdsa.keyFromPublic(Buffer.from(Rb, "hex"), "hex"); // 'R' + const privKey = ecdsa.keyFromPrivate(recipientPrivateKey.prvKeyHex, "hex"); + + const Z = privKey.derive(ephPubKey.pub); // 'z' + // Append missing leading zeros to Z + let ZArray = Z.toArray(); + const zerosToAdd = 32 - ZArray.length; + for (let ii = 0; ii < zerosToAdd; ii++) { + ZArray = new Uint8Array([0, ...ZArray]); + } + // The 'null's below correspond to 's1' and 's2', + // which are both set to nil in golang implementation of the encryption function + const kdfOutput = hkdf(ZArray, ECIESKDFOutput, null, null, options); + + const kbuf = Buffer.from(kdfOutput); + const aesKey = kdfOutput.slice(0, aesKeyLength); // 'Ke' + const hmacKey = kdfOutput.slice(aesKeyLength, aesKeyLength + HMACKeyLength); + + const hmacKeyHash = new options.hashFunctionKeyDerivation(); + hmacKeyHash.update(bytesToBits(hmacKey)); + const hKm = bitsToBytes(hmacKeyHash.finalize()); // 'Km' + + const recoveredD = hmac(hKm, EM, options); + if (D.compare(Buffer.from(recoveredD)) !== 0) { + throw new Error("HMAC verify failed"); + } + const iv = EM.slice(0, IVLength); + // The go-ethereum crypto/ecies package that encrypts/decrypts data uses AES-128-CTR by default for signing certs currently generated by Fabric + let aesAlgorithm; + if (aesKeyLength === 16) { + aesAlgorithm = "aes-128-ctr"; + } else if (aesKeyLength === 32) { + aesAlgorithm = "aes-256-ctr"; + } else { + throw new Error("Invalid AES key length supplied: " + aesKeyLength); + } + const cipher = crypto.createDecipheriv(aesAlgorithm, Buffer.from(aesKey), iv); + const decryptedBytes = cipher.update(EM.slice(IVLength)); + return decryptedBytes; +} + +/** Encrypt a message. + * + * @param {object} recipientPublicKey the private key object. Format + * { + * ecparams: { keylen: {int} security level }, + * pubKeyHex: public key in HEX {string}, + * } + * - Using the 'jsrsasign' npm package + * - this public key can be a KJUR.crypto.ECDSA object, parsed from an X.509 certificate PEM file + * - using 'jsrsasign.KEYUTIL.getKey(pemX509Certificate)' + * + * @param {string} cipherText message to encrypt + * @param {object} options In the following format: + * { + * hashAlgorithm: hash algorithm, + * securityLevel: key size, + * } + * - 'hashAlgorithm': either 'SHA2' or 'SHA3' (NOTE: only the former is tested) + * + * @returns encrypted message as a Buffer. + * + */ +function eciesEncryptMessage( + recipientPublicKey, + msg, + options, + aesKeyLength = AESKeyLength, +) { + const level = recipientPublicKey.ecparams.keylen; + options.securityLevel = level; + processOption(options); + + const ecdsa = new elliptic.ec(`p${level}`); + const pubKey = ecdsa.keyFromPublic(recipientPublicKey.pubKeyHex, "hex"); + + // Generate ephemeral key-pair + const ephKeyPair = jsrsa.KEYUTIL.generateKeypair("EC", options.curveName); + const ephPrivKey = ecdsa.keyFromPrivate( + ephKeyPair.prvKeyObj.prvKeyHex, + "hex", + ); + const Rb = ephKeyPair.pubKeyObj.pubKeyHex; + + // Derive a shared secret field element z from the ephemeral secret key k + // and convert z to an octet string Z + const Z = ephPrivKey.derive(pubKey.pub); + const kdfOutput = hkdf(Z.toArray(), ECIESKDFOutput, null, null, options); + + const aesKey = kdfOutput.slice(0, aesKeyLength); + const hmacKey = kdfOutput.slice(aesKeyLength, aesKeyLength + HMACKeyLength); + + const hmacKeyHash = new options.hashFunctionKeyDerivation(); + hmacKeyHash.update(bytesToBits(hmacKey)); + const hKm = bitsToBytes(hmacKeyHash.finalize()); + + const iv = crypto.randomBytes(IVLength); + // The go-ethereum crypto/ecies package that encrypts/decrypts data uses AES-128-CTR by default for signing certs currently generated by Fabric + let aesAlgorithm; + if (aesKeyLength === 16) { + aesAlgorithm = "aes-128-ctr"; + } else if (aesKeyLength === 32) { + aesAlgorithm = "aes-256-ctr"; + } else { + throw new Error("Invalid AES key length supplied: " + aesKeyLength); + } + const cipher = crypto.createCipheriv(aesAlgorithm, Buffer.from(aesKey), iv); + const encryptedBytes = cipher.update(msg); + const EM = Buffer.concat([iv, encryptedBytes]); + const D = hmac(hKm, EM, options); + + return Buffer.concat([Buffer.from(Rb, "hex"), EM, Buffer.from(D)]); +} + +function checkSecurityLevel(securityLevel) { + if (securityLevel !== 256 && securityLevel !== 384) + throw new Error( + `Illegal level: ${this.securityLevel} - must be either 256 or 384`, + ); +} + +function checkHashFunction(hashAlgorithm) { + if (!isString(hashAlgorithm)) + throw new Error( + `Illegal Hash function family: ${hashAlgorithm} - must be either SHA2 or SHA3`, + ); + + const hashAlgorithmUpper = hashAlgorithm.toUpperCase(); + if (hashAlgorithmUpper !== SHA2 && hashAlgorithmUpper !== SHA3) + throw new Error( + `Illegal Hash function family: ${hashAlgorithm} - must be either SHA2 or SHA3`, + ); +} + +function processOption(options) { + checkSecurityLevel(options.securityLevel); + checkHashFunction(options.hashAlgorithm); + + options.suite = `${options.hashAlgorithm.toLowerCase()}-${options.securityLevel}`; + + if (options.securityLevel === CURVE_P_256_Size) { + options.curveName = "secp256r1"; + } else if (options.securityLevel === CURVE_P_384_Size) { + options.curveName = "secp384r1"; + } + + switch (options.suite) { + case "sha3-256": + options.hashFunctionKeyDerivation = sha3.sha3_256; + options.hashOutputSize = 32; + break; + case "sha3-384": + options.hashFunctionKeyDerivation = sha3.sha3_384; + options.hashOutputSize = 48; + break; + case "sha2-256": + options.hashFunctionKeyDerivation = sjcl.hash.sha256; + options.hashOutputSize = 32; + break; + default: + throw new Error(`Suite ${options.suite} not found.`); + } + + switch (options.securityLevel) { + case 256: + options.ecdsaCurve = elliptic.curves.p256; + break; + case 384: + options.ecdsaCurve = elliptic.curves.p384; + break; + default: + throw new Error(`Security level ${options.securityLevel} not found.`); + } + + return options; +} + +function hkdf(ikm, keyBitLength, salt, info, options) { + if (!salt) salt = createZeroBuffer(options.hashOutputSize); + if (!info) info = ""; + + const key = hkdf2( + bytesToBits(Buffer.from(ikm)), + keyBitLength, + bytesToBits(salt), + info, + options.hashFunctionKeyDerivation, + ); + + return bitsToBytes(key); +} + +function hkdf2(ikm, keyBitLength, salt, info, Hash) { + let hmac; + let i; + let curOut; + let ret = []; + + if (typeof info === "string") { + info = sjcl.codec.utf8String.toBits(info); + } else if (!info) { + info = sjcl.codec.utf8String.toBits(""); + } + if (typeof salt === "string") { + salt = sjcl.codec.utf8String.toBits(salt); + } else if (!salt) { + salt = []; + } + + hmac = new sjcl.misc.hmac(salt, Hash); + hmac.update(ikm); + const key = hmac.digest(); + const hashLen = sjcl.bitArray.bitLength(key); + + const loops = Math.ceil(keyBitLength / hashLen); + if (loops > 255) { + throw new sjcl.exception.invalid("key bit length is too large for hkdf"); + } + + const counter = [0, 0, 0, 1]; + curOut = []; + for (i = 1; i <= loops; i++) { + hmac = new Hash(); + hmac.update(bytesToBits(counter)); + hmac.update(ikm); + hmac.update(bytesToBits(info)); + ret = sjcl.bitArray.concat(hmac.finalize(), curOut); + } + return sjcl.bitArray.clamp(ret, keyBitLength); +} + +function hmac(key, bytes, options) { + const hmac = new sjcl.misc.hmac( + bytesToBits(key), + options.hashFunctionKeyDerivation, + ); + hmac.update(bytesToBits(bytes)); + const result = hmac.digest(); + return bitsToBytes(result); +} + +function bitsToBytes(arr) { + const out = []; + const bl = sjcl.bitArray.bitLength(arr); + let tmp; + for (let i = 0; i < bl / 8; i++) { + if ((i & 3) === 0) { + tmp = arr[i / 4]; + } + out.push(tmp >>> 24); + tmp <<= 8; + } + return out; +} + +function bytesToBits(bytes) { + const out = []; + let i; + let tmp = 0; + for (i = 0; i < bytes.length; i++) { + tmp = (tmp << 8) | bytes[i]; + if ((i & 3) === 3) { + out.push(tmp); + tmp = 0; + } + } + if (i & 3) { + out.push(sjcl.bitArray.partial(8 * (i & 3), tmp)); + } + return out; +} + +function createZeroBuffer(length) { + const buf = Buffer.alloc(length); + buf.fill(0); + return buf; +} + +function isString(obj) { + return typeof obj === "string" || obj instanceof String; +} + +module.exports.eciesDecryptMessage = eciesDecryptMessage; +module.exports.eciesEncryptMessage = eciesEncryptMessage; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/events.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/events.ts new file mode 100644 index 0000000000..e2f9e03061 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/events.ts @@ -0,0 +1,646 @@ +import { create, fromBinary, toBinary } from "@bufbuild/protobuf"; +import { + ILoggerOptions, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import { + ContractTransaction, + EventMatcher, + EventMatcherSchema, + EventSubscription, + EventSubscriptionSchema, +} from "../generated/protos/common/events_pb"; +import { View, ViewSchema } from "../generated/protos/common/state_pb"; +import { + FabricContractInvocationType, + FabricSigningCredential, + GatewayOptions, + PluginLedgerConnectorFabric, +} from "../public-api"; +import { checkIfArraysAreEqual, handlePromise, relayCallback } from "./utils"; +import * as InteroperableHelper from "./weaver-fabric-sdk"; +import { Ack_STATUS, AckSchema } from "../generated/protos/common/ack_pb"; +import { EventSubscribe } from "../generated/protos/relay/events_pb"; +import { Client } from "@connectrpc/connect"; +import { WriteExternalStateMessage } from "../generated/protos/driver/driver_pb"; +import * as DRIVER_ERROR_CONSTANTS from "./constants/driver-error-constants"; +import { + DBConnector, + DBKeyNotFoundError, + LevelDBConnector, +} from "./dbConnector"; +import { Query, QuerySchema } from "../generated/protos/common/query_pb"; +import { Listener } from "./listener"; +import { FabricDriverServer } from "./fabric-driver-server"; +import { signMessage } from "./weaver-fabric-sdk"; + +export interface IEventsOptions { + logLevel: LogLevelDesc; + driver: FabricDriverServer; + certificate: any; +} + +const DB_NAME: string = "driverdb"; +export class Events { + public static readonly className = "Events"; + private readonly logger: Logger; + private readonly connector: PluginLedgerConnectorFabric; + + private listener: Listener; + + private certificate: any; + + constructor(options: IEventsOptions) { + const logOptions: ILoggerOptions = { + level: options.logLevel, + label: Events.className, + }; + this.logger = LoggerProvider.getOrCreate(logOptions); + this.connector = options.driver.getConnectorInstance(); + this.listener = options.driver.getListenerInstance(); + this.certificate = options.certificate; + } + + async subscribeEventHelper( + call_request: EventSubscription, + client: Client, + gatewayOptions: GatewayOptions, + ) { + const newRequestId = call_request.query!.requestId; + const [requestId, error] = await handlePromise( + this.addEventSubscription(call_request), + ); + if (error) { + const errorString: string = `error (thrown as part of async processing while storing to DB during subscribeEvent): ${error.toString()}`; + this.logger.error(errorString); + const ack_send_error = create(AckSchema, { + requestId: newRequestId, + message: errorString, + status: Ack_STATUS.ERROR, + }); + + // gRPC response. + this.logger.info( + `Sending to the relay the eventSubscription error Ack: ${JSON.stringify(ack_send_error)}`, + ); + + // Sending the fabric state to the relay. + client + .sendDriverSubscriptionStatus(ack_send_error) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } else { + const ack_send = create(AckSchema, {}); + this.logger.debug(`${newRequestId}, ${requestId}`); + if (newRequestId == requestId) { + // event being subscribed for the first time + // Start an appropriate type of event listener for this event subscription if one is not already active + const [, error] = await handlePromise( + this.listener.registerListenerForEventSubscription( + call_request.eventMatcher!, + gatewayOptions, + ), + ); + if (error) { + // Need to delete subscription in database too, for consistency + const [, err] = await handlePromise( + this.deleteEventSubscription( + call_request.eventMatcher!, + newRequestId, + ), + ); + if (err) { + const errorString: string = err.toString(); + this.logger.error(errorString); + } + const errorString2 = error.toString(); + this.logger.error(errorString2); + ack_send.message = `Event subscription error: listener registration failed with error: ${errorString2}`; + ack_send.status = Ack_STATUS.ERROR; + } else { + ack_send.message = "Event subscription is successful!"; + ack_send.status = Ack_STATUS.OK; + } + } else { + // event being subscribed already exists + const subExistsErrorMsg = DRIVER_ERROR_CONSTANTS.SUB_EXISTS.replace( + "{0}", + requestId as string, + ); + ack_send.message = subExistsErrorMsg; + ack_send.status = Ack_STATUS.ERROR; + } + ack_send.requestId = newRequestId; + + // gRPC response. + this.logger.info( + `Sending to the relay the eventSubscription Ack: ${JSON.stringify(ack_send)}`, + ); + + if (!process.env.RELAY_ENDPOINT) { + throw new Error("RELAY_ENDPOINT is not set."); + } + + // Sending the fabric state to the relay. + client + .sendDriverSubscriptionStatus(ack_send) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } + } + + async unsubscribeEventHelper( + call_request: EventSubscription, + client: Client, + gatewayOptions: GatewayOptions, + ) { + const [unregister, err] = await handlePromise( + this.listener.unregisterListenerForEventSubscription( + call_request.eventMatcher!, + gatewayOptions, + ), + ); + if (!unregister) { + // Just log a warning. This is not critical. + this.logger.warn( + "No listener running for the given subscription or unable to stop listener", + ); + } + if (err) { + // Just log the error. This is not critical. + const errorString: string = err.toString(); + this.logger.error(errorString); + } + const newRequestId = call_request.query!.requestId; + const [deletedSubscription, error] = await handlePromise( + this.deleteEventSubscription(call_request.eventMatcher!, newRequestId), + ); + if (error) { + const errorString: string = `error (thrown as part of async processing while deleting from DB during unsubscribeEvent): ${error.toString()}`; + this.logger.error(errorString); + const ack_send_error = create(AckSchema, { + requestId: newRequestId, + message: errorString, + status: Ack_STATUS.ERROR, + }); + // gRPC response. + this.logger.info( + `Sending to the relay the eventSubscription error Ack: ${JSON.stringify(ack_send_error)}`, + ); + // Sending the fabric state to the relay. + client + .sendDriverSubscriptionStatus(ack_send_error) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } else { + const ack_send = create(AckSchema, { + requestId: newRequestId, + // event got unsubscribed + message: `Event ${JSON.stringify(deletedSubscription)} unsubscription was successful!`, + status: Ack_STATUS.OK, + }); + + // gRPC response. + this.logger.info( + `Sending to the relay the eventSubscription Ack: ${JSON.stringify(ack_send)}`, + ); + + if (!process.env.RELAY_ENDPOINT) { + throw new Error("RELAY_ENDPOINT is not set."); + } + + // Sending the fabric state to the relay. + client + .sendDriverSubscriptionStatus(ack_send) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } + } + + async writeExternalStateHelper( + writeExternalStateMessage: WriteExternalStateMessage, + signingCredential: FabricSigningCredential, + ) { + if (!writeExternalStateMessage.viewPayload) { + throw new Error("No viewPayload provided in WriteExternalStateMessage"); + } + + const viewPayload = writeExternalStateMessage.viewPayload; + + if (!writeExternalStateMessage.ctx) { + throw new Error("No context provided in WriteExternalStateMessage"); + } + const ctx: ContractTransaction = writeExternalStateMessage.ctx; + const keyCert = ( + await this.connector + .getCertStore() + .get(signingCredential.keychainId, signingCredential.keychainRef) + ).credentials; + + if (!keyCert || !keyCert.privateKey || !keyCert.certificate) { + throw new Error("No signing credential found"); + } + + if (viewPayload.state.case == "view") { + const interopArgIndices = [], + viewsSerializedBase64 = [], + addresses = [], + viewContentsBase64 = []; + const view: View = viewPayload.state.value; + + const privKeyPEM = keyCert?.privateKey + ? Buffer.from(keyCert.privateKey, "base64") + : null; + + const result = InteroperableHelper.getResponseDataFromView( + view, + privKeyPEM as any, + ); + if (result.contents) { + viewContentsBase64.push(result.contents); + } else { + viewContentsBase64.push([]); + } + + interopArgIndices.push(ctx.replaceArgIndex); + addresses.push(result.viewAddress); + viewsSerializedBase64.push( + Buffer.from(toBinary(ViewSchema, view)).toString("base64"), + ); + + const ccArgsB64 = ctx.args; + const ccArgsStr = []; + for (const ccArgB64 of ccArgsB64) { + ccArgsStr.push(Buffer.from(ccArgB64).toString("utf8")); + } + const invokeObject = { + channel: ctx.ledgerId, + ccFunc: ctx.func, + ccArgs: ccArgsStr, + contractName: ctx.contractId, + }; + this.logger.info( + `writing external state to contract: ${ctx.contractId} with function: ${ctx.func}, and args: ${invokeObject.ccArgs} on channel: ${ctx.ledgerId}`, + ); + + const [response, responseError] = await handlePromise( + this.connector.transact({ + channelName: ctx.ledgerId, + contractName: process.env.INTEROP_CHAINCODE + ? process.env.INTEROP_CHAINCODE + : "interop", + methodName: "WriteExternalState", + invocationType: FabricContractInvocationType.Send, + params: [ + ctx.contractId, + ctx.ledgerId, + ctx.func, + JSON.stringify(ccArgsStr), + JSON.stringify(interopArgIndices), + JSON.stringify(addresses), + JSON.stringify(viewsSerializedBase64), + JSON.stringify(viewContentsBase64), + ], + signingCredential: signingCredential, + endorsingOrgs: ctx.members, + }), + ); + + if (responseError) { + this.logger.error( + `Failed writing to the ledger with error: ${responseError}`, + ); + throw responseError; + } + this.logger.debug( + `write external state response: ${JSON.stringify(response)}`, + ); + this.logger.debug(`write successful`); + } else { + const errorString: string = `erroneous viewPayload identified in WriteExternalState processing`; + this.logger.error( + `error viewPayload.getError(): ${JSON.stringify(viewPayload.state.value)}`, + ); + throw new Error(errorString); + } + } + + async addEventSubscription(eventSub: EventSubscription): Promise { + this.logger.info( + `adding to driver, subscription of the eventSub: ${JSON.stringify(eventSub)}`, + ); + let db: DBConnector | undefined; + try { + // Create connection to a database + db = new LevelDBConnector(DB_NAME!); + await db.open(); + + // eventMatcher need to be non-null, hence apply the NaN assertion operator '!' + const eventMatcher: EventMatcher = eventSub.eventMatcher!; + // the serialized protobuf for eventMatcher below can be decoded to other formats like 'utf8' [.toString('utf8')] + const key: string = Buffer.from( + toBinary(EventMatcherSchema, eventMatcher), + ).toString("base64"); + + // query need to be non-null, hence apply the NaN assertion operator '!' + const query: Query = eventSub.query!; + // the serialized protobuf for query below can be decoded to other formats like 'utf8' [.toString('utf8')] + const querySerialized: string = Buffer.from( + toBinary(QuerySchema, query), + ).toString("base64"); + // serialized content of subscriptions is the value present in the key/value LevelDB corresponding to the key + let subscriptions: Array; + + try { + // fetch the current values in the DB against the given key + const subscriptionsSerialized: string = (await db.read(key)) as string; + subscriptions = JSON.parse(subscriptionsSerialized); + + this.logger.debug( + `existing subscriptions.length: ${subscriptions.length}`, + ); + // check if the event to be subscribed is already present in the DB + for (const subscriptionSerialized of subscriptions) { + const subscription: Query = fromBinary( + QuerySchema, + Uint8Array.from(Buffer.from(subscriptionSerialized, "base64")), + ); + if ( + checkIfArraysAreEqual(subscription.policy, query.policy) && + subscription.address == query.address && + subscription.requestingRelay == query.requestingRelay && + subscription.requestingNetwork == query.requestingNetwork && + subscription.certificate == query.certificate && + subscription.requestingOrg == query.requestingOrg && + subscription.confidential == query.confidential + ) { + this.logger.info( + `found subscription for query with requestId: ${subscription.requestId}`, + ); + await db.close(); + return subscription.requestId; + } + } + + // case of key being present in the list + this.logger.debug( + `eventMatcher: ${JSON.stringify(eventMatcher)} is already present in the database`, + ); + subscriptions.push(querySerialized); + } catch (error: any) { + const errorString = error.toString(); + if (error instanceof DBKeyNotFoundError) { + // case of read failing due to key not found + this.logger.debug( + `eventMatcher: ${JSON.stringify(eventMatcher)} is not present before in the database`, + ); + subscriptions = new Array(); + subscriptions.push(querySerialized); + } else { + // case of read failing due to some other issue + this.logger.error(`re-throwing error: ${errorString}`); + await db.close(); + throw new Error(error); + } + } + + this.logger.debug(`new subscriptions.length: ${subscriptions.length}`); + const subscriptionsSerialized = JSON.stringify(subscriptions); + // insert the value against key in the DB (it can be the scenario of a new key addition, or update to the value of an existing key) + await db.insert(key, subscriptionsSerialized); + await db.close(); + + // TODO: register the event with fabric sdk + this.logger.debug( + `end addEventSubscription() .. requestId: ${query.requestId}`, + ); + return query.requestId; + } catch (error: any) { + this.logger.error( + `Error during addEventSubscription(): ${error.toString()}`, + ); + await db?.close(); + throw new Error(error); + } + } + + deleteEventSubscription = async ( + eventMatcher: EventMatcher, + requestId: string, + ): Promise => { + this.logger.info( + `deleting from driver subscription of the eventMatcher: ${JSON.stringify(eventMatcher)} with requestId: ${requestId}`, + ); + let subscriptions: Array; + const retVal: EventSubscription = create(EventSubscriptionSchema, { + eventMatcher: eventMatcher, + }); + let db: DBConnector | undefined; + try { + // Create connection to a database + db = new LevelDBConnector(DB_NAME!); + await db.open(); + + const key: string = Buffer.from( + toBinary(EventMatcherSchema, eventMatcher), + ).toString("base64"); + try { + // fetch the current values in the DB against the given key + const subscriptionsSerialized: string = (await db.read(key)) as string; + subscriptions = JSON.parse(subscriptionsSerialized); + + this.logger.debug(`subscriptions.length: ${subscriptions.length}`); + let foundEntry: boolean = false; + for (const subscriptionSerialized of subscriptions) { + const subscription: Query = fromBinary( + QuerySchema, + Uint8Array.from(Buffer.from(subscriptionSerialized, "base64")), + ); + if (subscription.requestId == requestId) { + this.logger.debug( + `deleting the subscription (with input requestId): ${JSON.stringify(subscription)}`, + ); + subscriptions.splice( + subscriptions.indexOf(subscriptionSerialized), + 1, + ); + retVal.query = subscription; + foundEntry = true; + break; + } + } + + if (!foundEntry) { + throw new Error( + `event subscription with requestId: ${requestId} is not found!`, + ); + } + } catch (error: any) { + // error could be either due to key not being present in the database or some other issue with database access + this.logger.error(`re-throwing error: ${error.toString()}`); + await db.close(); + throw new Error(error); + } + + this.logger.debug(`subscriptions.length: ${subscriptions.length}`); + if (subscriptions.length == 0) { + await db.delete(key); + } else { + const subscriptionsSerialized = JSON.stringify(subscriptions); + await db.insert(key, subscriptionsSerialized); + } + + await db.close(); + this.logger.debug( + `end deleteEventSubscription() .. retVal: ${JSON.stringify(retVal)}`, + ); + return retVal; + } catch (error: any) { + this.logger.error(`Error during delete: ${error.toString()}`); + await db?.close(); + throw new Error(error); + } + }; + + async lookupEventSubscriptions( + eventMatcher: EventMatcher, + ): Promise> { + this.logger.debug( + `finding the subscriptions with eventMatcher: ${JSON.stringify(eventMatcher)}`, + ); + let subscriptions: Array; + let returnSubscriptions: Array = new Array(); + let db: DBConnector | undefined; + + try { + // Create connection to a database + db = new LevelDBConnector(DB_NAME!); + await db.open(); + + for (const subscriptionsSerialized of await db.filteredRead( + this.filterEventMatcher, + eventMatcher, + )) { + subscriptions = JSON.parse(subscriptionsSerialized); + for (const subscriptionSerialized of subscriptions) { + const subscription: Query = fromBinary( + QuerySchema, + new Uint8Array(Buffer.from(subscriptionSerialized, "base64")), + ); + this.logger.debug(`subscription: ${JSON.stringify(subscription)}`); + returnSubscriptions.push(subscription); + } + } + + this.logger.info( + `found ${returnSubscriptions.length} matching subscriptions`, + ); + this.logger.debug(`end lookupEventSubscriptions()`); + await db.close(); + return returnSubscriptions; + } catch (error: any) { + const errorString: string = error.toString(); + await db?.close(); + if (error instanceof DBKeyNotFoundError) { + // case of read failing due to key not found + returnSubscriptions = new Array(); + this.logger.info( + `found ${returnSubscriptions.length} matching subscriptions`, + ); + return returnSubscriptions; + } else { + // case of read failing due to some other issue + this.logger.error(`Error during lookup: ${errorString}`); + throw new Error(error); + } + } + } + + async signEventSubscriptionQuery(inputQuery: Query): Promise { + this.logger.info( + `driver ready to provide sign on query: ${JSON.stringify(inputQuery)}`, + ); + let signedQuery: Query; + + try { + signedQuery = create(QuerySchema, { + policy: inputQuery.policy, + address: inputQuery.address, + requestingRelay: inputQuery.requestingRelay, + requestingNetwork: inputQuery.requestingNetwork, + requestingOrg: inputQuery.requestingOrg, + nonce: inputQuery.nonce, + requestId: inputQuery.requestId, + confidential: inputQuery.confidential, + certificate: this.certificate.cert, + requestorSignature: signMessage( + inputQuery.address + inputQuery.nonce, + this.certificate.key.toBytes(), + ), + }); + return signedQuery; + } catch (error: any) { + const errorString: string = `${error.toString()}`; + this.logger.error(`signing query failed with error: ${errorString}`); + throw new Error(error); + } + } + + async readAllEventMatchers(): Promise> { + const returnMatchers = []; + let db: DBConnector; + this.logger.debug(`start readAllEventMatchers()`); + try { + // Create connection to a database + db = new LevelDBConnector(DB_NAME!); + await db.open(); + const keys = await db.getAllKeys(); + for (const key of keys) { + const eventMatcher = fromBinary( + EventMatcherSchema, + Uint8Array.from(Buffer.from(key, "base64")), + ); + returnMatchers.push(eventMatcher); + } + this.logger.info(`found ${returnMatchers.length} eventMatchers`); + this.logger.debug(`end readAllEventMatchers()`); + await db.close(); + return returnMatchers; + } catch (error: any) { + const errorString: string = error.toString(); + await db!.close(); + // case of read failing due to some other issue + this.logger.error(`Error during read: ${errorString}`); + throw new Error(error); + } + } + + filterEventMatcher( + keySerialized: string, + eventMatcher: EventMatcher, + ): boolean { + const item: EventMatcher = fromBinary( + EventMatcherSchema, + new Uint8Array(Buffer.from(keySerialized, "base64")), + ); + + this.logger.debug(`eventMatcher from db: ${JSON.stringify(item)}`); + if ( + (eventMatcher.eventClassId == "*" || + eventMatcher.eventClassId == item.eventClassId) && + (eventMatcher.transactionContractId == "*" || + eventMatcher.transactionContractId == item.transactionContractId) && + (eventMatcher.transactionLedgerId == "*" || + eventMatcher.transactionLedgerId == item.transactionLedgerId) && + (eventMatcher.transactionFunc == "*" || + eventMatcher.transactionFunc.toLowerCase() == + item.transactionFunc.toLowerCase()) + ) { + return true; + } else { + return false; + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/fabric-driver-server.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/fabric-driver-server.ts new file mode 100644 index 0000000000..c0f9a78955 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/fabric-driver-server.ts @@ -0,0 +1,617 @@ +import { + ILoggerOptions, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import { Client, ConnectRouter, createClient } from "@connectrpc/connect"; +import { createGrpcTransport } from "@connectrpc/connect-node"; +import { + DriverCommunication, + WriteExternalStateMessage, +} from "../generated/protos/driver/driver_pb"; +import { Query } from "../generated/protos/common/query_pb"; +import { + Meta_Protocol, + MetaSchema, + ViewPayload, + ViewPayloadSchema, +} from "../generated/protos/common/state_pb"; +import { QuerySchema } from "../generated/protos/common/query_pb"; +import { create, toBinary } from "@bufbuild/protobuf"; +import { FabricViewSchema } from "../generated/protos/fabric/view_data_pb"; +import { DataTransfer } from "../generated/protos/relay/datatransfer_pb"; +import { fromBinary } from "@bufbuild/protobuf"; +import { PluginLedgerConnectorFabric } from "../plugin-ledger-connector-fabric"; +import { FabricSigningCredential, GatewayOptions } from "../public-api"; +import { Ack, Ack_STATUS, AckSchema } from "../generated/protos/common/ack_pb"; +import { + delay, + handlePromise, + parseAddress, + relayCallback, + transformToFabricView, +} from "./utils"; +import { Events } from "./events"; +import { + EventPublish, + EventSubscribe, +} from "../generated/protos/relay/events_pb"; +import { Listener } from "./listener"; +import { + EventSubOperation, + EventSubscription, +} from "../generated/protos/common/events_pb"; +import { dbConnectionTest, eventSubscriptionTest } from "./tests"; +import path from "path"; +import { getDriverKeyCert, walletSetup } from "./walletSetup"; +import { IKeyValueAttribute } from "fabric-ca-client"; +import { DiscoveryOptions, Wallet } from "fabric-network"; + +export interface DriverConfig { + admin?: { + name?: string; + secret?: string; + }; + relay?: { + name?: string; + affiliation?: string; + role?: string; + attrs?: IKeyValueAttribute[]; + }; + mspId?: string; + caUrl?: string; +} + +export interface FabricDriverServerOptions { + logLevel?: LogLevelDesc; + mock?: boolean; + networkName?: string; + monitorSyncPeriod?: string; + monitorEnabled?: boolean; + driverConfig: DriverConfig; + connector: PluginLedgerConnectorFabric; + relayEndpoint: string; + tls?: boolean; + walletPath?: string; + interopChainCode?: string; + discoveryOptions?: DiscoveryOptions; + certificate: any; + gatewayOptions: GatewayOptions; +} + +const mockedB64Data = + "CkIIyAEaPRI7bG9jYWxob3N0OjkwODAvbmV0d29yazEvbXljaGFubmVsOnNpbXBsZXN0YXRlOlJlYWQ6QXJjdHVydXMa/AIKIFhDpf9CYfrxPkEtSWR8Kf+K5pBkSbx7VNYsAzijB+pnEtcCCoICEmYKCl9saWZlY3ljbGUSWAooCiJuYW1lc3BhY2VzL2ZpZWxkcy9pbnRlcm9wL1NlcXVlbmNlEgIIAwosCiZuYW1lc3BhY2VzL2ZpZWxkcy9zaW1wbGVzdGF0ZS9TZXF1ZW5jZRICCAYSYwoHaW50ZXJvcBJYCh4KGABhY2Nlc3NDb250cm9sAG5ldHdvcmsxABICCAsKHgoYAHNlY3VyaXR5R3JvdXAAbmV0d29yazEAEgIIDQoWChAA9I+/v2luaXRpYWxpemVkEgIIBBIzCgtzaW1wbGVzdGF0ZRIkChYKEAD0j7+/aW5pdGlhbGl6ZWQSAggHCgoKCEFyY3R1cnVzGkIIyAEaPRI7bG9jYWxob3N0OjkwODAvbmV0d29yazEvbXljaGFubmVsOnNpbXBsZXN0YXRlOlJlYWQ6QXJjdHVydXMiDBIHaW50ZXJvcBoBMSK1CArpBwoHT3JnMU1TUBLdBy0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQpNSUlDckRDQ0FsT2dBd0lCQWdJVVdNUkUyTEJwdnY1TkdSRi9hMy82cWZTcE9TNHdDZ1lJS29aSXpqMEVBd0l3CmNqRUxNQWtHQTFVRUJoTUNWVk14RnpBVkJnTlZCQWdURGs1dmNuUm9JRU5oY205c2FXNWhNUTh3RFFZRFZRUUgKRXdaRWRYSm9ZVzB4R2pBWUJnTlZCQW9URVc5eVp6RXVibVYwZDI5eWF6RXVZMjl0TVIwd0d3WURWUVFERXhSagpZUzV2Y21jeExtNWxkSGR2Y21zeExtTnZiVEFlRncweU1EQTNNamt3TkRNMk1EQmFGdzB5TVRBM01qa3dORFF4Ck1EQmFNRnN4Q3pBSkJnTlZCQVlUQWxWVE1SY3dGUVlEVlFRSUV3NU9iM0owYUNCRFlYSnZiR2x1WVRFVU1CSUcKQTFVRUNoTUxTSGx3WlhKc1pXUm5aWEl4RFRBTEJnTlZCQXNUQkhCbFpYSXhEakFNQmdOVkJBTVRCWEJsWlhJdwpNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUU1RlFrSDgzRVdnYW9DZ2U5azhISU1Jd0NUVGVZCnFCR25xNFAzWHJCUGZQSFdXeE1oWGhBaDNvUHNUOXdna1dHcFVmYWlybkd0bmRBQ3ZrSitNQi9nMUtPQjNUQ0IKMmpBT0JnTlZIUThCQWY4RUJBTUNCNEF3REFZRFZSMFRBUUgvQkFJd0FEQWRCZ05WSFE0RUZnUVVLMkFuM3RCTAprMVQyRGord0hHZ1RIQ3NiYmlZd0h3WURWUjBqQkJnd0ZvQVUxZyt0UG5naDJ3OGc5OXoxbXdzVmJrS2pBS2t3CklnWURWUjBSQkJzd0dZSVhjR1ZsY2pBdWIzSm5NUzV1WlhSM2IzSnJNUzVqYjIwd1ZnWUlLZ01FQlFZSENBRUUKU25zaVlYUjBjbk1pT25zaWFHWXVRV1ptYVd4cFlYUnBiMjRpT2lJaUxDSm9aaTVGYm5KdmJHeHRaVzUwU1VRaQpPaUp3WldWeU1DSXNJbWhtTGxSNWNHVWlPaUp3WldWeUluMTlNQW9HQ0NxR1NNNDlCQU1DQTBjQU1FUUNJQmFRCjhoTmRXd2xYeUhxY2htQzdzVUpWaER6Mkg2enh3M1BQS1I5M3lCL3NBaUJKMnpnQlhzL1lsMGZubnJNUXVCQUQKcDFBS1RKTkpsMVYwWUVHMFhiNXFwZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KEkcwRQIhAMyyvrcjHVc1oQmCNqZpH6nc0O+8wssXjwRcfmgxlhQAAiAqa0C8pSFNZNXiSVJHe948dJ0NU/y+7i5A55O0Frkz2Q=="; + +export class FabricDriverServer { + public static readonly className = "FabricDriverServer"; + private readonly logger: Logger; + private readonly loglevel: LogLevelDesc; + private readonly relayEndpoint: string; + private readonly mock: boolean; + private readonly events: Events; + private readonly listener: Listener; + + private networkName: string = "network1"; + private monitorSyncPeriod: number = 30; // in seconds + private monitorEnabled: boolean = false; + private driverConfig: DriverConfig; + + private connector: PluginLedgerConnectorFabric; + + private interopChainCode: string = "interop"; + + private tls: boolean = false; + + private walletPath: string = path.join( + process.cwd(), + `wallet-${this.networkName}`, + ); + + private certificate: any; + + private wallet: Wallet | undefined; + + private discoveryOptions: DiscoveryOptions = { + enabled: true, + asLocalhost: true, + }; + + private gatewayOptions: GatewayOptions; + + constructor(options: FabricDriverServerOptions) { + this.loglevel = options.logLevel || "INFO"; + const logOptions: ILoggerOptions = { + level: this.loglevel, + label: FabricDriverServer.className, + }; + this.logger = LoggerProvider.getOrCreate(logOptions); + + if (options.mock === undefined) { + this.mock = false; + } else this.mock = options.mock; + + if (options.walletPath) { + this.walletPath = options.walletPath; + } + + if (options.discoveryOptions) { + this.discoveryOptions = options.discoveryOptions; + } + + this.gatewayOptions = options.gatewayOptions; + + if (options.interopChainCode) { + this.interopChainCode = options.interopChainCode; + } + + this.certificate = options.certificate; + + this.events = new Events({ + logLevel: this.loglevel, + driver: this, + certificate: this.certificate, + }); + + this.listener = new Listener({ + logLevel: this.loglevel, + driver: this, + chainCodeId: this.interopChainCode, + }); + + if (options.networkName) { + this.networkName = options.networkName; + } + + if (options.monitorSyncPeriod) { + this.monitorSyncPeriod = Number(options.monitorSyncPeriod); + } + + if (options.monitorEnabled !== undefined) { + this.monitorEnabled = options.monitorEnabled; + } + + this.relayEndpoint = options.relayEndpoint; + + this.driverConfig = options.driverConfig; + + this.connector = options.connector; + + if (options.tls) { + this.tls = options.tls; + } + } + + public getListenerInstance(): Listener { + return this.listener; + } + + public getEventsInstance(): Events { + return this.events; + } + + public getConnectorInstance(): PluginLedgerConnectorFabric { + return this.connector; + } + + public setupRouter(router: ConnectRouter): void { + router.service(DriverCommunication, { + requestDriverState: async (request: Query) => { + this.logger.info( + `Received requestDriverState with request: ${JSON.stringify(request)}`, + ); + return await this.driverState(request); + }, + writeExternalState: async (request: WriteExternalStateMessage) => { + this.logger.info( + `Received writeExternalState with request: ${JSON.stringify(request)}`, + ); + return await this.writeExternalState(request); + }, + subscribeEvent: async (request: EventSubscription) => { + this.logger.info( + `Received subscribeEvent with request: ${JSON.stringify(request)}`, + ); + return await this.subscribeEvent(request); + }, + requestSignedEventSubscriptionQuery: async ( + request: EventSubscription, + ) => { + this.logger.info( + `Received requestSignedEventSubscriptionQuery with request: ${JSON.stringify( + request, + )}`, + ); + return await this.requestSignedEventSubscriptionQuery(request); + }, + }); + } + + async requestSignedEventSubscriptionQuery( + request: EventSubscription, + ): Promise { + this.events; + try { + const signedQuery: Query = await this.events.signEventSubscriptionQuery( + request.query!, + ); + this.logger.info( + `Responding to caller with signedQuery: ${JSON.stringify(signedQuery)}`, + ); + return signedQuery; + } catch (error) { + const errorString: string = error.toString(); + this.logger.error(`error: ${errorString}`); + const emptyQuery: Query = create(QuerySchema, { + requestorSignature: errorString, + }); + // gRPC response. + this.logger.info( + `Responding to caller with emptyQuery: ${JSON.stringify(emptyQuery)}`, + ); + return emptyQuery; + } + } + + async subscribeEvent(request: EventSubscription): Promise { + const newRequestId: string = request.query!.requestId; + this.logger.info(`newRequestId: ${newRequestId}`); + try { + if (this.mock) { + dbConnectionTest().then((dbConnectTestStatus) => { + if (dbConnectTestStatus == true) { + eventSubscriptionTest({ + eventSub: request, + events: this.events, + loglevel: this.loglevel, + }).then((eventSubscribeTestStatus) => { + if (eventSubscribeTestStatus == false) { + this.logger.error(`Failed eventSubscriptionTest()`); + } + // add code to support more functionalities here + }); + } else { + this.logger.error(`Failed dbConnectionTest()`); + } + }); + return create(AckSchema, { + requestId: newRequestId, + message: "Mock Processing addEventSubscription", + status: Ack_STATUS.OK, + }); + } else { + this.spawnSubscribeEventHelper(request, newRequestId); + const ackResponse = create(AckSchema, { + requestId: newRequestId, + message: "Processing addEventSubscription", + status: Ack_STATUS.OK, + }); + // gRPC response. + this.logger.info( + `Responding to caller with Ack: ${JSON.stringify(ackResponse)}`, + ); + return ackResponse; + } + } catch (error) { + this.logger.error(`error: ${error.toString()}`); + const ackErrorResponse = create(AckSchema, { + requestId: newRequestId, + message: `Error: ${error.toString()}`, + status: Ack_STATUS.ERROR, + }); + // gRPC response. + this.logger.error( + `Responding to caller with Ack: ${JSON.stringify(ackErrorResponse)}`, + ); + return ackErrorResponse; + } + } + + async driverState(request: Query): Promise { + try { + if (this.mock) { + this.mockCommunication(request); + } else { + await this.fabricCommunication(request, this.gatewayOptions); + } + const ack = create(AckSchema, { + message: "", + status: Ack_STATUS.OK, + requestId: request.requestId, + }); + this.logger.info("Responding to caller"); + return ack; + } catch (error) { + this.logger.error(error); + const ack = create(AckSchema, { + message: `Error: ${error}`, + status: Ack_STATUS.ERROR, + requestId: request.requestId, + }); + this.logger.info("Responding to caller"); + return ack; + } + } + + async writeExternalState(request: WriteExternalStateMessage): Promise { + if (!request.viewPayload) { + throw new Error("No viewPayload provided in WriteExternalStateMessage"); + } + + const viewPayload: ViewPayload = request.viewPayload; + const requestId: string = viewPayload.requestId; + + try { + this.events.writeExternalStateHelper( + request, + {} as FabricSigningCredential, + ); + + const ackResponse = create(AckSchema, { + message: "Successfully written to the ledger", + status: Ack_STATUS.OK, + requestId: requestId, + }); + return ackResponse; + } catch (error) { + const ackErrorResponse = create(AckSchema, { + message: error.toString(), + status: Ack_STATUS.ERROR, + requestId: requestId, + }); + // gRPC response. + this.logger.info( + `Responding to caller with error Ack: ${JSON.stringify(ackErrorResponse)}`, + ); + return ackErrorResponse; + } + } + + // Mocked fabric communication function + mockCommunication(query: Query) { + this.logger.info("Mock Communication"); + // Query object from requestor + this.logger.info(`query ${query.requestId}`); + setTimeout(() => { + const meta = create(MetaSchema, { + timestamp: new Date().toISOString(), + proofType: "Notarization", + serializationFormat: "STRING", + protocol: Meta_Protocol.FABRIC, + }); + + const mockedB64DataBytes = Uint8Array.from( + Buffer.from(mockedB64Data, "base64"), + ); + const viewDataBinary = toBinary( + FabricViewSchema, + fromBinary(FabricViewSchema, mockedB64DataBytes), + ); + this.logger.info(`viewData ${viewDataBinary}`); + + const viewPayload = create(ViewPayloadSchema, { + requestId: query.requestId, + state: { + case: "view", + value: { + meta: meta, + data: viewDataBinary, + }, + }, + }); + + if (!this.relayEndpoint) { + throw new Error("Relay Endpoint is not set."); + } + + const transport = createGrpcTransport({ + baseUrl: "http://" + this.relayEndpoint, + }); + + const client = createClient(DataTransfer, transport); + + client + .sendDriverState(viewPayload) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + }, 3000); + } + + // Handles communication with fabric network and sends resulting data to the relay + async fabricCommunication(query: Query, gatewayOptions: GatewayOptions) { + // Query object from requestor + this.logger.info(`query ${query.requestId}`); + + // Client created using the relay_endpoint in the env. + // TODO: need credentials here to ensure the local relay is only communicating with local drivers + if (!this.relayEndpoint) { + throw new Error("Relay Endpoint is not set."); + } + // Invokes the fabric network + const parsedAddress = parseAddress(query.address); + + const [result, invokeError] = await handlePromise( + this.connector.invoke({ + channelName: parsedAddress.channel, + contractName: this.interopChainCode, + methodName: "HandleExternalRequest", + params: [Buffer.from(toBinary(QuerySchema, query)).toString("base64")], + gatewayOptions: gatewayOptions, + policies: query.policy, + }), + ); + const client = this.getRelayClientForQueryResponse(); + let viewPayload: ViewPayload; + if (invokeError) { + this.logger.error("Invoke Error"); + viewPayload = create(ViewPayloadSchema, { + requestId: query.requestId, + state: { + case: "error", + value: `Error: ${invokeError.toString()}`, + }, + }); + } else { + // Process response from invoke to send to relay + this.logger.info(`Result of fabric invoke ${JSON.stringify(result)}`); + if (!result) { + throw new Error("No result from fabric invoke"); + } + + viewPayload = create(ViewPayloadSchema, { + requestId: query.requestId, + state: { + case: "view", + value: { + meta: { + timestamp: new Date().toISOString(), + proofType: "Notarization", + serializationFormat: "STRING", + protocol: Meta_Protocol.FABRIC, + }, + data: result.view + ? toBinary( + FabricViewSchema, + create(FabricViewSchema, transformToFabricView(result.view)), + ) + : Uint8Array.from(Buffer.from("")), + }, + }, + }); + } + this.logger.info("Sending state"); + client + .sendDriverState(viewPayload) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } + + async spawnSubscribeEventHelper( + request: EventSubscription, + newRequestId: string, + ) { + const subscriptionOp: EventSubOperation = request.operation; + const client = this.getRelayClientForEventSubscription(); + if (subscriptionOp == EventSubOperation.SUBSCRIBE) { + this.events.subscribeEventHelper(request, client, this.gatewayOptions); + } else if (subscriptionOp == EventSubOperation.UNSUBSCRIBE) { + this.events.unsubscribeEventHelper(request, client, this.gatewayOptions); + } else { + const errorString: string = `Error: subscribe operation ${subscriptionOp.toString()} not supported`; + this.logger.error(errorString); + const ackSendError = create(AckSchema, { + requestId: newRequestId, + message: errorString, + status: Ack_STATUS.ERROR, + }); + // gRPC response. + this.logger.info( + `Sending to the relay the eventSubscription error Ack: ${JSON.stringify(ackSendError)}`, + ); + // Sending the fabric state to the relay. + client + .sendDriverSubscriptionStatus(ackSendError) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } + } + getRelayClientForQueryResponse(): Client { + let transport; + this.logger.info( + `getRelayClientForQueryResponse: endpoint ${this.relayEndpoint} tls ${this.tls}`, + ); + + if (this.tls && this.certificate) { + transport = createGrpcTransport({ + baseUrl: "https://" + this.relayEndpoint, + nodeOptions: { + ca: this.certificate, + }, + }); + } else { + transport = createGrpcTransport({ + baseUrl: "http://" + this.relayEndpoint, + }); + } + return createClient(DataTransfer, transport); + } + + getRelayClientForEventPublish(): Client { + let transport; + this.logger.info( + `getRelayClientForEventPublish: endpoint ${this.relayEndpoint} tls ${this.tls}`, + ); + + if (this.tls && this.certificate) { + transport = createGrpcTransport({ + baseUrl: "https://" + this.relayEndpoint, + nodeOptions: { + ca: this.certificate, + }, + }); + } else { + transport = createGrpcTransport({ + baseUrl: "http://" + this.relayEndpoint, + }); + } + return createClient(EventPublish, transport); + } + + getRelayClientForEventSubscription(): Client { + let transport; + this.logger.info( + `getRelayClientForEventSubscription: endpoint ${this.relayEndpoint} tls ${this.tls}}`, + ); + + if (this.tls && this.certificate) { + transport = createGrpcTransport({ + baseUrl: "https://" + this.relayEndpoint, + nodeOptions: { + ca: this.certificate, + }, + }); + } else { + transport = createGrpcTransport({ + baseUrl: "http://" + this.relayEndpoint, + }); + } + return createClient(EventSubscribe, transport); + } + + async monitorService(): Promise { + if (!this.monitorEnabled) { + this.logger.info("Monitor disabled."); + return; + } + + this.logger.info("Starting monitor..."); + this.logger.info(`Monitor sync period: ${this.monitorSyncPeriod}`); + while (true) { + await this.listener.monitorBlockForMissedEvents(this.gatewayOptions); + await delay(this.monitorSyncPeriod * 1000); + } + } + + // Prepares required crypto material for communication with the fabric network + public async configSetup(): Promise { + if (this.connector.getConnectionProfile()) { + this.wallet = await walletSetup( + this.walletPath, + this.connector.getConnectionProfile(), + this.driverConfig, + ); + this.certificate = await getDriverKeyCert( + this.wallet!, + this.driverConfig, + ); + } else { + this.logger.error("No CONNECTION_PROFILE provided in the .env"); + } + + // Register all listeners again + const status = await this.listener.loadEventSubscriptionsFromStorage( + this.gatewayOptions, + ); + this.logger.info(`Load Event Subscriptions Status: ${status}`); + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/listener.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/listener.ts new file mode 100644 index 0000000000..deb706f144 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/listener.ts @@ -0,0 +1,559 @@ +import { + ILoggerOptions, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import { Gateway, Network, BlockListener, BlockEvent } from "fabric-network"; +import { DBConnector, LevelDBConnector } from "./dbConnector"; +import { + FabricEvent, + PluginLedgerConnectorFabric, +} from "../plugin-ledger-connector-fabric"; +import { EventType } from "../public-api"; +import { + EventMatcher, + EventMatcherSchema, + EventType as FabricEventType, +} from "../generated/protos/common/events_pb"; +import { create, toBinary } from "@bufbuild/protobuf"; +import { Query, QuerySchema } from "../generated/protos/common/query_pb"; +import { + handlePromise, + packageFabricView, + relayCallback, + transformToFabricView, +} from "./utils"; +import { Events } from "./events"; +import { FabricDriverServer } from "./fabric-driver-server"; +import * as FabricProto6 from "fabric-protos"; +import { + GatewayOptions, + GetBlockResponseDecodedV1, + GetBlockResponseTypeV1, +} from "../generated/openapi/typescript-axios/index"; + +export interface IListenerOptions { + logLevel: LogLevelDesc; + driver: FabricDriverServer; + chainCodeId?: string; +} + +export const DB_NAME = "BLOCKCHAIN_DB"; +export const DB_OPEN_TIMEOUT = 20000; +export const BH_KEY = "LAST_BLOCK_HEIGHT"; +export class Listener { + public static readonly className = "Listener"; + channelBlockListenerMap = new Map(); + channelContractListenerMap = new Map(); + globalLedgerListenerCount = new Map(); + networkChannelList: string[] = []; + private readonly logger: Logger; + + private readonly connector: PluginLedgerConnectorFabric; + + private readonly driver: FabricDriverServer; + + private readonly events: Events; + + private chainCodeId = "interop"; + + private logLevel: LogLevelDesc; + + constructor(options: IListenerOptions) { + this.logLevel = options.logLevel || "INFO"; + const logOptions: ILoggerOptions = { + level: options.logLevel, + label: Listener.className, + }; + this.logger = LoggerProvider.getOrCreate(logOptions); + this.driver = options.driver; + this.events = this.driver.getEventsInstance(); + this.connector = this.driver.getConnectorInstance(); + if (options.chainCodeId) { + this.chainCodeId = options.chainCodeId; + } + } + + getChannelContractKey(channelId: string, contractId: string) { + return channelId + ":" + contractId; + } + getBHKey(channelId: string) { + return BH_KEY + ":" + channelId; + } + + async setLastReadBlockNumber( + db: DBConnector, + channelId: string, + blockNum: number, + ) { + this.logger.debug( + `Set last read block number ${blockNum} on channel: ${channelId}`, + ); + await db.insert(this.getBHKey(channelId), blockNum); + } + + async getLastReadBlockNumber( + db: DBConnector, + channelId: string, + ): Promise { + try { + const blockNum = await db.read(this.getBHKey(channelId)); + return blockNum; + } catch (error: any) { + this.logger.error( + `Error during GET block number in db: ${error.toString()}`, + ); + throw error; + } + } + + /** + * Start an appropriate listener if there is currently none for the channel (or chaincode) this event subscription refers to. + **/ + async registerListenerForEventSubscription( + eventMatcher: EventMatcher, + gatewayOptions: GatewayOptions, + ): Promise { + const channelId = eventMatcher.transactionLedgerId; + const chaincodeId = eventMatcher.transactionContractId; + + const gateway: Gateway = await this.connector.createGateway({ + gatewayOptions, + }); + const network: Network = await gateway.getNetwork(channelId); + if (!network) { + throw new Error( + "No network/channel handle found for existing gateway and channel ID: " + + channelId, + ); + } + if (!this.channelBlockListenerMap.has(channelId)) { + this.networkChannelList.push(channelId); + } + let listener = null; + if (this.globalLedgerListenerCount.has(channelId)) { + this.globalLedgerListenerCount.set( + channelId, + this.globalLedgerListenerCount.get(channelId)! + 1, + ); + } else { + const bh_db: DBConnector = new LevelDBConnector(DB_NAME, DB_OPEN_TIMEOUT); + await bh_db.open(); + try { + const currBlockNum = ( + await this.connector.getLatestBlockNumber({ + channelName: channelId, + gatewayOptions: gatewayOptions, + }) + ).blockNumber; + await this.setLastReadBlockNumber(bh_db, channelId, currBlockNum); + + listener = await this.connector.createFabricListener( + { + channelName: channelId, + contractName: chaincodeId, + gatewayOptions: gatewayOptions, + eventType: EventType.Block, + }, + this.createBlockEventListenerCallback(channelId, gatewayOptions) as ( + event: FabricEvent, + ) => Promise, + ); + if (eventMatcher.eventClassId.length > 0) { + this.channelContractListenerMap.set( + this.getChannelContractKey(channelId, chaincodeId), + true, + ); + } + this.globalLedgerListenerCount.set(channelId, 1); + } catch (error: any) { + this.logger.error( + `registerListenerForEventSubscription: ${error.toString()}`, + ); + throw error; + } finally { + await bh_db.close(); + } + } + return listener; // If null, Listener was already running. Nothing to do. + } + + createBlockEventListenerCallback( + channelId: string, + gatewayOptions: GatewayOptions, + ): (event: BlockEvent) => Promise { + return async (event: BlockEvent): Promise => { + const bh_db: DBConnector = new LevelDBConnector(DB_NAME, DB_OPEN_TIMEOUT); + await bh_db.open(); + try { + const lastBlockNum = await this.getLastReadBlockNumber( + bh_db, + channelId, + ); + const currBlockNum = event.blockNumber.toNumber(); + // Log failed events for debugging purpose + event.getTransactionEvents().forEach((txEvent) => { + this.logger + .info(`BlockEvent Listener: Block #${currBlockNum} event; LastReadBlock #${lastBlockNum}\n + TxId: ${txEvent.transactionId}, + TxStatus: ${txEvent.status}, + isTxValid: ${txEvent.isValid}\n`); + }); + if (currBlockNum === lastBlockNum + 1) { + await this.processBlockForEvents( + event.blockData, + channelId, + "Listener", + gatewayOptions, + ); + // Set current block number as listener block height + await this.setLastReadBlockNumber(bh_db, channelId, currBlockNum); + } + } catch (error: any) { + this.logger.error(`BlockEvent Listener: ${error.toString()}`); + } finally { + await bh_db.close(); + } + }; + } + + /* + * For all VALID transactions in a block: + * 1. Emits all subscribed Transaction Events + * 2. Emits all subscribed Contract Events + */ + async processBlockForEvents( + block: any, + channelId: string, + loggerName: string = "", + gatewayOptions: GatewayOptions, + ) { + // Parse the block data; typically there is only one element in this array but we will interate over it just to be safe + const blockNum = block.header.number; + const blockData = ( + (block as FabricProto6.common.Block).data as FabricProto6.common.BlockData + ).data; + const blockMetadata = ( + (block as FabricProto6.common.Block) + .metadata as FabricProto6.common.BlockMetadata + ).metadata; + const txFilterIndex = + FabricProto6.common.BlockMetadataIndex.TRANSACTIONS_FILTER; + const txValid = blockMetadata[txFilterIndex]; + this.logger.debug( + `Event ${loggerName}: block #${blockNum}, #Transactions: ${blockData.length}`, + ); + this.logger.debug( + `Event ${loggerName}: block #${blockNum}, TxValidity: ${JSON.stringify(txValid)}`, + ); + + blockData.forEach((item: any, index: number) => { + const payload = item.payload; + const transactions = payload["data"].actions; + const tx_id = payload["header"].channel_header.tx_id; + this.logger.debug( + `Event ${loggerName}: Transaction with TxId: ${tx_id}, index: ${index}`, + ); + + if (txValid[index] === FabricProto6.protos.TxValidationCode.VALID) { + // Iterate through the transaction list + transactions.forEach(async (transaction: any) => { + // Check if block subscription and then call handle block event + if (this.channelBlockListenerMap.has(channelId)) { + if ( + transaction.payload.chaincode_proposal_payload.input + .chaincode_spec.input.args.length > 0 + ) { + // Get transaction chaincode ID + const chaincodeId = + transaction.payload.chaincode_proposal_payload.input + .chaincode_spec.chaincode_id.name; + // below way of fetching payload requires that the response has been set by the chaincode function via return value + const responsePayload = + transaction.payload.action.proposal_response_payload.extension + .response.payload; + // Get transaction function name: first argument according to convention + const chaincodeFunc = + transaction.payload.chaincode_proposal_payload.input.chaincode_spec.input.args[0].toString(); + const eventMatcher = this.createEventMatcher( + "", + channelId, + chaincodeId, + chaincodeFunc, + ); + this.eventHandler( + eventMatcher, + responsePayload, + channelId, + `BlockEvent ${loggerName}`, + gatewayOptions, + ); + } + } + + // Check if contract subscription and then call handle contract event + // Get transaction chaincode ID + const chaincodeId = + transaction.payload.chaincode_proposal_payload.input.chaincode_spec + .chaincode_id.name; + if ( + this.channelContractListenerMap.has( + this.getChannelContractKey(channelId, chaincodeId), + ) + ) { + // below way of fetching payload is similar to ContractEventListener in which we fetch event.payload + const eventPayload = + transaction.payload.action.proposal_response_payload.extension + .events.payload; + const eventName = + transaction.payload.action.proposal_response_payload.extension + .events.event_name; + const eventMatcher = this.createEventMatcher( + eventName, + channelId, + chaincodeId, + "*", + ); + this.eventHandler( + eventMatcher, + eventPayload, + channelId, + `ContractEvent ${loggerName}`, + gatewayOptions, + ); + } + }); + } else { + this.logger.error( + `Event ${loggerName}: Transaction with TxId: ${tx_id} is invalid with code ${txValid[index]}:${FabricProto6.protos.TxValidationCode[txValid[index]]}. Discarding.`, + ); + } + }); + } + + createEventMatcher( + eventName: string, + channelId: string, + chaincodeId: string, + functionName: string, + ) { + return create(EventMatcherSchema, { + eventType: FabricEventType.LEDGER_STATE, + transactionLedgerId: channelId, + transactionContractId: chaincodeId, + transactionFunc: functionName, + eventClassId: eventName, + }); + } + + async eventHandler( + eventMatcher: EventMatcher, + eventPayload: Buffer, + channelId: string, + loggerName: string, + gatewayOptions: GatewayOptions, + ) { + this.logger.info( + `${loggerName}: Trying to find subscriptions for ${JSON.stringify(eventMatcher)}`, + ); + + if (!this.events) { + throw new Error("Events instance not set in Listener"); + } + + // Find all matching event subscriptions stored in the database + const eventSubscriptionQueries = + await this.events.lookupEventSubscriptions(eventMatcher); + // Iterate through the view requests in the matching event subscriptions + eventSubscriptionQueries.forEach(async (eventSubscriptionQuery: Query) => { + this.logger.info( + `${loggerName}: Generating view and collecting proof for event matcher: ${JSON.stringify(eventMatcher)} with event payload: ${eventPayload.toString()}`, + ); + // Trigger proof collection + const [result, invokeError] = await handlePromise( + this.connector.invoke({ + gatewayOptions, + channelName: channelId, + contractName: this.chainCodeId, + methodName: "HandleEventRequest", + params: [ + Buffer.from(toBinary(QuerySchema, eventSubscriptionQuery)).toString( + "base64", + ), + eventPayload ? eventPayload.toLocaleString() : "", + ], + }), + ); + if (!invokeError) { + // Package view and send to relay + const client = this.driver.getRelayClientForEventPublish(); + const viewPayload = packageFabricView( + eventSubscriptionQuery, + transformToFabricView(result!.view), + ); + + this.logger.info(`${loggerName}: Sending event`); + // Sending the Fabric event to the relay. + client + .sendDriverState(viewPayload) + .then((response) => relayCallback({ response })) + .catch((error) => relayCallback({ error })); + } + }); + } + + /** + * Decrement subscription count against an active listener. Stop the listener if the count is 0. + **/ + async unregisterListenerForEventSubscription( + eventMatcher: EventMatcher, + gatewayOptions: GatewayOptions, + ): Promise { + const channelId = eventMatcher.transactionLedgerId; + const chaincodeId = eventMatcher.transactionContractId; + + const gateway: Gateway = await this.connector.createGateway({ + gatewayOptions, + }); + const network: Network = await gateway.getNetwork(channelId); + if (!network) { + throw new Error( + "No network/channel handle found for existing gateway and channel ID: " + + channelId, + ); + } + if (!this.channelBlockListenerMap.has(channelId)) { + this.networkChannelList.push(channelId); + } + if (!this.channelBlockListenerMap.has(channelId)) { + return false; + } + // Update Global Listener count for the ledger + if (this.globalLedgerListenerCount.get(channelId)! > 1) { + this.globalLedgerListenerCount.set( + channelId, + this.globalLedgerListenerCount.get(channelId)! - 1, + ); + return true; + } else { + const bh_db: DBConnector = new LevelDBConnector( + DB_NAME!, + DB_OPEN_TIMEOUT, + ); + await bh_db.open(); + try { + // Set DB Height to -1 if no listener running + await this.setLastReadBlockNumber(bh_db, channelId, -1); + network.removeBlockListener( + this.channelBlockListenerMap.get(channelId)!, + ); + if (eventMatcher.eventClassId.length > 0) { + this.channelContractListenerMap.delete( + this.getChannelContractKey(channelId, chaincodeId), + ); + } + this.channelBlockListenerMap.delete(channelId); + this.globalLedgerListenerCount.set(channelId, 0); + return true; + } catch (error: any) { + this.logger.error( + `unregisterListenerForEventSubscription: ${error.toString()}`, + ); + return false; + } finally { + await bh_db.close(); + } + } + } + + /** + * Load event subscriptions from the driver database. + * Start a listener for each channel from which one of the subscribed events originate. + **/ + async loadEventSubscriptionsFromStorage( + gatewayOptions: GatewayOptions, + ): Promise { + this.logger.info( + "Starting event listeners for subscribed events in database...", + ); + try { + const eventMatchers = await this.events.readAllEventMatchers(); + for (const eventMatcher of eventMatchers) { + try { + await this.registerListenerForEventSubscription( + eventMatcher, + gatewayOptions, + ); + } catch (error) { + this.logger.error( + `Error: Could not start event listener for ${JSON.stringify(eventMatcher)} with error: ${error}`, + ); + return false; + } + } + } catch (error) { + this.logger.error(`Error: event matcher read error: ${error}`); + return false; + } + return true; + } + + /* + * Monitor to handle block events that were missed/discarded by listener. + */ + public async monitorBlockForMissedEvents( + gatewayOptions: GatewayOptions, + ): Promise { + this.logger.debug("############### Monitor Begin #################"); + // Create connection to a database + const bh_db: DBConnector = new LevelDBConnector( + DB_NAME!, + DB_OPEN_TIMEOUT, + this.logLevel, + ); + await bh_db.open(); + try { + // Handle Block Events + for (const channelId of this.networkChannelList) { + const currBlockNum = ( + await this.connector.getLatestBlockNumber({ + channelName: channelId, + gatewayOptions: gatewayOptions, + }) + ).blockNumber; + const lastBlockNum = await this.getLastReadBlockNumber( + bh_db, + channelId, + ); + this.logger.debug( + `Monitor: Current Block #${currBlockNum}; LastReadBlock #${lastBlockNum}`, + ); + if (currBlockNum > lastBlockNum) { + for (let bnum = lastBlockNum + 1; bnum <= currBlockNum; bnum++) { + const block = ( + (await this.connector.getBlock({ + channelName: channelId, + query: { blockNumber: bnum.toString() }, + gatewayOptions: gatewayOptions, + responseType: GetBlockResponseTypeV1.Full, + })) as GetBlockResponseDecodedV1 + ).decodedBlock; + await this.processBlockForEvents( + block, + channelId, + "Monitor", + gatewayOptions, + ); + } + // Update block number in DB + await this.setLastReadBlockNumber(bh_db, channelId, currBlockNum); + } + } + } catch (error: any) { + this.logger.error(`Monitor Error: ${error}`); + } + await bh_db.close(); + this.logger.debug("############### Monitor End ###################"); + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/tests.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/tests.ts new file mode 100644 index 0000000000..3559631030 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/tests.ts @@ -0,0 +1,154 @@ +/* + * Copyright IBM Corp. All Rights Reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Events } from "./events"; +import { + LevelDBConnector, + DBConnector, + DBNotOpenError, + DBKeyNotFoundError, + DBLockedError, +} from "./dbConnector"; + +import { LoggerProvider, LogLevelDesc } from "@hyperledger/cactus-common"; +import { + EventMatcher, + EventSubscription, +} from "../generated/protos/common/events_pb"; +import { Query } from "../generated/protos/common/query_pb"; + +// test the LevelDB basic operations +export async function dbConnectionTest(): Promise { + const logger = LoggerProvider.getOrCreate({ + label: "dbConnectionTest", + level: "INFO", + }); + logger.info(`Start testing LevelDBConnector()`); + let db: DBConnector; + try { + // Create connection to a database + db = new LevelDBConnector(""); + + const key: string = "key"; + let value: string = "insert"; + + // Add the entry to the database + await db.insert(key, value); + + // Fetch the value of the key + value = await db.read(key); + logger.info(`obtained : <${key}, ${value}>`); + + // Close the database connection + await db.close(); + + // Try to update the key before opening the database connection + try { + value = "update"; + await db.update(key, value); + } catch (error: any) { + const errorString: string = `${error.toString()}`; + if (error instanceof DBNotOpenError) { + logger.info(`test success for DBNotOpenError`); + // open the database connection + await db.open(); + // try to update again the key + await db.update(key, value); + } else { + logger.error(`re-throwing the error: ${errorString}`); + db.close(); + throw new Error(error); + } + } + + // Delete the key + await db.delete(key); + + // Try to read key that is already deleted + try { + await db.read(key); + } catch (error: any) { + const errorString: string = `${error.toString()}`; + if (error instanceof DBKeyNotFoundError) { + logger.info(`test success for DBKeyNotFoundError`); + } else { + logger.error(`re-throwing the error: ${errorString}`); + db.close(); + throw new Error(error); + } + } + + // Try to open another connection which should fail + try { + const db2 = new LevelDBConnector(""); + await db2.open(); + } catch (error: any) { + const errorString: string = `${error.toString()}`; + if (error instanceof DBLockedError) { + logger.info(`test success for DBLockedError`); + } else { + logger.error(`re-throwing the error: ${errorString}`); + throw new Error(error); + } + } + + await db.close(); + } catch (error) { + logger.error( + `Failed testing LevelDBConnector, with error: ${error.toString()}`, + ); + db!.close(); + return false; + } + + logger.info(`End testing LevelDBConnector()`); + return true; +} + +export interface eventSubscriptionTestOptions { + eventSub: EventSubscription; + events: Events; + loglevel?: LogLevelDesc; +} + +// test the event subscription operations: subscribeEvent, listEvents, deleteEvent +export async function eventSubscriptionTest( + options: eventSubscriptionTestOptions, +): Promise { + const { eventSub, events, loglevel = "INFO" } = options; + const logger = LoggerProvider.getOrCreate({ + label: "eventSubscriptionTest", + level: loglevel, + }); + + logger.info(`Start eventSubscriptionTest()`); + + try { + const eventMatcher: EventMatcher = eventSub.eventMatcher!; + await events.addEventSubscription(eventSub); + const subscriptions: Array = (await events.lookupEventSubscriptions( + eventMatcher, + )) as Array; + + for (const subscription of subscriptions) { + if (subscription.requestId == eventSub.query!.requestId) { + await events.deleteEventSubscription( + eventMatcher, + subscription.requestId, + ); + break; + } + } + } catch (error) { + logger.error( + `Failed testing event subscription operations, with error: ${error.toString()}`, + ); + return false; + } + + logger.info(`End eventSubscriptionTest()`); + return true; +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/utils.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/utils.ts new file mode 100644 index 0000000000..646d92db06 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/utils.ts @@ -0,0 +1,142 @@ +import { ILoggerOptions, LoggerProvider } from "@hyperledger/cactus-common"; +import { Query } from "../generated/protos/common/query_pb"; +import { + FabricViewSchema, + FabricView as ProtoFabricView, + FabricView_EndorsedProposalResponseSchema, +} from "../generated/protos/fabric/view_data_pb"; +import { + Meta_Protocol, + MetaSchema, + ViewPayloadSchema, + ViewSchema, +} from "../generated/protos/common/state_pb"; +import { create, toBinary } from "@bufbuild/protobuf"; +import { FabricView } from "../public-api"; + +// A better way to handle errors for promises +export function handlePromise(promise: Promise): Promise<[T?, Error?]> { + const result: Promise<[T?, Error?]> = promise + .then((data) => { + const response: [T?, Error?] = [data, undefined]; + return response; + }) + .catch((error) => Promise.resolve([undefined, error])); + return result; +} + +export function relayCallback(call: { error?: any; response?: any }) { + const loggerOptions: ILoggerOptions = { + level: "INFO", + label: "RelayCallback", + }; + const logger = LoggerProvider.getOrCreate(loggerOptions); + if (call.response) { + logger.info(`Relay Callback Response: ${JSON.stringify(call.response)}`); + } else if (call.error) { + logger.error(`Relay Callback Error: ${call.error}`); + } +} + +export function checkIfArraysAreEqual(x: Array, y: Array): boolean { + if (x == y) { + return true; + } else if (x == null || y == null || x.length != y.length) { + return false; + } else { + // check if all elements of x are present in y + for (const element of x) { + const index = y.indexOf(element); + if (index == -1) { + return false; + } else { + y.splice(index, 1); + } + } + + // return false if y has additional elements not in x + if (y.length != 0) { + return false; + } + } + + return true; +} + +// Package view and send to relay +export function packageFabricView(query: Query, viewData: ProtoFabricView) { + const meta = create(MetaSchema, { + timestamp: new Date().toISOString(), + proofType: "Notarization", + serializationFormat: "STRING", + protocol: Meta_Protocol.FABRIC, + }); + + const view = create(ViewSchema, { + meta: meta, + data: viewData + ? toBinary(FabricViewSchema, viewData) + : new Uint8Array(Buffer.from("")), + }); + + const viewPayload = create(ViewPayloadSchema, { + state: { + case: "view", + value: view, + }, + requestId: query.requestId, + }); + return viewPayload; +} + +export async function delay(ms: number) { + await new Promise((f) => setTimeout(f, ms)); +} + +/** + * Transforms the result.view object to match the MessageInit structure. + * Adjust this function as needed to match the actual FabricView fields. (From the OAPI spec to the proto spec) + */ +export function transformToFabricView(view: FabricView): ProtoFabricView { + const endorsedProposalResponses = (view.endorsedProposalResponses ?? []).map( + (epr) => + create(FabricView_EndorsedProposalResponseSchema, { + payload: { + proposalHash: Uint8Array.from( + Buffer.from(epr.payload?.proposalHash || "", "base64"), + ), + extension: Uint8Array.from( + Buffer.from(epr.payload?.extension || "", "base64"), + ), + }, + endorsement: { + endorser: Uint8Array.from( + Buffer.from(epr.endorsement?.endorser || "", "base64"), + ), + signature: Uint8Array.from( + Buffer.from(epr.endorsement?.signature || "", "base64"), + ), + }, + }), + ); + return create(FabricViewSchema, { + endorsedProposalResponses: endorsedProposalResponses, + }); +} + +export function parseAddress(address: string): { + channel: string; + contract: string; + ccFunc: string; + args: string[]; +} { + // address format: fabric/:::::... + const addressList = address.split("/"); + const fabricArgs = addressList[2].split(":"); + return { + channel: fabricArgs[0], + contract: fabricArgs[1], + ccFunc: fabricArgs[2], + args: fabricArgs.slice(3), + }; +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/walletSetup.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/walletSetup.ts new file mode 100644 index 0000000000..ed73b51dfc --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/walletSetup.ts @@ -0,0 +1,229 @@ +/* + * Copyright IBM Corp. All Rights Reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Wallet, Wallets } from "fabric-network"; +import FabricCAServices from "fabric-ca-client"; +import { handlePromise } from "./utils"; +import { + ILoggerOptions, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import FabCommon from "fabric-common"; +import { ConnectionProfile } from "../public-api"; +import { DriverConfig } from "./fabric-driver-server"; + +export async function walletSetup( + walletPath: string, + ccp: ConnectionProfile, + config: DriverConfig, + logLevel: LogLevelDesc = "INFO", +): Promise { + const loggerOptions: ILoggerOptions = { + level: logLevel, + label: "walletSetup", + }; + const logger = LoggerProvider.getOrCreate(loggerOptions); + + // Create a new CA client for interacting with the CA. + if (!ccp) { + logger.error("No connection profile provided"); + throw new Error("No connection profile provided"); + } + + if (!ccp.client) { + logger.error("No client section in the connection profile"); + throw new Error("No client section in the connection profile"); + } + const org = ccp.client["organization"]; + logger.debug(`Org ${org}`); + + if (!org) { + logger.error("No organization provided in the connection profile"); + throw new Error("No organization provided in the connection profile"); + } + if (!ccp.organizations) { + logger.error("No organizations section in the connection profile"); + throw new Error("No organizations section in the connection profile"); + } + const caName = ccp.organizations[org]["certificateAuthorities"][0]; + logger.debug(`CA Name ${caName}`); + + let caURL; + + if (config.caUrl !== undefined && config.caUrl != "") { + caURL = config.caUrl; + } else { + logger.debug("Getting CA URL from connection profile"); + if (ccp.certificateAuthorities === undefined) { + logger.error( + "No certificateAuthorities section in the connection profile", + ); + throw new Error( + "No certificateAuthorities section in the connection profile", + ); + } + caURL = ccp.certificateAuthorities[caName].url; + } + logger.debug(`CA URL: ${caURL}`); + const ca = new FabricCAServices(caURL); + const ident = ca.newIdentityService(); + logger.debug(ident); + + const wallet = await Wallets.newFileSystemWallet(walletPath); + const adminName = config?.admin?.name; + const adminSecret = config?.admin?.secret; + // build a user object for authenticating with the CA // Check to see if we've already enrolled the admin user. + if (!adminName) { + logger.error("No admin name provided in the config"); + throw new Error("No admin name provided in the config"); + } + let adminIdentity = await wallet.get(adminName); + + if (adminIdentity) { + logger.info( + 'An identity for the admin user "admin" already exists in the wallet', + ); + } else { + // Enroll the admin user, and import the new identity into the wallet. + logger.debug(`Enrolling Admin... ${adminName}, ${adminSecret}`); + if (!adminSecret) { + logger.error("No admin secret provided in the config"); + throw new Error("No admin secret provided in the config"); + } + if (!config.mspId) { + logger.error("No mspId provided in the config"); + throw new Error("No mspId provided in the config"); + } + const enrollment = await ca.enroll({ + enrollmentID: adminName, + enrollmentSecret: adminSecret, + }); + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: config.mspId, + type: "X.509", + }; + await wallet.put(adminName, x509Identity); + adminIdentity = await wallet.get(adminName); + } + if (adminIdentity) { + if (!config.relay) { + logger.error("No relay config provided"); + throw new Error("No relay config provided"); + } + logger.info(`Creating ${config.relay.name} Identity`); + const provider = wallet + .getProviderRegistry() + .getProvider(adminIdentity.type); + const adminUser = await provider.getUserContext(adminIdentity, adminName); + + if (!config.relay.name) { + logger.error("No relay name provided in the config"); + throw new Error("No relay name provided in the config"); + } + const identity = await wallet.get(config.relay.name); + + if (!config.relay.affiliation) { + logger.error("No relay affiliation provided in the config"); + throw new Error("No relay affiliation provided in the config"); + } + if (!config.relay.attrs) { + logger.error("No relay attrs provided in the config"); + throw new Error("No relay attrs provided in the config"); + } + if (!identity) { + const secret = await ca.register( + { + affiliation: config.relay.affiliation, + enrollmentID: config.relay.name, + role: config.relay.role, + attrs: config.relay.attrs, + }, + adminUser, + ); + const enrollment = await ca.enroll({ + enrollmentID: config.relay.name, + enrollmentSecret: secret, + }); + if (!config.mspId) { + logger.error("No mspId provided in the config"); + throw new Error("No mspId provided in the config"); + } + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: config.mspId, + type: "X.509", + }; + await wallet.put(config.relay.name, x509Identity); + logger.info(`${config.relay.name} Identity Created`); + } else { + logger.info(`${config.relay.name} Identity Already exists`); + } + + return wallet; + } else { + logger.error("Admin was not registered"); + throw new Error("Admin was not registered"); + } +} + +export async function getDriverKeyCert( + wallet: Wallet, + config: DriverConfig, +): Promise { + const loggerOptions: ILoggerOptions = { + level: "INFO", + label: "getDriverKeyCert", + }; + const logger = LoggerProvider.getOrCreate(loggerOptions); + + if (!config.relay) { + logger.error("No relay config provided"); + throw new Error("No relay config provided"); + } + + logger.info(`relay id: ${config.relay.name}`); + + const [keyCert, keyCertError] = await handlePromise( + getKeyAndCertForRemoteRequestbyUserName(wallet, config.relay.name), + ); + if (keyCertError) { + throw new Error(`Error getting key and cert ${keyCertError}`); + } + return keyCert; +} + +// TODO: Lookup different key and cert pairs for different networks and chaincode functions +/** + * Generate key pair and obtain certificate from CA (MSP) + **/ +async function getKeyAndCertForRemoteRequestbyUserName( + wallet: any, + username: any, +) { + if (!wallet) { + throw new Error("No wallet passed"); + } + if (!username) { + throw new Error("No username passed"); + } + const identity = await wallet.get(username); + if (!identity) { + throw new Error(`Identity for username ${username} not present in wallet`); + } + // Assume the identity is of type 'fabric-network.X509Identity' + const privKey = FabCommon.Utils.newCryptoSuite().createKeyFromRaw( + identity.credentials.privateKey, + ); + return { key: privKey, cert: identity.credentials.certificate }; +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/weaver-fabric-sdk.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/weaver-fabric-sdk.ts new file mode 100644 index 0000000000..ee001e85b5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/weaver-fabric-sdk.ts @@ -0,0 +1,208 @@ +import { fromBinary } from "@bufbuild/protobuf"; +import { View, Meta_Protocol } from "../generated/protos/common/state_pb"; +import { FabricViewSchema } from "../generated/protos/fabric/view_data_pb"; +import { ViewDataSchema as CordaViewDataSchema } from "../generated/protos/corda/view_data_pb"; +import { ChaincodeActionSchema } from "../generated/protos/peer/proposal_pb"; +import { + ConfidentialPayloadContentsSchema, + ConfidentialPayloadSchema, + InteropPayloadSchema, +} from "../generated/protos/common/interop_payload_pb"; +import eciesCrypto from "./eciesCrypto.js"; +import { KEYUTIL as keyutil } from "jsrsasign"; + +import crypto from "crypto"; + +/** + * Sign a message using SHA256 + * message: string + * privateKey: pem string + * returns: signature in base64 string + **/ +export function signMessage( + message: any, + privateKey: + | crypto.KeyLike + | crypto.SignKeyObjectInput + | crypto.SignPrivateKeyInput, + algorithm: string = "SHA256", +) { + const sign = crypto.createSign(algorithm); + sign.write(message); + sign.end(); + return sign.sign(privateKey).toString("base64"); +} + +/** + * Extracts actual remote query response (along with full decrypted contents, if the response is encrypted) embedded in view structure. + * Arguments are a View protobuf ('statePb.View') and a certificate in the form of a PEM string + * TODO - Also take verification policy as parameter and determine if enough matching responses exist (current logic mandates unanimity among payloads) + **/ +const getResponseDataFromView = (view: View, privKeyPEM = null) => { + if (view.meta?.protocol == Meta_Protocol.FABRIC) { + const fabricView = fromBinary(FabricViewSchema, view.data); + + const fabricViewProposalResponses = fabricView.endorsedProposalResponses; + + let viewAddress = ""; + let responsePayload = ""; + const responsePayloadContents = []; + let payloadConfidential = false; + for (let i = 0; i < fabricViewProposalResponses.length; i++) { + const fabricViewChaincodeAction = fromBinary( + ChaincodeActionSchema, + fabricViewProposalResponses[i].payload!.extension, + ); + const interopPayload = fromBinary( + InteropPayloadSchema, + fabricViewChaincodeAction.response!.payload, + ); + if (interopPayload.confidential) { + // Currently this is only supported for Fabric because it uses ECDSA keys in wallets + const confidentialPayload = fromBinary( + ConfidentialPayloadSchema, + interopPayload.payload, + ); + const decryptedPayload = decryptData( + Buffer.from(confidentialPayload.encryptedPayload).toString("base64"), + privKeyPEM, + ); + const decryptedPayloadContents = fromBinary( + ConfidentialPayloadContentsSchema, + Uint8Array.from(Buffer.from(decryptedPayload)), + ); + + if (i === 0) { + viewAddress = interopPayload.address; + responsePayload = Buffer.from( + decryptedPayloadContents.payload, + ).toString(); + payloadConfidential = true; + } else if (!payloadConfidential) { + throw new Error( + `Mismatching payload confidentiality flags across proposal responses`, + ); + } else { + // Match view addresses in the different proposal responses + if (viewAddress !== interopPayload.address) { + throw new Error( + `Proposal response view addresses mismatch: 0 - ${viewAddress}, ${i} - ${interopPayload.address}`, + ); + } + // Match decrypted view payloads from the different proposal responses + const currentResponsePayload = Buffer.from( + decryptedPayloadContents.payload, + ).toString(); + if (responsePayload !== currentResponsePayload) { + throw new Error( + `Decrypted proposal response payloads mismatch: 0 - ${responsePayload}, ${i} - ${currentResponsePayload}`, + ); + } + } + responsePayloadContents.push(decryptedPayload.toString("base64")); + } else { + if (i === 0) { + viewAddress = interopPayload.address; + responsePayload = Buffer.from(interopPayload.payload).toString(); + payloadConfidential = false; + } else if (payloadConfidential) { + throw new Error( + `Mismatching payload confidentiality flags across proposal responses`, + ); + } else { + const currentResponsePayload = Buffer.from( + interopPayload.payload, + ).toString(); + if (responsePayload !== currentResponsePayload) { + throw new Error( + `Proposal response payloads mismatch: 0 - ${responsePayload}, ${i} - ${currentResponsePayload}`, + ); + } + if (viewAddress !== interopPayload.address) { + throw new Error( + `Proposal response view addresses mismatch: 0 - ${viewAddress}, ${i} - ${interopPayload.address}`, + ); + } + } + } + } + if (payloadConfidential) { + return { + viewAddress: viewAddress, + data: responsePayload, + contents: responsePayloadContents, + }; + } else { + return { viewAddress: viewAddress, data: responsePayload }; + } + } else if (view.meta?.protocol == Meta_Protocol.CORDA) { + const cordaView = fromBinary(CordaViewDataSchema, view.data); + const cordaNotarizedPayloads = cordaView.notarizedPayloads; + let viewAddress = ""; + let responsePayload = ""; + const responsePayloadContents: any[] = []; + let payloadConfidential = false; + cordaNotarizedPayloads.forEach((notarizedPayload, i) => { + const interopPayload = fromBinary( + InteropPayloadSchema, + notarizedPayload.payload, + ); + responsePayloadContents.push( + Buffer.from(interopPayload.payload).toString("base64"), + ); + if (interopPayload.confidential) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const confidentialPayload = fromBinary( + ConfidentialPayloadSchema, + interopPayload.payload, + ); + //TODO: Confidentiality in Corda + } else { + if (i === 0) { + viewAddress = interopPayload.address; + responsePayload = Buffer.from(interopPayload.payload).toString(); + payloadConfidential = false; + } else if (payloadConfidential) { + throw new Error( + `Mismatching payload confidentiality flags across notarized payloads`, + ); + } else { + const currentResponsePayload = Buffer.from( + interopPayload.payload, + ).toString(); + if (responsePayload !== currentResponsePayload) { + throw new Error( + `Proposal response payloads mismatch: 0 - ${responsePayload}, ${i} - ${currentResponsePayload}`, + ); + } + if (viewAddress !== interopPayload.address) { + throw new Error( + `Proposal response view addresses mismatch: 0 - ${viewAddress}, ${i} - ${interopPayload.address}`, + ); + } + } + } + }); + if (payloadConfidential) { + return { + viewAddress: viewAddress, + data: responsePayload, + contents: responsePayloadContents, + }; + } else { + return { viewAddress: viewAddress, data: responsePayload }; + } + } else { + const protocolType = view.meta?.protocol; + throw new Error(`Unsupported DLT type: ${protocolType}`); + } +}; + +const decryptData = (dataBytes: string, eciesPrivateKeyPEM: any) => { + // TODO Check getKeyFromPlainPrivatePKCS8PEM + const privKey = keyutil.getKey(eciesPrivateKeyPEM, "PKCS8PRV"); + const decryptionOptions = { hashAlgorithm: "SHA2" }; + return eciesCrypto.eciesDecryptMessage(privKey, dataBytes, decryptionOptions); +}; + +export { getResponseDataFromView, decryptData }; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/chaincode-event-listener.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/chaincode-event-listener.test.ts index 23315fecdc..d6acd9261a 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/chaincode-event-listener.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/chaincode-event-listener.test.ts @@ -5,7 +5,7 @@ import path from "node:path"; import "jest-extended"; import fs from "fs-extra"; import { v4 as uuidv4 } from "uuid"; -import { DiscoveryOptions, ContractEvent } from "fabric-network"; +import { DiscoveryOptions, ContractEvent, BlockEvent } from "fabric-network"; import express from "express"; import bodyParser from "body-parser"; @@ -42,8 +42,14 @@ import { FabricContractInvocationType, } from "../../../../main/typescript/public-api"; -import { IPluginLedgerConnectorFabricOptions } from "../../../../main/typescript/plugin-ledger-connector-fabric"; -import { GatewayOptions } from "../../../../main/typescript/generated/openapi/typescript-axios/api"; +import { + IPluginLedgerConnectorFabricOptions, + FabricEvent, +} from "../../../../main/typescript/plugin-ledger-connector-fabric"; +import { + EventType, + GatewayOptions, +} from "../../../../main/typescript/generated/openapi/typescript-axios/api"; import { CreateListenerRequest } from "../../../../main/typescript/common/utils"; import { PeerCerts } from "@hyperledger/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1"; @@ -180,7 +186,7 @@ describe("PluginLedgerConnectorFabric", () => { await Servers.shutdown(server); }); - it("setup log subscriber, issue tx, and capture event emitted", async () => { + it("setup log subscriber, issue tx, and capture contract event emitted", async () => { const channelName = "mychannel"; const contractName = "basic-asset-transfer"; const deployedContractName = `${contractName}-${(Math.random() + 1).toString(36).substring(7)}`; @@ -334,12 +340,15 @@ describe("PluginLedgerConnectorFabric", () => { channelName, contractName: deployedContractName, gatewayOptions, + eventType: EventType.Contract, } as CreateListenerRequest, - async (event: ContractEvent) => { + async (event: FabricEvent) => { log.info("Event received by listener"); event_emitted = true; + event = event as ContractEvent; + if (event) { expect(event).toBeTruthy(); expect(event.chaincodeId).toBe(deployedContractName); @@ -384,6 +393,174 @@ describe("PluginLedgerConnectorFabric", () => { fail("Event not emitted"); } + removeListener(); + }); + it("setup block event listener, issue tx, and capture block event emitted", async () => { + const channelName = "mychannel"; + const contractName = "basic-asset-transfer"; + const deployedContractName = `${contractName}-${(Math.random() + 1).toString(36).substring(7)}`; + + const channelId = "mychannel"; + + const contractRelPath = "../../fixtures/go/lock-asset/chaincode-typescript"; + const contractDir = path.join(__dirname, contractRelPath); + + const sourceFiles: FileBase64[] = []; + { + const filename = "./tsconfig.json"; + const relativePath = "./"; + const filePath = path.join(contractDir, relativePath, filename); + const buffer = await fs.readFile(filePath); + sourceFiles.push({ + body: buffer.toString("base64"), + filepath: relativePath, + filename, + }); + } + { + const filename = "./package.json"; + const relativePath = "./"; + const filePath = path.join(contractDir, relativePath, filename); + const buffer = await fs.readFile(filePath); + sourceFiles.push({ + body: buffer.toString("base64"), + filepath: relativePath, + filename, + }); + } + { + const filename = "./index.ts"; + const relativePath = "./src/"; + const filePath = path.join(contractDir, relativePath, filename); + const buffer = await fs.readFile(filePath); + sourceFiles.push({ + body: buffer.toString("base64"), + filepath: relativePath, + filename, + }); + } + { + const filename = "./asset.ts"; + const relativePath = "./src/"; + const filePath = path.join(contractDir, relativePath, filename); + const buffer = await fs.readFile(filePath); + sourceFiles.push({ + body: buffer.toString("base64"), + filepath: relativePath, + filename, + }); + } + { + const filename = "./assetTransfer.ts"; + const relativePath = "./src/"; + const filePath = path.join(contractDir, relativePath, filename); + const buffer = await fs.readFile(filePath); + sourceFiles.push({ + body: buffer.toString("base64"), + filepath: relativePath, + filename, + }); + } + + const filePath = path.join( + __dirname, + "../../../resources/fixtures/addOrgX/core.yaml", + ); + const buffer = await fs.readFile(filePath); + const coreFile = { + body: buffer.toString("base64"), + filename: "core.yaml", + }; + + const res = await apiClient.deployContractV1({ + channelId, + ccVersion: "1.0.0", + sourceFiles, + ccName: deployedContractName, + targetOrganizations: [ + { + CORE_PEER_LOCALMSPID: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.CORE_PEER_LOCALMSPID, + CORE_PEER_ADDRESS: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.CORE_PEER_ADDRESS, + CORE_PEER_MSPCONFIG: peer0Org1Certs.mspConfig, + CORE_PEER_TLS_ROOTCERT: peer0Org1Certs.peerTlsCert, + ORDERER_TLS_ROOTCERT: peer0Org1Certs.ordererTlsRootCert, + }, + { + CORE_PEER_LOCALMSPID: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2.CORE_PEER_LOCALMSPID, + CORE_PEER_ADDRESS: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2.CORE_PEER_ADDRESS, + CORE_PEER_MSPCONFIG: peer0Org2Certs.mspConfig, + CORE_PEER_TLS_ROOTCERT: peer0Org2Certs.peerTlsCert, + ORDERER_TLS_ROOTCERT: peer0Org2Certs.ordererTlsRootCert, + }, + ], + caFile: peer0Org1Certs.ordererTlsRootCert, + ccLabel: "basic-asset-transfer-2", + ccLang: ChainCodeProgrammingLanguage.Typescript, + ccSequence: 1, + orderer: "orderer.example.com:7050", + ordererTLSHostnameOverride: "orderer.example.com", + connTimeout: 60, + coreYamlFile: coreFile, + }); + + expect(res.status).toBe(200); + expect(res.data.success).toBe(true); + + const assetId = uuidv4(); + + let block_event_emitted = false; + + const { listener, removeListener } = await plugin.createFabricListener( + { + channelName, + contractName: deployedContractName, + gatewayOptions, + eventType: EventType.Block, + } as CreateListenerRequest, + async (event: FabricEvent) => { + log.info("Block event received by listener"); + + block_event_emitted = true; + + event = event as BlockEvent; + + // Basic checks for block event structure + expect(event).toBeTruthy(); + expect(event.blockNumber).toBeDefined(); + expect(event.blockData).toBeDefined(); + }, + ); + + expect(listener).toBeTruthy(); + expect(removeListener).toBeTruthy(); + + log.info("Waiting for block events to be emitted..."); + + log.info("Issuing tx to create asset..."); + + const createRes = await apiClient.runTransactionV1({ + contractName: deployedContractName, + channelName, + params: [assetId, "19"], + methodName: "CreateAsset", + invocationType: FabricContractInvocationType.Send, + signingCredential: { + keychainId, + keychainRef: keychainEntryKey, + }, + }); + expect(createRes).toBeTruthy(); + expect(createRes.status).toBeGreaterThan(199); + expect(createRes.status).toBeLessThan(300); + + if (!block_event_emitted) { + fail("Block event not emitted"); + } + removeListener(); }); }); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts index 8fccc96659..1322ca3eec 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/connector-fabric-baseline.test.ts @@ -203,7 +203,7 @@ describe("PluginLedgerConnectorFabric", () => { await Servers.shutdown(server); }); - it("getBlockV1() -Get first block by it's number - decoded.", async () => { + it("getBlockV1() - Get first block by it's number - decoded.", async () => { const ledgerChannelName = "mychannel"; // Check decoded const decodedFirstBlock = await getBlock({ @@ -221,6 +221,16 @@ describe("PluginLedgerConnectorFabric", () => { expect(decodedFirstBlock.data).toBeTruthy(); expect(decodedFirstBlock.metadata).toBeTruthy(); }); + it("getLatestCurrBlockNumber() - Get current block number.", async () => { + const ledgerChannelName = "mychannel"; + const currentBlockNumber = await apiClient.getLatestBlockNumberV1({ + channelName: ledgerChannelName, + gatewayOptions, + }); + log.debug("Current block number:", currentBlockNumber.data); + expect(currentBlockNumber.data.blockNumber).toBeDefined(); + expect(currentBlockNumber.data.blockNumber).toBeGreaterThanOrEqual(1); + }); it("getBlockV1() - Get first block by it's number - encoded.", async () => { const ledgerChannelName = "mychannel"; diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/invoke.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/invoke.test.ts new file mode 100644 index 0000000000..990bb5bea5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/invoke.test.ts @@ -0,0 +1,105 @@ +import { LogLevelDesc } from "@hyperledger/cactus-common"; +import { PluginRegistry } from "@hyperledger/cactus-core"; +import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +import { + DEFAULT_FABRIC_2_AIO_IMAGE_NAME, + FABRIC_25_LTS_AIO_FABRIC_VERSION, + FABRIC_25_LTS_AIO_IMAGE_VERSION, + FabricTestLedgerV1, + pruneDockerAllIfGithubAction, +} from "@hyperledger/cactus-test-tooling"; + +import { v4 as uuidv4 } from "uuid"; +import { + DefaultEventHandlerStrategy, + IPluginLedgerConnectorFabricOptions, + PluginLedgerConnectorFabric, + RunInvokeRequest, +} from "../../../../main/typescript"; +import { DiscoveryOptions } from "fabric-network"; + +const logLevel: LogLevelDesc = "DEBUG"; + +describe("Invoke tests", () => { + let ledger: FabricTestLedgerV1; + + const keychainId = uuidv4(); + const keychainEntryKey = "user2"; + + let connector: PluginLedgerConnectorFabric; + beforeAll(async () => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await expect(pruning).resolves.not.toThrow(); + ledger = new FabricTestLedgerV1({ + emitContainerLogs: true, + publishAllPorts: true, + imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME, + imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION, + envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]), + logLevel, + }); + await ledger.start({ omitPull: false }); + + const connectionProfile = await ledger.getConnectionProfileOrg1(); + expect(connectionProfile).toBeTruthy(); // Check if connectionProfile is truthy + const enrollAdminOut = await ledger.enrollAdmin(); + const adminWallet = enrollAdminOut[1]; + const [userIdentity] = await ledger.enrollUser(adminWallet); + const keychainInstanceId = uuidv4(); + const keychainEntryValue = JSON.stringify(userIdentity); + const keychainPlugin = new PluginKeychainMemory({ + instanceId: keychainInstanceId, + keychainId, + logLevel, + backend: new Map([ + [keychainEntryKey, keychainEntryValue], + ["some-other-entry-key", "some-other-entry-value"], + ]), + }); + + const pluginRegistry = new PluginRegistry({ plugins: [keychainPlugin] }); + const discoveryOptions: DiscoveryOptions = { + enabled: true, + asLocalhost: true, + }; + + const pluginOptions: IPluginLedgerConnectorFabricOptions = { + instanceId: uuidv4(), + pluginRegistry, + logLevel, + connectionProfile, + discoveryOptions, + eventHandlerOptions: { + strategy: DefaultEventHandlerStrategy.NetworkScopeAllfortx, + commitTimeout: 300, + }, + dockerNetworkName: ledger.getNetworkName(), + }; + + connector = new PluginLedgerConnectorFabric(pluginOptions); + }); + + afterAll(async () => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await expect(pruning).resolves.not.toThrow(); + await ledger.stop(); + await ledger.destroy(); + }); + test("should invoke chaincode", async () => { + const req: RunInvokeRequest = { + signingCredential: { + keychainId, + keychainRef: keychainEntryKey, + }, + channelName: "mychannel", + contractName: "basic", + methodName: "GetAllAssets", + params: [], + }; + + const res = await connector.invoke(req); + expect(res.view.endorsedProposalResponses).toBeDefined(); + expect(res.view.endorsedProposalResponses?.length).toBe(2); + console.log("Invoke result:", JSON.stringify(res, null, 2)); + }); +}); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts index b5ce6185fa..4b09bf762d 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation.test.ts @@ -1,5 +1,5 @@ import { AddressInfo } from "net"; -import http, { Server } from "http"; +import https, { Server } from "https"; import fs from "fs-extra"; import path from "path"; import { v4 as uuidv4 } from "uuid"; @@ -116,7 +116,7 @@ describe("OpenApi Validation Test", () => { const expressApp = express(); expressApp.use(bodyParser.json({ limit: "250mb" })); - server = http.createServer(expressApp); + server = https.createServer(expressApp); const listenOptions: IListenOptions = { hostname: "127.0.0.1", port: 0, diff --git a/packages/cactus-plugin-ledger-connector-fabric/tsconfig.json b/packages/cactus-plugin-ledger-connector-fabric/tsconfig.json index 6555b276b6..8a27e1c9a1 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/tsconfig.json +++ b/packages/cactus-plugin-ledger-connector-fabric/tsconfig.json @@ -6,7 +6,8 @@ "declarationDir": "dist/lib", "resolveJsonModule": true, "rootDir": "./src", - "tsBuildInfoFile": "../../.build-cache/cactus-plugin-ledger-connector-fabric.tsbuildinfo" + "tsBuildInfoFile": "../../.build-cache/cactus-plugin-ledger-connector-fabric.tsbuildinfo", + "allowJs": true }, "include": [ "./src", diff --git a/packages/cactus-plugin-ledger-connector-fabric/wallet-network1/relay.id b/packages/cactus-plugin-ledger-connector-fabric/wallet-network1/relay.id new file mode 100644 index 0000000000..3d050f78f7 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/wallet-network1/relay.id @@ -0,0 +1 @@ +{"credentials":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICkTCCAjegAwIBAgIUcabHrj3uzOT/qLYMpw2/kr/qrNowCgYIKoZIzj0EAwIw\ncjELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRowGAYDVQQK\nExFvcmcxLm5ldHdvcmsxLmNvbTEPMA0GA1UECxMGRmFicmljMR0wGwYDVQQDExRj\nYS5vcmcxLm5ldHdvcmsxLmNvbTAeFw0yNDA2MTcwNjIwMDBaFw0zNDA2MTUwNzQz\nMDBaMEIxMDALBgNVBAsTBG9yZzEwDQYDVQQLEwZjbGllbnQwEgYDVQQLEwtkZXBh\ncnRtZW50MTEOMAwGA1UEAxMFcmVsYXkwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\nAASVptZNTjxeRDtd5WUwKiBXHUczicGVNMTTVAlA48IsQaTTImHGVTsHktZqq/Uw\n/nMpPOf/4wSEb0qfLefN5MSco4HaMIHXMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMB\nAf8EAjAAMB0GA1UdDgQWBBRHSVRhABZ2cwM0CXOfi42X3Dg9PTAfBgNVHSMEGDAW\ngBSjqW3VHCTFVlj3wk5DlBb7yNs8kzB3BggqAwQFBgcIAQRreyJhdHRycyI6eyJo\nZi5BZmZpbGlhdGlvbiI6Im9yZzEuZGVwYXJ0bWVudDEiLCJoZi5FbnJvbGxtZW50\nSUQiOiJyZWxheSIsImhmLlR5cGUiOiJjbGllbnQiLCJyZWxheSI6InRydWUifX0w\nCgYIKoZIzj0EAwIDSAAwRQIhAN56BY2L7+I0rQYBhXlD8iqzr0ynvF6vjvo14SRU\npJzvAiB+PJnxtkNCRO8/SkapDgD0eyigIKTDPdRiY5Z7mTcE8g==\n-----END CERTIFICATE-----\n","privateKey":"-----BEGIN PRIVATE KEY-----\r\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgTZ+LtXT58KVa3qbI\r\nXo+NMe9zbNMLW6qUxoi/YjTGXbOhRANCAASVptZNTjxeRDtd5WUwKiBXHUczicGV\r\nNMTTVAlA48IsQaTTImHGVTsHktZqq/Uw/nMpPOf/4wSEb0qfLefN5MSc\r\n-----END PRIVATE KEY-----\r\n"},"mspId":"Org1MSP","type":"X.509","version":1} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-fabric/wallet-network2/relay.id b/packages/cactus-plugin-ledger-connector-fabric/wallet-network2/relay.id new file mode 100644 index 0000000000..37e3c2d128 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/wallet-network2/relay.id @@ -0,0 +1 @@ +{"credentials":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICkTCCAjegAwIBAgIUOX2NL5N0x/IX0BC2hyG4XR8Pph8wCgYIKoZIzj0EAwIw\ncjELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRowGAYDVQQK\nExFvcmcxLm5ldHdvcmsyLmNvbTEPMA0GA1UECxMGRmFicmljMR0wGwYDVQQDExRj\nYS5vcmcxLm5ldHdvcmsyLmNvbTAeFw0yNDA2MTcwNjI1MDBaFw0zNDA2MTUwNzQ0\nMDBaMEIxMDALBgNVBAsTBG9yZzEwDQYDVQQLEwZjbGllbnQwEgYDVQQLEwtkZXBh\ncnRtZW50MTEOMAwGA1UEAxMFcmVsYXkwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC\nAAQILWNNrxw+RFNgGECMxD7R/NW7hHOcWxGuUbw17dU3H8DwvB5r/V6o/3YTyVym\n1P/MKiEwPz9z1pif38oAwLu/o4HaMIHXMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMB\nAf8EAjAAMB0GA1UdDgQWBBSx4cx7mEdFDznF8yLEuvHfqArQHDAfBgNVHSMEGDAW\ngBTilesMXvxSuqCr6Si0MKVXhJU9nDB3BggqAwQFBgcIAQRreyJhdHRycyI6eyJo\nZi5BZmZpbGlhdGlvbiI6Im9yZzEuZGVwYXJ0bWVudDEiLCJoZi5FbnJvbGxtZW50\nSUQiOiJyZWxheSIsImhmLlR5cGUiOiJjbGllbnQiLCJyZWxheSI6InRydWUifX0w\nCgYIKoZIzj0EAwIDSAAwRQIhAMF/iz94dvRjhbZONLpIp5BIkpwrE02/43t8ErVB\nMoXHAiAxJGfHM7ip/W83AJMdPu7XwaVvXIASfTtyB6UBnxvfJA==\n-----END CERTIFICATE-----\n","privateKey":"-----BEGIN PRIVATE KEY-----\r\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgVyKszKf33WTsan5B\r\nZrPTMHbX8ML0gUetSQolHqhQHVChRANCAAQILWNNrxw+RFNgGECMxD7R/NW7hHOc\r\nWxGuUbw17dU3H8DwvB5r/V6o/3YTyVym1P/MKiEwPz9z1pif38oAwLu/\r\n-----END PRIVATE KEY-----\r\n"},"mspId":"Org1MSP","type":"X.509","version":1} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/cross-chain-mechanisms/oracle/implementations/oracle-fabric.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/cross-chain-mechanisms/oracle/implementations/oracle-fabric.ts index e98886f746..ed9b855958 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/cross-chain-mechanisms/oracle/implementations/oracle-fabric.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/cross-chain-mechanisms/oracle/implementations/oracle-fabric.ts @@ -1,5 +1,6 @@ import { DeploymentTargetOrganization, + EventType, FabricContractInvocationType, type FabricSigningCredential, FileBase64, @@ -25,7 +26,7 @@ import { OracleResponse, } from "../../../public-api"; import { LedgerType } from "@hyperledger/cactus-core-api"; -import { X509Identity } from "fabric-network"; +import { ContractEvent, X509Identity } from "fabric-network"; import { getUint8Key } from "../../bridge/leafs/leafs-utils"; import { UnsupportedNetworkError, @@ -36,12 +37,7 @@ import { import { v4 as uuidv4 } from "uuid"; import { MonitorService } from "../../../services/monitoring/monitor"; import { context, SpanStatusCode } from "@opentelemetry/api"; - -interface ContractEvent { - chaincodeId: string; - eventName: string; - payload?: Buffer; -} +import { FabricEvent } from "@hyperledger/cactus-plugin-ledger-connector-fabric/dist/lib/main/typescript/plugin-ledger-connector-fabric"; export interface IFabricOracleEntry extends IOracleEntryBase { channelName: string; @@ -268,12 +264,15 @@ export class OracleFabric extends OracleAbstract { channelName: this.channelName, contractName: args.contractName, signingCredential: this.signingCredential, + eventType: EventType.Contract, }, - async (event: ContractEvent) => { + async (event: FabricEvent) => { this.log.debug( `${fnTag}: Received event log: ${safeStableStringify(event)}`, ); + event = event as ContractEvent; + if (event) { if (event.eventName === args.eventSignature && event.payload) { const payload = event.payload.toString("utf-8"); diff --git a/yarn.lock b/yarn.lock index 0cd56ac770..844b8d4d31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9456,7 +9456,17 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-ledger-connector-fabric@workspace:packages/cactus-plugin-ledger-connector-fabric" dependencies: + "@bufbuild/buf": "npm:1.47.2" + "@bufbuild/protobuf": "npm:2.2.2" + "@bufbuild/protoc-gen-es": "npm:2.2.2" + "@connectrpc/connect": "npm:2.0.0" + "@connectrpc/connect-express": "npm:2.0.0" + "@connectrpc/connect-node": "npm:2.0.0" + "@connectrpc/protoc-gen-connect-es": "npm:1.6.1" "@fidm/x509": "npm:1.2.1" + "@grpc/grpc-js": "npm:1.13.3" + "@grpc/proto-loader": "npm:0.7.13" + "@hyperledger/cacti-weaver-protos-js": "npm:2.1.0" "@hyperledger/cactus-common": "npm:2.1.0" "@hyperledger/cactus-core": "npm:2.1.0" "@hyperledger/cactus-core-api": "npm:2.1.0" @@ -9468,6 +9478,7 @@ __metadata: "@types/elliptic": "npm:6.4.16" "@types/express": "npm:5.0.1" "@types/fs-extra": "npm:11.0.4" + "@types/google-protobuf": "npm:3.15.12" "@types/http-errors": "npm:2.0.4" "@types/jsrsasign": "npm:8.0.13" "@types/lodash": "npm:4.14.172" @@ -9482,6 +9493,7 @@ __metadata: bn.js: "npm:4.12.0" body-parser: "npm:1.20.3" dockerode: "npm:3.3.0" + dotenv: "npm:17.2.3" elliptic: "npm:6.6.1" express: "npm:5.1.0" fabric-ca-client: "npm:2.5.0-snapshot.23" @@ -9491,12 +9503,16 @@ __metadata: fast-safe-stringify: "npm:2.1.1" form-data: "npm:4.0.0" fs-extra: "npm:11.2.0" + google-protobuf: "npm:3.21.2" + grpc_tools_node_protoc_ts: "npm:5.3.3" http-errors: "npm:2.0.0" http-status-codes: "npm:2.1.4" + http2: "npm:^3.3.7" internal-ip: "npm:6.2.0" joi: "npm:17.13.3" json5: "npm:2.2.3" jsrsasign: "npm:11.0.0" + level: "npm:8.0.0" lodash: "npm:4.17.21" long: "npm:5.2.3" multer: "npm:1.4.5-lts.1" @@ -9506,6 +9522,7 @@ __metadata: openapi-types: "npm:12.1.3" p-retry: "npm:4.6.1" prom-client: "npm:15.1.3" + protobufjs: "npm:7.2.5" run-time-error-cjs: "npm:1.4.0" rxjs: "npm:7.8.1" sanitize-filename: "npm:1.6.3" @@ -28021,6 +28038,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:17.2.3": + version: 17.2.3 + resolution: "dotenv@npm:17.2.3" + checksum: 10/f8b78626ebfff6e44420f634773375c9651808b3e1a33df6d4cc19120968eea53e100f59f04ec35f2a20b2beb334b6aba4f24040b2f8ad61773f158ac042a636 + languageName: node + linkType: hard + "dotenv@npm:8.6.0, dotenv@npm:^8.2.0": version: 8.6.0 resolution: "dotenv@npm:8.6.0" @@ -34533,6 +34557,13 @@ __metadata: languageName: node linkType: hard +"http2@npm:^3.3.7": + version: 3.3.7 + resolution: "http2@npm:3.3.7" + checksum: 10/414cacb8ad90314a3a3e152c94697df709e4d810492c010f44630585d8c4d96cd74fe350b3dca4ccb10bb2b33d6381d61330c7d67d7a682f4368425e3f178c09 + languageName: node + linkType: hard + "https-browserify@npm:1.0.0, https-browserify@npm:^1.0.0": version: 1.0.0 resolution: "https-browserify@npm:1.0.0"